Skip to content

fix(importer): evaluate reconciler leniency relative to wall-clock time - #6305

Merged
another-rex merged 1 commit into
google:masterfrom
another-rex:fix-reconciler-leniency
Nov 4, 2026
Merged

another-rex merged 1 commit into
google:masterfrom
another-rex:fix-reconciler-leniency

Conversation

@another-rex

@another-rex another-rex commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Overview

Fixes importer-reconciler permanently skipping outdated records whose upstream modified timestamp is within ReconcileLeniencyDuration (6 hours) of the previous modified_raw version stored in Datastore (such as CGA-7f3h-rrc2-p5fw).

Details

  • Evaluate leniency relative to now instead of dbMod: we previously checked modified.After(dbMod.Add(ReconcileLeniencyDuration)), measuring the gap between two versions of the record (modified - dbMod > 6h) rather than how recently the upstream modification occurred (now - modified > 6h). Any missed update published within 6 hours of its prior revision was never fixed

  • Compare modified vs dbMod at whole-second precision: Upstream index feeds such as Chainguard's all.json emit millisecond precision (2026-10-07T02:17:41.861Z) while their individual <id>.json endpoints truncate to whole seconds (2026-10-07T02:17:41Z). Truncating is not ideal (This really is more of a chainguard issue), but it's a quick fix.

agy

@another-rex
another-rex force-pushed the fix-reconciler-leniency branch from 19f98e0 to 9bc2859 Compare November 4, 2026 03:26

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am a bit suspicious of the usefulness of these new tests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok fixed it.

michaelkedar
michaelkedar previously approved these changes Nov 4, 2026
Comment thread go/internal/importer/importer.go Resolved
Previously, `checkReconcile` and `processUpdate` (`ActionReconcile`) checked
`modified.After(dbMod.Add(ReconcileLeniencyDuration))`, which permanently
skipped any missed upstream update whose `modified` timestamp was within 6 hours
of the record's previous `modified_raw` timestamp in Datastore.

Evaluate `ReconcileLeniencyDuration` relative to wall-clock `now`
(`now.Sub(modified) > ReconcileLeniencyDuration`) while comparing `modified`
against `dbMod` at whole-second precision so feeds whose index includes
sub-second timestamps (e.g. Chainguard's `all.json`) do not falsely trigger
reimports against whole-second individual advisory files.
@another-rex
another-rex merged commit a77ef41 into google:master Nov 4, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants