WL-0MM8V5GTH06V9Z0P: Make delegate mock destructive and add preservation test#790
Merged
rgardler-msft merged 1 commit intomainfrom Mar 2, 2026
Merged
Conversation
…ion test - Update db.import mock in createDelegateTestContext() to clear items before re-inserting, matching real db.import() semantics - Add test verifying non-delegated items survive delegation - This test would fail if upsertItems() were reverted to import()
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.importmock increateDelegateTestContext()destructive (clear-then-insert) to match realdb.import()semantics, ensuring mock-based tests would catch data-loss bugs if someone reverted the fix.preserves non-delegated items after successful delegationthat creates 3 items, delegates one, and verifies the other two still exist.Context
Part of the fix for critical data-loss bug WL-0MM8RQOC902W3LM5. This is Feature 3 of 4:
db.upsertItems()API (PR WL-0MM8V4UPC02YMFXK: Add non-destructive db.upsertItems() API #788, merged)db.import()withdb.upsertItems()in GitHub flows (PR WL-0MM8V55PV1Q32K7D: Fix destructive db.import() in GitHub flows #789, merged)db.import()call sites and add safety docsTest results
Changes
tests/cli/delegate-guard-rails.test.ts: Updateddb.importmock to callitems.clear()before inserting (matching real semantics), added explanatory comment, added new preservation test.