fix(index): include unscanned repository targets - #547
Open
sylvesterkaczmarek wants to merge 2 commits into
Open
fix(index): include unscanned repository targets#547sylvesterkaczmarek wants to merge 2 commits into
sylvesterkaczmarek wants to merge 2 commits into
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Include persisted security targets that have not been scanned yet in the native repository index, and make the
not_scannedstatus filter functional.Fixes #546.
Reproduction / evidence
Current upstream
mainat37bf87a692fc72d41f7312cc48808d699d204fbacan persist a target before any scan exists:create_workspace()callsensure_security_target()when a target path is selected.list_repositories()currently builds its repository collection only fromlatest_scan_by_target.items(). Every row admitted to the collection therefore already has a scan. The later predicateargs.status != "not_scanned"then rejects every row whennot_scannedis requested.A deterministic state with two persisted targets and a scan for only one target produces an empty
not_scannedresult on currentmain.Root cause
Scan history, rather than
security_targets, was used as the primary set for the repository index. Zero-scan targets were discarded before status filtering.Fix
scanCount: 0andlatestScan: nullfor unscanned targets;scannedandnot_scannedpredicates fromscanCount;open_findingsbehavior.Tests / validation
Added
native-repository-index.test.ts. It imports the actual Python index module against an in-memory SQLite fixture containing one scanned and one unscanned target, then verifies:status=scannedreturns only the scanned target;status=not_scannedreturns only the zero-scan target;scanCount: 0andlatestScan: null.The branch is based directly on current upstream
mainat37bf87a692fc72d41f7312cc48808d699d204fbaand is not behind it. Production change: 12 additions and 5 deletions.Full repository tests cannot be run in this execution environment because the repository cannot be cloned here. Pushed-head CI remains the authoritative full-suite validation.
Risk
Low. Existing scanned repository ordering and summaries are preserved. The only newly surfaced rows are persisted targets with zero scans, which the existing status vocabulary already models.