Problem
PR #64 (#63) added strong unit + fixture coverage:
- Go unit tests for
SessionState.UpdatedAt bump, stale reclaim, TTL boundary
- Shell fixture matrix for
devkit-guard.sh across command/prompt × hard/soft × fresh/stale (27 cases)
hooks_test.sh smoke suite (46 cases)
What's missing: a full end-to-end integration test that drives the real engine binary through the complete enforcement loop. Nothing currently verifies that devkit_start + devkit-guard.sh + devkit_advance compose correctly against the real session.json the engine writes.
Proposal
Add a test (Go or bash, TBD) that:
- Builds the
devkit-engine binary via go build ./src.
- Spawns it as an MCP server subprocess.
- Sends
devkit_start for a fixture workflow.
- Invokes
hooks/devkit-guard.sh with a synthetic Write-tool PreToolUse payload, asserts exit 2.
- Sends
devkit_advance.
- Invokes the guard again with the same payload, asserts exit 0 (step has progressed — whatever the new step allows).
- Completes the workflow and asserts session cleanup.
Acceptance criteria
- New test file
hooks/integration_test.sh or src/mcp/guard_integration_test.go.
- Runs in CI alongside existing hook-smoke-tests and build-and-test jobs.
- Covers at least: prompt+hard blocks Write → advance → next step allows Write OR workflow complete.
- Runs under ~30s so it doesn't slow CI meaningfully.
Also worth including
- Concurrency test: two concurrent
devkit_start calls against a stale session — assert only one wins (per the flock CAS in src/mcp/tools.go).
DEVKIT_SESSION_STALE_TTL_SECONDS env override exercise — set to 1 second, sleep 2, assert reclaim.
step_label fallback coverage — session missing current_index/total_steps, assert the veto message still names the workflow.
Context
Flagged by pr-test-analyzer during the PR #64 mega-review. Existing tests are strong at the unit level but nothing exercises the composed system. Medium priority — the individual pieces are well-tested, and this would catch wiring regressions.
Problem
PR #64 (#63) added strong unit + fixture coverage:
SessionState.UpdatedAtbump, stale reclaim, TTL boundarydevkit-guard.shacross command/prompt × hard/soft × fresh/stale (27 cases)hooks_test.shsmoke suite (46 cases)What's missing: a full end-to-end integration test that drives the real engine binary through the complete enforcement loop. Nothing currently verifies that
devkit_start+devkit-guard.sh+devkit_advancecompose correctly against the realsession.jsonthe engine writes.Proposal
Add a test (Go or bash, TBD) that:
devkit-enginebinary viago build ./src.devkit_startfor a fixture workflow.hooks/devkit-guard.shwith a syntheticWrite-tool PreToolUse payload, asserts exit 2.devkit_advance.Acceptance criteria
hooks/integration_test.shorsrc/mcp/guard_integration_test.go.Also worth including
devkit_startcalls against a stale session — assert only one wins (per the flock CAS insrc/mcp/tools.go).DEVKIT_SESSION_STALE_TTL_SECONDSenv override exercise — set to 1 second, sleep 2, assert reclaim.step_labelfallback coverage — session missingcurrent_index/total_steps, assert the veto message still names the workflow.Context
Flagged by pr-test-analyzer during the PR #64 mega-review. Existing tests are strong at the unit level but nothing exercises the composed system. Medium priority — the individual pieces are well-tested, and this would catch wiring regressions.