WL-0MM8V55PV1Q32K7D: Fix destructive db.import() in GitHub flows#789
Merged
rgardler-msft merged 1 commit intomainfrom Mar 2, 2026
Merged
Conversation
…ems() in all GitHub flows Replace all 4 db.import() calls in src/commands/github.ts with db.upsertItems() to prevent data loss when GitHub flows (push, import, import-then-push, delegate) are called with partial item sets. Remove dead db.getAll() call in delegate flow. Add upsertItems to mock db in delegate-guard-rails tests. Add 9 integration tests using real SQLite to verify that upserting a subset preserves all non-affected items, comments, and dependency edges. Includes a regression guard proving db.import() is destructive.
This was referenced Mar 2, 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
db.import()calls insrc/commands/github.tswith the non-destructivedb.upsertItems()API (added in PR WL-0MM8V4UPC02YMFXK: Add non-destructive db.upsertItems() API #788)wl gh delegate,wl gh push, andwl gh importcould wipe all local work items when called with partial item setsconst items = db.getAll()in the delegate flow (line 520)Changes
Source (
src/commands/github.ts)db.import(updatedItems)->db.upsertItems(updatedItems)db.import(mergedItems)->db.upsertItems(mergedItems)db.import(markedItems)->db.upsertItems(markedItems)db.import(updatedItems)->db.upsertItems(updatedItems), removed unuseddb.getAll()callTests
tests/cli/delegate-guard-rails.test.ts: AddedupsertItemsmethod to mock db objecttests/integration/github-upsert-preservation.test.ts(new): 9 integration tests using real SQLite:db.import()with partial set destroys non-included itemsRelated Work Items