Skip to content

test: add milestone execution scenario tests#265

Merged
snipcodeit merged 2 commits intomainfrom
issue/254-write-scenario-tests-for-mgw-milestone-e
Mar 6, 2026
Merged

test: add milestone execution scenario tests#265
snipcodeit merged 2 commits intomainfrom
issue/254-write-scenario-tests-for-mgw-milestone-e

Conversation

@snipcodeit
Copy link
Owner

Summary

  • Adds test/milestone-execution.test.js with 39 tests covering 6 milestone orchestration scenarios
  • Tests the execution loop logic from commands/milestone.md using mock agents and mock GitHub API
  • Provides fixture test/fixtures/project-state/milestone-execution.json with a 4-issue dependency graph and test/fixtures/github/rate-limit-low.json for rate limit scenarios

Closes #254

Milestone Context

  • Milestone: v6 — Local Testing & Simulation Framework
  • Phase: Phase 49: Command Scenario Tests
  • Issue: Phase 3 of 4 in milestone

Changes

test/

  • test/milestone-execution.test.js — 39 vitest tests across 6 describe blocks
  • test/fixtures/project-state/milestone-execution.json — 4-issue project fixture (101←102←103 chain, 104 standalone; v1 linked, v2 unlinked)
  • test/fixtures/github/rate-limit-low.json — Rate limit fixture with remaining: 50

Scenario Coverage

# Scenario Tests
1 Dependency-ordered execution (topologicalSort) 5
2 Failed issue → Retry (resetRetryState, canRetry) 6
3 Failed issue → Skip (blocked dependents) 4
4 Failed issue → Abort (stops loop) 4
5 Rate limit guard (REMAINING < ESTIMATED_CALLS) 6
6 Next-milestone GSD linkage (linked vs unlinked) 6
Fixture integrity + mock setup 8
Total 39

Test Plan

  • npx vitest run test/milestone-execution.test.js — 39/39 tests pass
  • All 6 scenarios from issue body covered
  • mock-github.cjs and mock-gsd-agent.cjs used (from dependency PR test(project): add scenario tests for all six mgw:project STATE_CLASS paths #264)
  • No live GitHub tokens or Claude API calls required
  • process.cwd override isolation — no cross-test leakage
  • module cache eviction for fresh state/retry loads per describe block
  • Fixtures are valid JSON and consistent with topologicalSort input format

Stephen Miller and others added 2 commits March 6, 2026 04:21
… 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]>
Adds test/milestone-execution.test.js with 39 tests covering 6 scenarios:
- Dependency-ordered execution via topologicalSort (5 tests)
- Failed issue → Retry via resetRetryState/canRetry (6 tests)
- Failed issue → Skip (blocked dependents tracking) (4 tests)
- Failed issue → Abort (stops loop) (4 tests)
- Rate limit guard (REMAINING < ESTIMATED_CALLS caps MAX_ISSUES) (6 tests)
- Next-milestone GSD linkage check (linked vs unlinked) (6 tests)
- Fixture integrity and mock setup validation (8 tests)

Also adds:
- test/fixtures/project-state/milestone-execution.json (4-issue dependency graph)
- test/fixtures/github/rate-limit-low.json (remaining: 50 for rate limit tests)

Co-Authored-By: Stephen Miller <[email protected]>
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@github-actions github-actions bot added the core Changes to core library label Mar 6, 2026
snipcodeit pushed a commit that referenced this pull request 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]>
@snipcodeit snipcodeit merged commit dcdf2ed into main Mar 6, 2026
4 of 5 checks passed
@snipcodeit snipcodeit deleted the issue/254-write-scenario-tests-for-mgw-milestone-e branch March 6, 2026 11:22
snipcodeit pushed a commit that referenced this pull request 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]>
snipcodeit added a commit that referenced this pull request Mar 6, 2026
…sync (#266)

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: Stephen Miller <[email protected]>
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Changes to core library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Write scenario tests for mgw:milestone execution loop and failed-issue recovery

1 participant