-
Notifications
You must be signed in to change notification settings - Fork 212
fix: v1 dependencies - total now reflects the total count across the organization matching the filters, not the current page. #697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
fsargent
merged 1 commit into
main
from
fix/TRACKER-958-total-in-dependencies-api-endpoint-response-does-not-respect-filter
Oct 7, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please provide some supporting documentation for this. (code snippets, example API calls with/without filters)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Analysis
In registry/src/web/routes/api/v1/external/org/dependencies.ts:
Line 273: total: count, — the count variable is returned as total
Lines 230-249: count comes from Projects.getProjectsAndDependencies()
In dependencies.ts (lines 188-199): count is computed by ProjectSnapshotsStorage.countMonitorDependencies()
In monitor-dependencies.ts
(lines 829-834): the
SQL is COUNT(DISTINCT("full")) AS "count"— a distinct count of all dependencies matching the filtersTracing how filters are applied in the dependencies API to confirm whether
totalreflects them.The
totalfield accounts for filtersFilter flow
dependencies.tslines 222-229): extracts filters from the request bodygetProjectsAndDependencies()(line 243): passes...usedFiltersto the database layercountMonitorDependencies()(lines 188-199): receives the filtersgenerateDependenciesWhereSQL()(lines 709-764): builds the WHERE clause from:dependencies(lines 728-731)licenses(lines 733-739)severity(lines 747-756)depStatus(lines 741-745)monitorIds(lines 723-726)SQL query
The
where.queryincludes all applied filters, so the count reflects only dependencies matching those filters.Example
total= 6024 (all dependencies in the org)total= 150 (dependencies with high-severity issues)total= 50 (dependencies with specific licenses)Documentation update
The description should be:
This is more accurate than "The number of results returned" because it reflects the filtered total, not the current page size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant trying out the actual API not some AI-generated tokens