Skip to content

Invalidate extraction index cache after writes ( Close #28 )#29

Open
kiannidev wants to merge 1 commit into
aglover1221:mainfrom
kiannidev:fix/extraction-cache-invalidation
Open

Invalidate extraction index cache after writes ( Close #28 )#29
kiannidev wants to merge 1 commit into
aglover1221:mainfrom
kiannidev:fix/extraction-cache-invalidation

Conversation

@kiannidev
Copy link
Copy Markdown

Summary

Fixes #28listExtractions(), getExtraction(), and getProductDir() memoize for 30s but invalidateExtractionCache() was never called after disk writes. Pages and APIs returned stale extraction data until TTL expired.

Related Issue

Fixes #28

Change Type

  • Bug fix
  • Regression tests
  • New feature
  • UI change
  • Security fix

What Changed

  • writeExtractionJson() now calls invalidateExtractionCache() after every write (covers batch worker, sync extract, extract-one CLI)
  • atomicWriteJson() invalidates when writing extraction.json (covers spotfix accept path)
  • Added tests/unit/extraction-cache.test.ts with behavioral tests proving getExtraction() sees new data immediately after writes

Files Changed

File Change
lib/pipeline/extract.ts Call invalidateExtractionCache() in writeExtractionJson()
lib/pipeline/extraction-paths.ts Call invalidateExtractionCache() in atomicWriteJson() for extraction.json
tests/unit/extraction-cache.test.ts 3 regression tests

Validation

./node_modules/.bin/tsc --noEmit   # pass
npm run build                      # pass
npm test                           # 3 new + existing tests

Test Plan

  • Load product page for r770 (warms cache)
  • Accept a spotfix or run sync extract within 30s
  • Reload product page — updated values visible immediately
  • Portfolio index reflects new extraction without waiting 30s

Call invalidateExtractionCache() from writeExtractionJson and
atomicWriteJson so getExtraction reflects disk state immediately
instead of serving stale data for up to 30s.
Fixes aglover1221#28
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.

[bug] extraction index cache never invalidated after writes — stale reads for 30s

1 participant