Skip to content

fix(dir): document and pin that a regsync'd scan report is not imported - #2500

Open
sarankumar1325 wants to merge 2 commits into
agntcy:mainfrom
sarankumar1325:docs/2488-synced-scan-report-not-imported
Open

sarankumar1325 wants to merge 2 commits into
agntcy:mainfrom
sarankumar1325:docs/2488-synced-scan-report-not-imported

Conversation

@sarankumar1325

Copy link
Copy Markdown
Contributor

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:
    • A copied scan report is the publisher's assertion, not this node's conclusion, so it never becomes a scan_reports row.
    • It also needs no trigger like SetRecordSigned, because GetRecordsNeedingScan already selects every record with no row. The record is scanned here and gets its own row with source: local.
    • Until then the record reads as unscanned, even though dirctl pull --scan-report returns the copied report.
  • reconciler/tasks/regsync/regsync_config.go: the Referrers: true // ... for signatures comment 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

  • New TestRun_DoesNotImportASyncedScanReport in reconciler/tasks/indexer. It uses a fake store holding a signature referrer and a scan report referrer, and a fake database that is a full ScanReportDatabaseAPI. The test checks two things:
    • The record is indexed and marked signed.
    • No UpsertScanReport call is made.
  • Checked against a mutation: I added a scan-report backfill next to the signature one (walk ScanReportReferrerType, type-assert the db, call UpsertScanReport), and the test fails. It passes on this branch.
  • go test passes in reconciler ./tasks/indexer/ ./tasks/regsync/. go vet, gofmt and golangci-lint run report 0 issues on both packages.

@sarankumar1325
sarankumar1325 requested a review from a team as a code owner November 11, 2026 14:00
@github-actions github-actions Bot added the size/S Denotes a PR that changes 50-199 lines label Nov 11, 2026
@codecov

codecov Bot commented Nov 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@tkircsi

tkircsi commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

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. server/ingest/ingest.go (applyReferrerDBEffects) writes a scan_reports row with source: types.ScanSourceImported, and ingest is used by the gRPC store controller on push and by autosync (#2461 is closed, so that path is live). What's true is narrower: regsync bypasses ingest, so no row is written and the record is scanned locally.

Could you scope the change to that?

  • The indexer comment: say regsync specifically, and point at server/ingest/ingest.go as the path that does import with source: imported. As written it tells the next reader the import can't happen, at exactly the spot where they'd go looking for it.
  • TestRun_DoesNotImportASyncedScanReport → name it for regsync, since an autosync'd scan report is imported.
  • PR title likewise: "a regsync'd scan report is not imported".

One preference, take it or leave it: I'd drop the // TestRun_... pins this. line. It's the only place in the repo where production code names a test, and nothing catches it going stale if the test is renamed.

@lgecse
lgecse force-pushed the docs/2488-synced-scan-report-not-imported branch 2 times, most recently from 783e8c6 to f0d186f Compare November 17, 2026 20:36
@lgecse
lgecse requested a review from tkircsi November 17, 2026 20:36
@tkircsi tkircsi changed the title fix(dir): document and pin that a synced scan report is not imported fix(dir): document and pin that a regsync'd scan report is not imported Nov 18, 2026

@tkircsi tkircsi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

@tkircsi

tkircsi commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

@ramizpolic I created the related issue for scan-reports. Please, check it #2519

sarankumar1325 and others added 2 commits November 20, 2026 09:10
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]>
@lgecse
lgecse force-pushed the docs/2488-synced-scan-report-not-imported branch from e9422ad to 69ebbc9 Compare November 20, 2026 08:10
@lgecse
lgecse requested a review from ramizpolic November 20, 2026 08:10

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security size/S Denotes a PR that changes 50-199 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: A synced record reads as never scanned while its scan report sits in the store

3 participants