feat: add lib/mock-gsd-agent.cjs with fake Task() agent stubs#259
Merged
snipcodeit merged 1 commit intomainfrom Mar 6, 2026
Merged
Conversation
Implements a fake GSD agent runner for offline MGW pipeline testing. The module intercepts Task() spawns, returns configurable fixture outputs, and records spawn calls for assertion. - lib/mock-gsd-agent.cjs: core mock module with activate/deactivate/ spawnStub/getCallLog/setResponse/isActive/getSpawnCount/assertSpawned API - test/fixtures/agents/: base fixture files for all 5 agent types (gsd-planner, gsd-executor, gsd-verifier, gsd-plan-checker, general-purpose) API mirrors lib/mock-github.cjs (PR #258) for consistency: - Same activate/deactivate/setResponse/getCallLog/isActive pattern - Scenario support: test/fixtures/agents/<scenario>/ overrides base fixtures - Inline overrides have highest precedence Closes #248 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 task
snipcodeit
pushed a commit
that referenced
this pull request
Mar 6, 2026
Configures vitest as the primary test runner for the v6 Local Testing & Simulation Framework (Phase 47: Mock Infrastructure, issue #249). Changes: - package.json: add vitest ^2.0.0 devDependency; npm test → vitest run; npm run test:watch → vitest; npm run test:node preserves existing node --test runner for .test.cjs files - vitest.config.js: node environment, setupFiles: ['./test/setup.js'], includes .test.js/.spec.js, excludes .test.cjs (node:test incompatible) - test/setup.js: auto-activates mock-github and mock-gsd-agent in beforeEach/afterEach; conditional require — works when PRs #258/#259 are not yet merged to main; exports mockGitHub/mockGsdAgent - test/loadFixture.js: loadFixture(name) helper that reads from test/fixtures/; supports namespaced paths (e.g. 'github/issue-view'); throws descriptive errors on missing/invalid fixtures Closes #249 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Mar 6, 2026
snipcodeit
added a commit
that referenced
this pull request
Mar 6, 2026
…260) Configures vitest as the primary test runner for the v6 Local Testing & Simulation Framework (Phase 47: Mock Infrastructure, issue #249). Changes: - package.json: add vitest ^2.0.0 devDependency; npm test → vitest run; npm run test:watch → vitest; npm run test:node preserves existing node --test runner for .test.cjs files - vitest.config.js: node environment, setupFiles: ['./test/setup.js'], includes .test.js/.spec.js, excludes .test.cjs (node:test incompatible) - test/setup.js: auto-activates mock-github and mock-gsd-agent in beforeEach/afterEach; conditional require — works when PRs #258/#259 are not yet merged to main; exports mockGitHub/mockGsdAgent - test/loadFixture.js: loadFixture(name) helper that reads from test/fixtures/; supports namespaced paths (e.g. 'github/issue-view'); throws descriptive errors on missing/invalid fixtures Closes #249 Co-authored-by: Stephen Miller <Stephen@betterbox.pw> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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
lib/mock-gsd-agent.cjs— a fake GSD agent runner for offline MGW pipeline teststest/fixtures/agents/with 5 base fixture files (one per agent type)lib/mock-github.cjsAPI (PR feat: add lib/mock-github.cjs with GitHub API interceptors for tests #258) for consistency: activate/deactivate/getCallLog/setResponse/isActive patternCloses #248
Milestone Context
plan-phaselib/mock-github.cjs) — PR #258Changes
lib/mock-gsd-agent.cjs(new)Core mock module that intercepts Task() spawns in tests.
API:
activate([scenario])— activate with optional scenario override directorydeactivate()— restore state, preserve call logspawnStub({ subagent_type, prompt, model, description })— record spawn, return fixture outputgetCallLog()— returns{ subagent_type, prompt, model, description, output, timestamp }[]clearCallLog()— reset call log without deactivatingsetResponse(agentType, output)— inline override (highest precedence)isActive()— guard checkgetSpawnCount([agentType])— total or filtered spawn countassertSpawned(agentType)— throws AssertionError if agent type was not spawnedFixture resolution order:
setResponse())test/fixtures/agents/<scenario>/<agent-type>.jsontest/fixtures/agents/<agent-type>.jsontest/fixtures/agents/(new)Base fixture files for all 5 standard GSD agent types:
gsd-planner.json## PLANNING COMPLETEresponsegsd-executor.json## EXECUTION COMPLETEresponsegsd-verifier.json## VERIFICATION PASSEDresponsegsd-plan-checker.json## VERIFICATION PASSEDresponsegeneral-purpose.jsonTest Plan
lib/mock-gsd-agent.cjsrequires without error:node -e "require('./lib/mock-gsd-agent.cjs')"test/fixtures/agents/has exactly 5 JSON filesspawnStub()records call with correct shapesetResponse()inline override: overrides scenario and base fixturesactivate()resets call log and inline overridesdeactivate()preserves call loggetSpawnCount()returns total;getSpawnCount('gsd-planner')returns filtered countassertSpawned('gsd-planner')passes after spawn; throws for unspawned typespawnStub()throws with descriptive error beforeactivate()Smoke test run: 26/26 tests passed.
🤖 Generated with Claude Code