Repository navigation
fix: keep snapshot imports from clearing the wrong table - #258
Merged
Merged
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
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.
What Problem This Solves
A full snapshot import of a table named
" messages"or"messages "clears"messages"instead. The import can succeed after deleting unrelated rows while leaving stale rows in the intended table.User Impact
Full imports now replace rows in the exact named table and preserve the unrelated unpadded table. Custom delete callbacks receive the exact table name. Blank delete-list entries remain ignored; no API or snapshot format changes are required.
Why This Change Was Made
Keep the original table name when clearing rows, matching how the importer inserts them. Whitespace trimming is used only to recognize blank list entries.
Evidence
All eight regression cases failed before the fix and pass afterward. They cover leading and trailing spaces, inferred and explicit delete lists, and generic and custom deletion. Each checks that stale rows disappear and unrelated rows survive. Local library validation passed. Independent native review found no P0–P3 issues.
Validation details
GOWORK=off go test -count=1 ./snapshot -run '^TestImportPreservesLiteralDeleteTableNames$'GOWORK=off go mod tidygit diff --exit-code -- go.mod go.sumGOWORK=off go vet ./...GOWORK=off go test -count=1 ./...git diff --checkeaaf2a0d958411dad8890cfe7a17df10a9cf6849bf9bdd162a3cc5595926f145abfb2202e3bba880