feat(#275): Compound phase merged-PR guard and docs-only diff validation#
Problem#
The compound phase was running before the task's PR was merged, and could produce artefacts that included src/ or test/ files — both are incorrect behaviors that needed runtime enforcement.
Task / Link#
Closes #275
Changes#
GitHubService.isPrMerged— new method that returnstruewhen a PR is merged,falseon 404 or open PRPhaseRouterServicepre-compound guard — blocks compound withBLOCKED:PERSISTENTiftask.prNumberis null;BLOCKED:TRANSIENTif PR is not yet mergedPhaseRouterServicepost-compound diff validation — after compound COMPLETE, checksgit diffinREPO_ROOTforsrc/ortest/files; retries once withCOMPOUND_DOCS_ONLY=1; signalsBLOCKED:PERSISTENTon second violationInternalAdapterService.advanceAndEnqueue— fail-fast guard that blocks compound enqueue whentask.prNumberis null (complementary to the runtime check above)
Notes#
- Diff check fails open (returns
false) whenREPO_ROOTis unset orgit differrors — pipeline continues rather than false-blocking COMPOUND_DOCS_ONLYenv var is passed to the compound skill on retry; the skill must respect it to avoid another violation- The
InternalAdapterServiceguard is a fail-fast optimization; thePhaseRouterServiceguard is the authoritative check
Testing#
- Unit tests added for all acceptance criteria:
isPrMerged(merged/open/404), compound guard (null prNumber, unmerged PR, merged PR), diff validation (clean, first violation retry, second violation block), andadvanceAndEnqueuecompound guard (null prNumber blocked, prNumber set proceeds) npm run test: 705/705 passingnpm run lint: 0 errors