Skip to content

fix(importer): add lookback window and pre-fetch check for REST imports - #6310

Merged
jess-lowe merged 1 commit into
google:masterfrom
another-rex:fix-rest-import-lookback
Nov 24, 2026
Merged

jess-lowe merged 1 commit into
google:masterfrom
another-rex:fix-rest-import-lookback

Conversation

@another-rex

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

Copy link
Copy Markdown
Contributor

Summary

Incremental REST imports (handleImportREST) previously skipped any index entry with modified <= LastUpdated. Because LastUpdated advances to maxModified on each run, an advisory update could be permanently missed by the regular importer whenever:

  1. Upstream published advisories to the REST index out of modified timestamp order (e.g., an advisory generated slightly earlier than another entry that already advanced LastUpdated), or
  2. The index (all.json) already listed the new modified timestamp on run N, advancing LastUpdated, while the individual <id>.json endpoint briefly served the previous version during CDN/storage propagation.

Changes

  • Apply a rolling 12h lookback window (restImportLookbackWindow) against LastUpdated when scanning REST index entries in handleImportREST (while still persisting the true LastUpdated watermark).
  • Attach KnownID and KnownModified from the REST index entry onto WorkItem and check VulnerabilityStore.GetSourceModified at whole-second granularity before opening SourceRecord in processUpdate, avoiding redundant HTTP <id>.json fetches and Pub/Sub tasks for advisories within the lookback window that are already up to date.

agy

@another-rex
another-rex force-pushed the fix-rest-import-lookback branch from 8b4582b to db53e09 Compare November 4, 2026 23:09
@another-rex
another-rex requested review from a team and Ly-Joey November 20, 2026 04:34
@another-rex another-rex added the wheel-of-fortune Intentionally blank label Nov 20, 2026
@another-rex
another-rex marked this pull request as ready for review November 20, 2026 04:34
Ly-Joey
Ly-Joey previously approved these changes Nov 20, 2026
@jess-lowe
jess-lowe enabled auto-merge (squash) November 24, 2026 03:46
@another-rex
another-rex disabled auto-merge November 24, 2026 04:05
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.57%. Comparing base (0b2bed5) to head (6749479).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
go/internal/importer/importer.go 50.00% 6 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6310   +/-   ##
=======================================
  Coverage   55.57%   55.57%           
=======================================
  Files         222      222           
  Lines       22919    22933   +14     
=======================================
+ Hits        12737    12745    +8     
- Misses      10179    10185    +6     
  Partials        3        3           
Flag Coverage Δ
go 59.19% <60.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jess-lowe
jess-lowe merged commit a1d40ed into google:master Nov 24, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wheel-of-fortune Intentionally blank

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants