test(sync): add scenario tests for mgw:sync drift detection and auto-sync#266
Merged
snipcodeit merged 1 commit intomainfrom Mar 6, 2026
Merged
Conversation
Owner
Author
Testing ProceduresRun the full sync-drift test suite: ```bash Expected output: Test Files 1 passed (1) Scenario-by-Scenario ChecksScenario 1 (no-drift-baseline):
Scenario 2 (stale-auto-sync):
Scenario 3 (comment-delta-drift):
Scenario 4 (pr-merged-stage-pr-created):
Integration:
|
This was referenced Mar 6, 2026
…sync Covers four scenarios from issue #255: - No-drift baseline: GH updatedAt <= local mtime → no sync fires - Stale auto-sync: GH updatedAt > local mtime → state refreshed, console.warn logged - Comment delta drift: current count > stored count → flagged in report - PR merged but stage=pr-created → pipeline_stage transitions to done 28 tests across 5 describe blocks (plus integration sync report verification). Uses mock-github.cjs for gh CLI interception and fs.utimesSync for mtime control. Also includes vitest infrastructure (vitest.config.js, test/setup.js, test/loadFixture.js, lib/mock-github.cjs, test/fixtures/github/) carried forward from PR #265 dependency. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
432796e to
92946cc
Compare
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
test/sync-drift.test.jswith 28 vitest scenario tests covering all four sync drift scenarios from issue Write scenario tests for mgw:sync drift detection and auto-sync #255test/fixtures/github/pr-view-merged.jsonfixture for PR-merged scenarioCloses #255
Milestone Context
Changes
test/sync-drift.test.js— 28 tests in 5 describe blockstest/fixtures/github/pr-view-merged.json— Merged PR fixture (Scenario 4)lib/mock-github.cjs— GitHub API interceptor (from PR test: add milestone execution scenario tests #265)test/setup.js,test/loadFixture.js— Vitest helpers (from PR test: add milestone execution scenario tests #265)vitest.config.js— Vitest runner config (from PR test: add milestone execution scenario tests #265)package.json— Added vitest devDependency and test scriptstest/fixtures/github/*.json— Base GitHub API fixtures (from PR test: add milestone execution scenario tests #265)Test Plan
npx vitest run test/sync-drift.test.jspasses all 28 testsGH_EPOCH <= LOCAL_MTIME→ no sync, no state mutationconsole.warncalledpipeline_stageNOT mutatedpipeline_stage=doneNotes
This PR depends on PR #265 for the full test infrastructure. The vitest config, mock-github.cjs, and base fixtures are duplicated here to keep this branch runnable independently. Once PR #265 merges, the duplicate infrastructure in this branch will be superseded by the merged versions.