Skip to content

feat: adds db prefilter for gpu#3188

Merged
stalniy merged 1 commit into
mainfrom
feat/db-gpu-filter
May 18, 2026
Merged

feat: adds db prefilter for gpu#3188
stalniy merged 1 commit into
mainfrom
feat/db-gpu-filter

Conversation

@stalniy
Copy link
Copy Markdown
Contributor

@stalniy stalniy commented May 18, 2026

Why

Ref CON-343

What

adds possibility to prefilter providers by gpu, either by vendor or by vendor and model, using gpu_models column

Summary by CodeRabbit

  • New Features

    • GPU model filtering now includes vendor-only specifications (e.g., "nvidia") alongside vendor/model combinations.
    • Provider bid screening now filters candidates based on GPU model compatibility at the per-unit level.
  • Bug Fixes

    • GPU vendor strings are now preserved with correct casing in cluster inventory matching.
  • Tests

    • Extended test coverage for GPU attribute parsing and token generation.
    • Added test scenarios for GPU model matching across multiple units and attributes.

Review Change Stack

@stalniy stalniy requested a review from a team as a code owner May 18, 2026 04:55
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a4d2c03e-cf45-40ae-af80-b151bc8e05d2

📥 Commits

Reviewing files that changed from the base of the PR and between 0be6b24 and 6b6082c.

📒 Files selected for processing (7)
  • apps/provider-inventory/src/lib/project-row/project-row.spec.ts
  • apps/provider-inventory/src/lib/project-row/project-row.ts
  • apps/provider-inventory/src/repositories/bid-screening/bid-screening.aggregator.spec.ts
  • apps/provider-inventory/src/repositories/bid-screening/bid-screening.aggregator.ts
  • apps/provider-inventory/src/repositories/bid-screening/bid-screening.repository.integration.ts
  • apps/provider-inventory/src/repositories/bid-screening/bid-screening.repository.ts
  • apps/provider-inventory/src/services/cluster-inventory-matcher/cluster-inventory-matcher.service.ts

📝 Walkthrough

Walkthrough

This PR expands GPU model filtering throughout the bid-screening pipeline. projectRow now includes vendor-only GPU tokens alongside vendor/model pairs. aggregateCriteria derives these tokens from GPU attributes, and BidScreeningRepository applies per-unit GPU filtering via SQL overlap checks. Vendor string normalization is removed from the inventory matcher.

Changes

GPU model projection and filtering pipeline

Layer / File(s) Summary
GPU model projection expansion
apps/provider-inventory/src/lib/project-row/project-row.ts, apps/provider-inventory/src/lib/project-row/project-row.spec.ts
projectRow adds GPU vendor strings to gpuModels when present. Three test cases updated to assert both vendor-only and vendor/model tokens in projections.
GPU token generation from attributes
apps/provider-inventory/src/repositories/bid-screening/bid-screening.aggregator.ts, apps/provider-inventory/src/repositories/bid-screening/bid-screening.aggregator.spec.ts
aggregateCriteria now derives gpuTokens per unit via new gpuTokensForUnit helper, parsing GPU attributes into vendor or vendor/model strings and deduplicating. Tests validate vendor-only tokens, vendor/model pairs, multiple attributes (OR alternatives), and zero-GPU empty tokens.
Per-unit GPU token filtering in repository
apps/provider-inventory/src/repositories/bid-screening/bid-screening.repository.ts, apps/provider-inventory/src/repositories/bid-screening/bid-screening.repository.integration.ts
BidScreeningRepository.#buildWhere adds arrayOverlaps SQL conditions for units with non-empty gpuTokens, filtering providers by GPU model overlap. Integration tests verify vendor/model matching, wrong-vendor exclusion, OR behavior across GPU attributes, AND requirements across multiple units, and GPU-less unit handling. Test helpers extended to accept GPU attributes.
Vendor string normalization removal
apps/provider-inventory/src/services/cluster-inventory-matcher/cluster-inventory-matcher.service.ts
Vendor string no longer lowercased when building pinnedSpec.vendor in #tryAdjustGPU.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes


Possibly related PRs

  • akash-network/console#3172: Refactored project-row GPU vendor/name handling for bid matching, directly tied to this PR's GPU model projection and token logic.

Suggested labels

size: L, experienced-contributor


Suggested reviewers

  • baktun14
  • ygrishajev
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/db-gpu-filter

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.96%. Comparing base (0be6b24) to head (6b6082c).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3188      +/-   ##
==========================================
- Coverage   63.72%   62.96%   -0.76%     
==========================================
  Files        1091     1050      -41     
  Lines       26467    25443    -1024     
  Branches     6422     6258     -164     
==========================================
- Hits        16865    16020     -845     
+ Misses       8404     8238     -166     
+ Partials     1198     1185      -13     
Flag Coverage Δ *Carryforward flag
api 84.24% <ø> (ø) Carriedforward from 0be6b24
deploy-web 46.68% <ø> (ø) Carriedforward from 0be6b24
log-collector ?
notifications 91.06% <ø> (ø) Carriedforward from 0be6b24
provider-console 81.48% <ø> (ø) Carriedforward from 0be6b24
provider-inventory 82.13% <100.00%> (+0.24%) ⬆️
provider-proxy 86.08% <ø> (ø) Carriedforward from 0be6b24
tx-signer ?

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
...vider-inventory/src/lib/project-row/project-row.ts 100.00% <100.00%> (ø)
...sitories/bid-screening/bid-screening.aggregator.ts 100.00% <100.00%> (ø)
...sitories/bid-screening/bid-screening.repository.ts 100.00% <100.00%> (ø)
...ntory-matcher/cluster-inventory-matcher.service.ts 95.09% <ø> (ø)

... and 41 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@stalniy stalniy added this pull request to the merge queue May 18, 2026
Merged via the queue into main with commit 9417865 May 18, 2026
56 checks passed
@stalniy stalniy deleted the feat/db-gpu-filter branch May 18, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants