fix(csvim): change detection spans the referenced CSV files (#6686) - #6697
Merged
Conversation
A .csvim artefact re-imported only when its own content changed - the referenced CSVs were read during the import but took no part in change detection, so editing only a CSV re-imported nothing, silently. The .csvim is a stable pointer that stays byte-identical when a seed value changes, so the ordinary editing path never reached the (now correct, after #6683) UPDATE re-import. The Synchronizer interface gains a checksumContent(location, content) hook - by default the definition file's own bytes - which SynchronizationProcessor.checkAndCollect uses for the definition's checksum. CsvimSynchronizer overrides it to append each referenced CSV's content, so an edited CSV yields MODIFIED and the existing UPDATE path runs unchanged. A CSV that does not exist yet contributes nothing, so its later appearance also triggers the import. The new IT drives the full synchronizer path over registry fixtures, edits ONLY the .csv, and asserts the row's value - verified red without the fix (expected Varna, was Sofia) and green with it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Fixes #6686 — the sequel to #6676 / #6683: that one fixed the UPDATE binding so a re-import can apply a changed value; this one makes the re-import actually trigger when only a referenced
.csvchanges.The defect
SynchronizationProcessor.checkAndCollectcomputed the definition checksum from the.csvimfile's own bytes alone. The referenced CSVs were opened only insideimportCsvim, well after the MODIFIED decision — so editing only a CSV left the artefactCREATED, both inner switches fell through, and nothing was imported. No error, no warning. Since the.csvimis a stable pointer that stays byte-identical when a seed value changes, the ordinary editing path could never reach the re-import.The fix
Synchronizer.checksumContent(location, content)— a new default hook returning the content whose checksum decides whether the definition is MODIFIED. Default: the file's own bytes (no behavior change for any other synchronizer).SynchronizationProcessor.checkAndCollectcalls the hook and, when it extends the content, updates the definition checksum with the extended bytes. The definition'scontent(whatparsereceives) stays the.csvim's own bytes.CsvimSynchronizeroverrides the hook to append each referenced CSV's content to the.csvimbytes, so an edited CSV yieldsMODIFIEDand the existing UPDATE path runs unchanged (which, with fix(csvim): bind the UPDATE's WHERE key at the table's column count #6683 merged, now applies values correctly). A CSV that does not exist yet contributes nothing — its later appearance changes the checksum and triggers the import, closing a second silent gap for free. A parse failure falls back to the original bytes (the definition then breaks inparseas before).Test
CsvimReimportIT.editingOnlyTheCsvTriggersReimportdrives the full synchronizer path: writes.table+.csv+.csvimregistry fixtures, forces a sync, then rewrites only the CSV (the.csvimstays byte-identical — per the issue's warning, a fixture that also touches the.csvimpasses while missing the bug) and asserts the row's value after the second sync.expected: <Varna> but was: <Sofia>CsvimReimportITtests stay greenformatter:validateand the release-profile javadoc check passNot touched (deliberately)
The
switch (flow)fall-through inCsvimSynchronizer.completeImplthat the issue flags under "worth the implementer's attention" is left as-is — this fix rides the existing UPDATE/MODIFIED path and does not depend on the fall-through's behavior; changing lifecycle-transition semantics is out of scope here.🤖 Generated with Claude Code