Fix batch worker writing extraction.json to wrong product directory ( close #26 )#27
Open
kiannidev wants to merge 1 commit into
Open
Fix batch worker writing extraction.json to wrong product directory ( close #26 )#27kiannidev wants to merge 1 commit into
kiannidev wants to merge 1 commit into
Conversation
Use full productPathRel as Anthropic Batch custom_id so the poll worker writes to the correct nested directory. Invalidate extraction cache on write. Fixes aglover1221#26
e336723 to
4255c01
Compare
This was referenced May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #26 — the Anthropic batch poll worker wrote
extraction.jsonto{DATA_DIR}/{slug}/instead of the nested product path (e.g.server/dell/poweredge/r770/).Related Issue
Fixes #26
Change Type
What Changed
productPathReltoProductContextand exported helpers:batchCustomId(ctx)— full nested path used as Anthropic Batchcustom_idresolveBatchProductDir(customId)— resolves write directory with data-root confinementsubmitBatchForCategory()now setscustom_idto the full product path, not bare slugresolveBatchProductDir()instead ofpath.resolve(DATA_DIR, slug)insertResult()stores the batch custom id so worker DB lookup matches Anthropic results/products/[slug]using basename when stored path is nestedwriteExtractionJson()callsinvalidateExtractionCache()after every writetests/unit/extract-batch.test.ts(4 cases)Files Changed
lib/pipeline/extract.tsproductPathRel, batch helpers, custom_id fix, cache invalidationworker/handlers/anthropic-batch.tsapp/api/pipeline/extract/route.tsscripts/extract-one.tsapp/pipeline/runs/[id]/page.tsxtests/unit/extract-batch.test.tsValidation
Test Plan
r770underservercategoryextraction.jsonwritten todata/sample/server/dell/poweredge/r770/data/sample/r770/is NOT created/products/r770