Skip to content

v0.6.0 — Test Infrastructure & CI Hardening

Latest

Choose a tag to compare

@snipcodeit snipcodeit released this 06 Mar 12:05

What's New

This release ships the complete test infrastructure for MGW and fixes CI to run cleanly on Node 18 and 20.

Testing Framework

MGW now has a full test suite (173 tests across 6 files) backed by purpose-built mock layers:

  • lib/mock-github.cjs — GitHub API interceptor that routes gh CLI calls to local JSON fixtures, enabling offline pipeline tests without hitting the GitHub API
  • lib/mock-gsd-agent.cjs — Fake Task() agent stubs that return fixture-driven outputs for planner, executor, verifier, and comment classifier agents
  • lib/mock-gsd-agent.cjs + lib/mock-github.cjs — Both mocks activate via setup.js and deactivate cleanly after each test, giving tests full control over pipeline behavior

Test Coverage

Test File Tests What It Covers
checkpoint.test.js 36 Checkpoint read/write, merge strategy, resume detection
validate-and-load.test.js 23 State file lifecycle, staleness detection, schema migration
pipeline-transitions.test.js 28 Stage transition rules, hook firing, failed-issue recovery
project-state-detection.test.js 19 All six mgw:project STATE_CLASS routing paths
milestone-execution.test.js 39 Dependency ordering, blocked-issue detection, abort/skip/retry
sync-drift.test.js 28 Drift detection, auto-sync, comment delta, label drift

CI/CD

  • Added test.yml workflow — runs npm test on Node 18 and 20 matrix on every push and PR
  • Added test:coverage step (Node 20 only) with 70% line threshold and artifact upload
  • Fixed ESM config loading failure on Node 18: renamed vitest.config.jsvitest.config.mjs
  • Resolved all 64 ESLint errors across lib/ and test/ files (unused vars, missing error causes, useless assignments, missing Node globals for ESM test files)

Bug Fixes

  • lib/retry-policy.cjs: Fixed abort listener leak in backoff Promise — the resolve reassignment pattern didn't work because setTimeout captured the original reference; restructured to properly remove the listener when the timer fires
  • lib/state.cjs: Added { cause: err } to re-thrown errors for better stack traces in pipeline failures
  • lib/diagnostic-hooks.cjs: Removed unused path/fs requires

173 tests passing. Lint clean. CI green on Node 18 and 20.

What's Changed

  • feat: add lib/mock-github.cjs with GitHub API interceptors for tests by @snipcodeit in #258
  • feat: add lib/mock-gsd-agent.cjs with fake Task() agent stubs by @snipcodeit in #259
  • feat: add vitest test runner with fixture loader and mock activation by @snipcodeit in #260
  • test: integration tests for validate_and_load and state lifecycle by @snipcodeit in #261
  • test: checkpoint read/write and resume detection tests by @snipcodeit in #262
  • test(pipeline): add pipeline stage transition tests for mgw:run by @snipcodeit in #263
  • test(project): add scenario tests for all six mgw:project STATE_CLASS paths by @snipcodeit in #264
  • test: add milestone execution scenario tests by @snipcodeit in #265
  • test(sync): add scenario tests for mgw:sync drift detection and auto-sync by @snipcodeit in #266
  • ci: add test.yml workflow for Node 18 and 20 matrix by @snipcodeit in #267
  • ci(coverage): add vitest v8 coverage with 70% line threshold by @snipcodeit in #268

Full Changelog: v0.5.1...v0.6.0