WL-0MM8V4UPC02YMFXK: Add non-destructive db.upsertItems() API#788
Merged
rgardler-msft merged 1 commit intomainfrom Mar 2, 2026
Merged
WL-0MM8V4UPC02YMFXK: Add non-destructive db.upsertItems() API#788rgardler-msft merged 1 commit intomainfrom
rgardler-msft merged 1 commit intomainfrom
Conversation
Add upsertItems(items, dependencyEdges?) method to WorklogDatabase that saves items via INSERT OR REPLACE without calling clearWorkItems(), preventing data loss when updating a subset of work items. Key behaviors: - Iterates items calling store.saveWorkItem() (INSERT...ON CONFLICT DO UPDATE) - Only upserts dependency edges whose fromId or toId belongs to provided items - Calls exportToJsonl() and triggerAutoSync() exactly once after upserting - No-op when items array is empty (no export/sync triggered) - Existing import() method is unchanged Includes 13 unit tests covering all acceptance criteria.
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
upsertItems(items, dependencyEdges?)method toWorklogDatabasethat saves items viaINSERT OR REPLACEwithout callingclearWorkItems(), preventing data loss when updating a subset of work itemsfromIdortoIdbelongs to the provided items set, leaving all other edges untouchedWork Item
WL-0MM8V4UPC02YMFXK (child of WL-0MM8RQOC902W3LM5 — Fix destructive db.import() in GitHub sync flows)
Changes
src/database.ts: AddedupsertItems()method adjacent to existingimport()methodtests/unit/database-upsert.test.ts: 13 unit tests covering all acceptance criteriaTesting