Repository navigation
fix(dir): document and pin that a regsync'd scan report is not imported - #2500
sarankumar1325 wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Thanks @sarankumar1325 for this — careful work, and the mutation check is the right way to validate a pinning test. One correction, and it comes from my issue rather than from your PR: a copied scan report is imported on other paths. Could you scope the change to that?
One preference, take it or leave it: I'd drop the |
783e8c6 to
f0d186f
Compare
|
@ramizpolic I created the related issue for scan-reports. Please, check it #2519 |
…ported Signed-off-by: sarankumar1325 <[email protected]>
The note said a copied scan report is never imported as a scan_reports row. That holds for regsync, which copies registry to registry and never passes through server/ingest, but not for ingest itself: applyReferrerDBEffects writes the row with source "imported" on push and on autosync. Say regsync where regsync is meant, name the path that does import, and rename the test accordingly. Signed-off-by: Tibor Kircsi <[email protected]> Co-authored-by: Cursor <[email protected]>
e9422ad to
69ebbc9
Compare
Fixes #2488
What
This makes no behaviour change. It writes down, and pins with a test, why a scan report that regsync copied with a record is not imported, as the issue proposes (points 1 and 2).
reconciler/tasks/indexer/task.go: a comment next to the signature backfill, which is where someone looking for the scan counterpart will look. It says:scan_reportsrow.SetRecordSigned, becauseGetRecordsNeedingScanalready selects every record with no row. The record is scanned here and gets its own row withsource: local.dirctl pull --scan-reportreturns the copied report.reconciler/tasks/regsync/regsync_config.go: theReferrers: true // ... for signaturescomment now adds that scan reports travel too but are not imported, and points at the indexer. It's still one line, so the struct alignment is unchanged.I left out point 3 (prioritising records that arrived with a report). The issue makes it conditional on the window being long in practice.
Tests
TestRun_DoesNotImportASyncedScanReportinreconciler/tasks/indexer. It uses a fake store holding a signature referrer and a scan report referrer, and a fake database that is a fullScanReportDatabaseAPI. The test checks two things:UpsertScanReportcall is made.ScanReportReferrerType, type-assert the db, callUpsertScanReport), and the test fails. It passes on this branch.go testpasses inreconciler ./tasks/indexer/ ./tasks/regsync/.go vet,gofmtandgolangci-lint runreport 0 issues on both packages.