test(project): add scenario tests for all six mgw:project STATE_CLASS paths#264
Merged
snipcodeit merged 1 commit intomainfrom Mar 6, 2026
Merged
Conversation
… paths (closes #253) - Extract detectProjectState() into lib/state.cjs with five-signal classification (P/R/S/M/G signals from workflows/detect-state.md) and export it - Write test/project-state-detection.test.js with 19 vitest tests: one describe block per STATE_CLASS (Fresh, GSD-Only, GSD-Mid-Exec, Aligned, Diverged, Extend) plus return-shape contract tests - Add test/fixtures/project-state/{aligned,diverged,extend}.json fixtures for pre-seeded .mgw/project.json scenarios - Include vitest infrastructure from PR chain (#247-#252): vitest.config.js, mock-github.cjs, mock-gsd-agent.cjs, loadFixture.js, setup.js, checkpoint.test.js, pipeline-transitions.test.js, all fixture files - Update package.json scripts (test→vitest run, test:node→node --test) and add vitest ^2.1.9 to devDependencies All 83 tests pass (19 new + 28 pipeline-transitions + 36 checkpoint). Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This was referenced Mar 6, 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
detectProjectState()intolib/state.cjs— encapsulates the five-signal classification logic fromworkflows/detect-state.mdas a pure JavaScript function (no shell calls)test/project-state-detection.test.jswith 19 vitest scenario tests — onedescribeblock per STATE_CLASS (Fresh, GSD-Only, GSD-Mid-Exec, Aligned, Diverged, Extend) plus return-shape contract testsCloses #253
Milestone Context
Changes
lib/state.cjs— adddetectProjectState()detectProjectState({ repoRoot?, githubMilestoneCount? })gh api)|local - G| <= 1) instead of live name-overlap API calltest/project-state-detection.test.js(new)fs.mkdtempSync()tmp dirs, file seeding helpers,afterAllcleanupseedProjectJson()test/fixtures/project-state/(new)aligned.json— 2 milestones, current_milestone=1 (not all done)diverged.json— 5 milestones, current_milestone=1 (count diff > 1 vs G=2)extend.json— 2 milestones, current_milestone=3 (all done)Vitest infrastructure (from PR chain #247–#252, included since not yet on main)
vitest.config.js,lib/mock-github.cjs,lib/mock-gsd-agent.cjstest/loadFixture.js,test/setup.jstest/checkpoint.test.js,test/pipeline-transitions.test.jstest/fixtures/github/(16 fixtures),test/fixtures/agents/(5 fixtures)package.json:testscript →vitest run, addedvitest ^2.1.9devDepTest Plan
npx vitest run test/project-state-detection.test.js→ 19 tests passnpx vitest run→ 83 total tests pass (19 + 28 pipeline-transitions + 36 checkpoint).planning/PROJECT.mdseeded, G=0 → stateClass === 'GSD-Only'detectProjectStateexported fromlib/state.cjsmodule.exports🤖 Generated with Claude Code