Repository navigation
feat: add headless uf gate command for constitution enforcement - #582
Conversation
|
🤖 Finished Review · ✅ Success · Started 2:49 PM UTC · Completed 3:12 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $7.96 |
|
Risk Assessment: moderate (2/5) DetailsLarge pure-addition PR (3160 lines, large blast radius) introducing a new gate command package with test coverage (ratio 0.13) and a well-scoped linked issue; signals unchanged from prior assessment, yielding a stable moderate composite of 1.86 (Tier1=2.13x0.50 + Tier2=1.43x0.30 + Tier3=1.83x0.20). Previous runRisk Assessment: moderate (2/5) DetailsLarge pure-addition PR (3056 lines, large blast radius) introducing a new gate command package with substantial test coverage and a well-scoped linked issue, yielding a moderate composite of 1.91 (Tier1=2.13x0.50 + Tier2=1.71x0.30 + Tier3=1.67x0.20). |
ReviewFindingsMedium
Low
Previous runReviewFindingsMedium
Low
Next steps:
Previous run (2)ReviewFindingsMedium
Low
Next steps:
|
marcusburghardt
left a comment
There was a problem hiding this comment.
Overall this is a well-structured feature that cleanly follows the established Options/Run/Format pattern with strong test coverage (93.4%). The main issue is the exit code semantic mismatch between the spec and implementation for validation errors — the fix is straightforward (validate phase/dir in runGate() before calling gate.Run(), matching the existing format-validation pattern).
This review was generated by /review-pr (AI-assisted).
Refactor runGate to return error (not (int, error)), matching all 17 other run* functions and design.md spec. Add InternalError type for exit code discrimination: validation errors exit 1, internal errors exit 2. Remove explicit stderr writes that caused Cobra double-printing. Move format validation to RunE boundary. Addresses PR unbound-force#582 review feedback from @marcusburghardt and @fullsend-ai-review. Assisted-by: claude-opus-4-6
Add init() to validate validPhases and phaseChecks stay in sync, preventing silent pass-through for missing phase handlers. Introduce artifactQuery struct to replace 5 positional string parameters in checkArtifactExists. Addresses PR unbound-force#582 review feedback from @marcusburghardt and @fullsend-ai-review. Assisted-by: claude-opus-4-6
|
🤖 Finished Review · ✅ Success · Started 3:32 PM UTC · Completed 3:52 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $7.11 |
Move InternalError wrapping into gate.Run() so that only true IO errors (filepath.Abs, EvalSymlinks, os.Stat) are wrapped as InternalError (exit 2). Validation errors (invalid phase, non-existent directory, path-is-file) return plain errors (exit 1) per design.md D1. Remove blind InternalError wrapping in runGate — gate.Run() now handles the distinction. Update 3 tests to expect exit code 1 for invalid phase, non-existent dir, and file-path scenarios. Addresses PR unbound-force#582 review feedback from @fullsend-ai-review[bot]. Assisted-by: claude-opus-4-6
|
🤖 Finished Review · ✅ Success · Started 1:21 PM UTC · Completed 1:45 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $8.02 |
Superseded by updated review
yvonnedevlinrh
left a comment
There was a problem hiding this comment.
Requesting changes
🟡 Review Council
Reviewed at commit 5cd51dd (standard effort).
TL;DR: Council approved the uf gate command PR with three medium and four low findings, but human reviewer is requesting the medium changes be remediated
Findings: 🔴 0 Critical, 🟠 0 High, 🟡 3 Medium, 🔵 4 Low
| Reviewer | Verdict | Findings |
|---|---|---|
| 🛡️ Adversary (code) | ✅ Approve | none |
| 📚 Curator (code) | ✅ Approve | 2 LOW |
| 🧭 Guard (code) | ✅ Approve | 1 MEDIUM |
| ⚙️ Operator (code) | ✅ Approve | none |
| 🧪 Tester (code) | ✅ Approve | 2 MEDIUM, 2 LOW |
🟡 MEDIUM (3)
-
🧭 FullSend harness wiring AC auto-closes with no follow-up tracking reference (
openspec/changes/uf-gate/design.md)- Wiring into FullSend harnesses (separate change)💡 Recommendation: Before merging, file a follow-up GitHub issue for 'Wire uf gate as validation_loop.script in FullSend harnesses (Inc3-5)' and add the issue number to design.md Non-Goals or tasks.md Section 8 (e.g., '(Tracked: #NNN)'). This ensures #514 can close with confidence that the deferred scope remains actionable.
Constraint: AGENTS.md Zero-waste: 'No orphaned specs, unused standards, or aspirational documents that do not map to actionable work.'💬 Full reviewer analysis
PR closes #514, whose acceptance criteria include '[ ] Wired as validation_loop.script on write-capable harnesses.' design.md Non-Goals defers this to a 'separate change' - a conscious and documented scope decision - but no follow-up issue number is cited in either design.md or tasks.md. Searched tasks.md Section 8 (Documentation tasks 8.1-8.3): task 8.3 records the documentation issue as '#583' but no equivalent task files or references a tracking issue for the FullSend wiring work. When #514 auto-closes on merge, the wiring work will be untracked, creating a zero-waste violation risk under AGENTS.md: aspirational work with no actionable issue.
-
🧪 TestCheckNotOnMain_NonGitDir skips git-availability guard present in all sibling tests (
internal/gate/gate_test.go:458)func TestCheckNotOnMain_NonGitDir(t *testing.T) { dir := t.TempDir() r := checkNotOnMain(dir) if r.Passed { t.Errorf("expected fail in non-git directory, got pass") } if !strings.Contains(r.Message, "git repository") { t.Errorf("expected message about git repository, got: %s", r.Message) } }💡 Recommendation: Add
if _, err := exec.LookPath("git"); err != nil { t.Skip("git not available") }at the top of TestCheckNotOnMain_NonGitDir, matching the pattern used by the three sibling tests.
Constraint: Tester: test isolation - git-absent environments must not cause false failures💬 Full reviewer analysis
All three other git-dependent tests in the same file (TestCheckNotOnMain_FeatureBranch, TestCheckNotOnMain_OnMain, TestCheckNotOnMain_DetachedHead) guard with exec.LookPath. This test has no such guard. In a git-absent CI environment, cmd.Output() fails and then exec.LookPath also fails, causing checkNotOnMain to return 'git is not available' which does NOT contain 'git repository', so the second assertion fails incorrectly rather than skipping. Pre-existing gap: no - all sibling tests handle this correctly. Consequence: spurious test failure in git-absent environments.
-
🧪 Cobra-level missing --phase flag guard is never tested (
cmd/unbound-force/gate_test.go:210)func TestNewGateCmd_InvalidFormat(t *testing.T) { cmd := newGateCmd() cmd.SetArgs([]string{"--phase", "specify", "--format", "xml"}) err := cmd.Execute()💡 Recommendation: Add TestNewGateCmd_MissingPhase that calls newGateCmd() with cmd.SetArgs([]string{}) (no --phase flag), executes it, and asserts error is non-nil and contains '--phase is required'.
Constraint: FR-002: gate command MUST reject missing --phase with non-zero exit code💬 Full reviewer analysis
The only Cobra-level test always supplies --phase. The guard
if phase == "" { return fmt.Errorf("--phase is required...") }in RunE is never reached by any test. Pre-existing gap: no - this is a new command. Covered elsewhere: no; TestRunGate_InvalidPhase exercises gate.Run with an invalid non-empty phase, which is a different code path. Consequence: a future refactor that introduces a default phase value would go undetected.
🔵 LOW (4)
-
📚 README internal package list does not include the new
gatepackage (README.md:68)**`internal/`** -- Business logic packages (scaffold, sandbox, gateway, config, doctor, setup, orchestration, schemas, artifacts, backlog, sync, coaching, dashboard, impediment, metrics, sprint)💡 Recommendation: Append
gateto the internal package list in README.md line 68. Can be done alongside the pending docs work tracked by issue #583. Not a merge blocker given the documentation issue was filed.
Constraint: AGENTS.md documentation gate: README.md updated for description changes💬 Full reviewer analysis
The README.md parenthetical listing of internal packages was not updated to include
gate. AGENTS.md was correctly updated (the diff adds the gate entry). The README omission is a minor cosmetic gap. A documentation issue (#583) was filed for user-facing usage docs. Searched README.md line 68 for "gate" and found only "gateway". -
🧪 TestRun_Provenance does not assert report.Branch (
internal/gate/gate_test.go:665)func TestRun_Provenance(t *testing.T) { dir := t.TempDir() scaffoldOpenSpec(t, dir, map[string]string{ "proposal.md": "# Proposal", })💡 Recommendation: Add assertion
if report.Branch != "" { t.Errorf("expected empty branch for non-git dir, got %s", report.Branch) }to TestRun_Provenance.💬 Full reviewer analysis
TestRun_Provenance verifies version, producer, timestamp, and phase but does not assert report.Branch. The temp dir is not a git repository so detectBranch returns empty. Low-priority gap since detectBranch is a best-effort function and its correctness is validated by TestCheckNotOnMain_* tests.
-
📚 CLI help text omits coverage strategy detection keywords promised in design.md (
cmd/unbound-force/gate.go:94)implement — spec + plan + tasks + coverage strategy exist💡 Recommendation: Expand the implement phase line or add a 'Coverage strategy detection' subsection to the Long help text that lists the accepted signal patterns, matching the keywords enumerated in design.md R4.
Constraint: design.md R4: "Mitigated by documenting the expected keywords in the command help text"💬 Full reviewer analysis
The implement phase description tells users that a 'coverage strategy' must exist, but does not explain what the checker recognises as evidence of one. design.md R4 calls this out explicitly and says the mitigation is to document the expected keywords in the help text. A user or CI author reading the help text has no way to know that the checker looks for a heading containing 'coverage', body text containing 'coverage target', 'unit test', 'integration test', or 'e2e test', or a line matching coverage.*%.
-
🧪 TestRunGate_InvalidFormat name does not match its actual assertion (
cmd/unbound-force/gate_test.go:112)func TestRunGate_InvalidFormat(t *testing.T) { dir := t.TempDir() var stdout, stderr bytes.Buffer // Note: format validation moved to RunE (Cobra level). // runGate now receives only validated formats, so passing // "xml" here falls through to the default text formatter💡 Recommendation: Rename to TestRunGate_UnrecognizedFormat_FallsToText and update the assertion to clearly document that unrecognized formats fall through to the text default at the runGate level.
💬 Full reviewer analysis
The test is named TestRunGate_InvalidFormat but tests check failure in an empty dir with format 'xml' silently falling to the text default. The name misleads future readers about coverage.
Produced by Review Council
Addresses PR unbound-force#582 review feedback from @fullsend-ai-review[bot]: os.Exit(2) inside the gate RunE closure was the only os.Exit in a RunE in the codebase and made the exit-code-2 path untestable through cobra's Execute(). Errors now propagate to main(), which maps *gate.InternalError to exit 2 via gateExitCode. A table-driven test covers the 0/1/2 mapping including the wrapped-error case. Behavior note: exit 2 now also emits cobra's usage text, consistent with exit 1. Signed-off-by: Yvonne Devlin <[email protected]> Assisted-by: Qwen3.8-27B-FP8
Addresses PR unbound-force#582 review feedback from @yvonnedevlinrh and @fullsend-ai-review[bot]: - Add TestNewGateCmd_MissingPhase: the RunE --phase-required guard (FR-002 missing-flag scenario, tasks.md 6.2) was unreachable from any test. - Rename TestRunGate_InvalidFormat to TestRunGate_UnrecognizedFormat_FallsToText and correct the comment: the test uses a valid phase with format 'xml' and verifies the text-formatter fall-through at the runGate level, not 'internal error wrapping for invalid phase scenarios'. Signed-off-by: Yvonne Devlin <[email protected]> Assisted-by: Qwen3.8-27B-FP8
Addresses PR unbound-force#582 review feedback from @yvonnedevlinrh: - TestCheckNotOnMain_NonGitDir now skips when git is unavailable, matching the three sibling checkNotOnMain tests. In git-absent environments the message assertion ('git repository') would otherwise fail spuriously against the 'git is not available' path. - TestRun_Provenance now asserts report.Branch is empty for a non-git directory, locking the best-effort provenance field (FR-003, Constitution III) against regressions. Signed-off-by: Yvonne Devlin <[email protected]> Assisted-by: Qwen3.8-27B-FP8
Refactor runGate to return error (not (int, error)), matching all 17 other run* functions and design.md spec. Add InternalError type for exit code discrimination: validation errors exit 1, internal errors exit 2. Remove explicit stderr writes that caused Cobra double-printing. Move format validation to RunE boundary. Addresses PR unbound-force#582 review feedback from @marcusburghardt and @fullsend-ai-review. Assisted-by: claude-opus-4-6
Add init() to validate validPhases and phaseChecks stay in sync, preventing silent pass-through for missing phase handlers. Introduce artifactQuery struct to replace 5 positional string parameters in checkArtifactExists. Addresses PR unbound-force#582 review feedback from @marcusburghardt and @fullsend-ai-review. Assisted-by: claude-opus-4-6
Move InternalError wrapping into gate.Run() so that only true IO errors (filepath.Abs, EvalSymlinks, os.Stat) are wrapped as InternalError (exit 2). Validation errors (invalid phase, non-existent directory, path-is-file) return plain errors (exit 1) per design.md D1. Remove blind InternalError wrapping in runGate — gate.Run() now handles the distinction. Update 3 tests to expect exit code 1 for invalid phase, non-existent dir, and file-path scenarios. Addresses PR unbound-force#582 review feedback from @fullsend-ai-review[bot]. Assisted-by: claude-opus-4-6
Addresses PR unbound-force#582 review feedback from @fullsend-ai-review[bot]: os.Exit(2) inside the gate RunE closure was the only os.Exit in a RunE in the codebase and made the exit-code-2 path untestable through cobra's Execute(). Errors now propagate to main(), which maps *gate.InternalError to exit 2 via gateExitCode. A table-driven test covers the 0/1/2 mapping including the wrapped-error case. Behavior note: exit 2 now also emits cobra's usage text, consistent with exit 1. Signed-off-by: Yvonne Devlin <[email protected]> Assisted-by: Qwen3.8-27B-FP8
Addresses PR unbound-force#582 review feedback from @yvonnedevlinrh and @fullsend-ai-review[bot]: - Add TestNewGateCmd_MissingPhase: the RunE --phase-required guard (FR-002 missing-flag scenario, tasks.md 6.2) was unreachable from any test. - Rename TestRunGate_InvalidFormat to TestRunGate_UnrecognizedFormat_FallsToText and correct the comment: the test uses a valid phase with format 'xml' and verifies the text-formatter fall-through at the runGate level, not 'internal error wrapping for invalid phase scenarios'. Signed-off-by: Yvonne Devlin <[email protected]> Assisted-by: Qwen3.8-27B-FP8
Addresses PR unbound-force#582 review feedback from @yvonnedevlinrh: - TestCheckNotOnMain_NonGitDir now skips when git is unavailable, matching the three sibling checkNotOnMain tests. In git-absent environments the message assertion ('git repository') would otherwise fail spuriously against the 'git is not available' path. - TestRun_Provenance now asserts report.Branch is empty for a non-git directory, locking the best-effort provenance field (FR-003, Constitution III) against regressions. Signed-off-by: Yvonne Devlin <[email protected]> Assisted-by: Qwen3.8-27B-FP8
Addresses PR unbound-force#582 review feedback from @yvonnedevlinrh: - Add a 'Coverage strategy detection' section to the gate help text listing the accepted signal patterns, per design.md R4 (the named mitigation for heuristic false negatives). - Add the new gate package to the README internal package list, matching the AGENTS.md entry added in this PR. Signed-off-by: Yvonne Devlin <[email protected]> Assisted-by: Qwen3.8-27B-FP8
- hasCoverageStrategy returns read errors instead of swallowing them; scanner.Err() is checked; checkCoverageStrategy reports the first read error in its failure message (CS-005/CS-006) - checkNotOnMain extracts git stderr via exec.ExitError for a descriptive message instead of the raw exec status (FR-008) - tasks-complete/review-run/review-pass messages name the resolved tasks file (multi-change ambiguity mitigation) - --help documents first-match alphabetical artifact resolution and clarifies exit code 1 includes invalid arguments - Options.Stderr comment corrected: reserved, not written by Run Addresses PR unbound-force#582 review council findings (round 1). Signed-off-by: Yvonne Devlin <[email protected]> Assisted-by: Qwen3.8-27B-FP8
- TestCheckCoverageStrategy_Heading/_Keyword fixtures isolated so each detection mode is the only possible pass condition - TestCheckNotOnMain_GitUnavailable covers FR-008 'Git not available' scenario via empty PATH (asserts uf doctor hint) - TestFormatJSON_ValidOutput asserts the full FR-003 contract: producer, RFC3339 timestamp, branch, summary, checks[] - TestRun_PRPhase_Pass asserts branch provenance, summary, and per-check results for the git fixture - TestRunGate_UnrecognizedFormat_FallsToText asserts exit code 1 and text-formatter stdout (TC-009) - TestRunGate_FormatFailure_ExitCode2 drives a real *gate.InternalError through runGate (failing writer, exit 2) - Non-existent-dir tests derive paths from t.TempDir() internal/gate statement coverage: 86% -> 90.7% (target >= 90%). Addresses PR unbound-force#582 review council findings (round 1). Signed-off-by: Yvonne Devlin <[email protected]> Assisted-by: Qwen3.8-27B-FP8
- cli-reference.md: new 'uf gate' section (flags, exit codes, examples) - usage.md: gate added to the CLI command list - architecture.md: command count seven -> eight - README.md: textutil added to internal package list - CHANGELOG.md: 'Fixes: unbound-force#514' -> 'Part of: unbound-force#514' (wiring AC deferred to a separate change; avoid auto-close) - tasks.md 7.1: restate coverage as measured 90.7% (target met) and note the CI ratchet is tracked separately Addresses PR unbound-force#582 review council findings (round 1). Signed-off-by: Yvonne Devlin <[email protected]> Assisted-by: Qwen3.8-27B-FP8
…und-force#514 - design.md Non-Goals: wiring deferral now references unbound-force#869 - proposal.md Impact: same tracking reference - CHANGELOG: 'Part of: unbound-force#514' -> 'Closes: unbound-force#514' — the remaining harness-wiring AC is carved out into follow-up unbound-force#869, so this PR completes the story as scoped Addresses PR unbound-force#582 review findings C-M1/B-3 (last pending items). Signed-off-by: Yvonne Devlin <[email protected]> Assisted-by: Qwen3.8-27B-FP8
- coverage-gate.json: register internal/gate in the helper scope (80%) -- the manifest requires every new package under internal/ to be classified; gate performs filesystem I/O health scanning, same class as internal/doctor. No threshold changed. - manifest.go: update the helper-scope package list in the doc comment - gate_test.go: TestNewGateCmd_Execute (happy path through RunE with JSON output) and TestNewGateCmd_Execute_DefaultDir (t.Chdir fixture, default --dir resolving via Getwd) cmd/unbound-force changed-scope coverage: 79.70% -> 81.19% (80% helper threshold); internal/gate: 90.73%. Fixes CI 'Enforce Scope Coverage Gate' failure on PR unbound-force#582. Signed-off-by: Yvonne Devlin <[email protected]> Assisted-by: Qwen3.8-27B-FP8
- Resolve artifacts branch-aware (opsx/<name>, NNN-<name>) so an unrelated change cannot mask a missing artifact for the active change; first alphabetical match only on unmapped branches - Propagate FormatText write errors; add text-mode exit-2 test - Map exit codes through a generic exitCoder interface in main instead of naming *gate.InternalError - Silence usage on the gate error path so stdout stays parseable - Add fixtures: symlinked target dir, concurrent changes (both layouts), unreadable artifacts, RFC3339 timestamp, InternalError contract - Harden initGitRepo against ambient git config - Correct tasks.md coverage claim to the enforced 80% floor
Signed-off-by: Yvonne Devlin <[email protected]>
Signed-off-by: Yvonne Devlin <[email protected]>
Consolidate the branch-to-change mapping into resolveChange, shared by checkArtifactExists, findTasksFile, and coverageArtifacts, and extend it with quick/<name> branches: the quick tier carries no spec artifacts, so unrelated changes must not satisfy its checks (design R1 updated). - Match indented subtask checkboxes in checkTasksComplete so nested incomplete tasks cannot false-pass - Bound git subprocesses with a 10s timeout (detectBranch, detectCommit, checkNotOnMain) - Add GoDoc for (*InternalError).Error and Unwrap - Align FR references with the GATE-FR spec ids - Record exit code 2 in proposal.md's capability summary and website#343 in tasks.md 8.3 - Tests: quick-branch strictness, indented subtask, --help (GATE-FR-001), invalid-format stderr routing (GATE-FR-003), git-ceiling hermeticity for fallback fixtures Addresses PR unbound-force#582 review council findings (round 2). Assisted-by: opencode (glm-5-3) Signed-off-by: Yvonne Devlin <[email protected]>
Address the verified review-council findings on PR unbound-force#582: - exitCode: a bare *exec.ExitError satisfies exitCoder structurally, leaking child process exit codes (uf sandbox attach, %w-wrapped podman errors) into the CLI's documented 0/1/2 contract. Exempt it explicitly; explicitly coded errors (gate.InternalError, including when it wraps an exec error) keep their own code. Regression cases pin the mapping. - resolveChange: recover the branch from GITHUB_HEAD_REF or GITHUB_REF_NAME when git reports a detached HEAD, so headless CI runs keep strict branch-keyed resolution instead of degrading to the alphabetical fallback. The env refs are consulted only on the detached sentinel, so non-git fixtures stay hermetic. - Resolve the change once per run and thread it through the checks via runContext: one branch snapshot for all checks (no mid-run resolution race), two git spawns per implement run (was six), and report.Branch always matches the resolution the checks used. - Spec delta: add GATE-FR-012 (branch-aware artifact resolution) with scenarios for strict mapped changes, quick always-fail, CI ref recovery, and alphabetical fallback; amend GATE-FR-011 and design D2/R1 to match the run-context signature and CI recovery. - CLI help text documents all three resolution modes plus the detached-HEAD CI recovery. - Tests: Speckit branch-mapped coverage-strategy coverage, a Run-level multi-change implement test, positive FormatText provenance, exit-2 stderr stream separation, and scenario-suffixed contract test names. - Options.Format/Stdout doc comments now state they are reserved (design D7) instead of promising behavior Run does not deliver. Addresses PR unbound-force#582 review council findings (round 3). Assisted-by: opencode (glm-5-3) Signed-off-by: Yvonne Devlin <[email protected]>
Close the round-4 council advisories left by the round-3 remediation's incomplete artifact sweep: - Requirement allocation header now records that this delta owns GATE-FR-001 through GATE-FR-012 (it previously reserved the very id the delta defines), with GATE-FR-013 through GATE-FR-099 reserved for future gate-command changes - Task 2.1 restates the amended check-function signature func(ctx runContext) CheckResult (GATE-FR-011) instead of the superseded func(dir string) contract - proposal.md New Capabilities documents branch-aware artifact resolution (GATE-FR-012): strict branch-mapped changes, quick always-fail, detached-HEAD CI ref recovery, and the alphabetical fallback - reviewMarkers is built from codeReviewMarker so the code-review-passed marker has a single definition The blog-threshold advisory was closed by labeling unbound-force/website#343 with `blog`. Addresses PR unbound-force#582 review council findings (round 4). Assisted-by: opencode (glm-5-3) Signed-off-by: Yvonne Devlin <[email protected]>
The review council flagged that four learnings committed with this PR assert present-tense defects the merged head already resolves, with no terminal record of the resolution, so Dewey temporal resolution surfaces the broken intermediate states as current: - go-stdlib-gotchas-20261102T172523: claims globFirst (internal/gate/checks.go:101) discards the Glob error channel — the head has no globFirst; firstArtifactFile uses os.ReadDir and propagates discovery failures as InternalError (exit 2), pinned by TestRunGate_ArtifactReadFailure_ExitCode2 - governance-gates-20261102T150915-yvonne-devlin-2 and test-quality-20261102T165035: claim checkCoverageStrategy scans unrelated changes via an unrestricted glob — the head's coverageArtifacts is branch-aware, pinned by the multi-change regression tests - exit-code-contracts-20261102T172525: claims unreadable artifacts classify as exit-1 check failures and that proposal.md lists only exit codes 0 and 1 — the head wraps environmental failures as InternalError (exit 2) and the proposal's capability summary lists 0/1/2 The other ten learnings are accurate as committed and untouched. Addresses PR unbound-force#582 review council findings (round 5). Assisted-by: opencode (glm-5-3) Signed-off-by: Yvonne Devlin <[email protected]>
…dation GATE-FR-009 listed 'invalid arguments beyond phase/format validation' as an exit-2 internal-error example, but GATE-FR-010 mandates exit code 1 for --dir validation failures and FR-009's own stderr clause classes non-existent directory as a validation error. The example clause survived the round-3 spec reconciliation (736c855) which fixed the proposal-level summary. Review-council round 8 finding (guard, MEDIUM spec-consistency, run d527f36e). Assisted-by: enmaas/rits/zai-org/glm-5-3
checkNotOnMain re-executed 'git rev-parse --abbrev-ref HEAD' in its own subprocess instead of consuming ctx.res.Branch — the branch resolveChange already resolved once per run, including the GITHUB_HEAD_REF/GITHUB_REF_NAME recovery for detached CI checkouts. In a detached CI context the check only ever saw the literal HEAD, so a recovered ref of main still passed the branch-protection check and the report provenance contradicted the check message (design D2, GATE-FR-012). - checkNotOnMain now consumes the run-context resolution; branch detection failures travel on changeResolution.BranchErr with the detailed message (git unavailable, timeout, non-repo) - shared execGit/gitError helpers replace the three duplicated bounded-timeout git invocations (detectBranch, detectCommit, checkNotOnMain) - ciBranchRef validates CI-provided refs (Constitution V): traversal, absolute paths, backslashes, and empty components are rejected before reaching artifact path construction - hasCoverageStrategy reads the artifact whole, matching sibling checks: a >64KiB line is check input, not an exit-2 internal error - the CLI no longer pre-resolves the --dir default; gate.Run owns it so a Getwd failure is exit 2 on every path (FR-009) Tests: pin GIT_CEILING_DIRECTORIES in the empty-fixture tests that reached resolveChange unpinned; assert the raw JSON wire keys (round-trips cannot catch json-tag drift); cover the quick and detached-CI resolution modes through Run() itself; pin GITHUB_HEAD_REF-over-GITHUB_REF_NAME precedence and the merge-ref fallback; regression-test not-on-main failing on a recovered main ref; assert the invalid-phase error lists valid phases. Review-council round 8 findings (adversary MEDIUM state- consistency + 4 LOW, architect LOW dry, testing 3 MEDIUM + 2 LOW; run ids 77a9cead, e20429f1, 4c18a2dd). Assisted-by: enmaas/rits/zai-org/glm-5-3
…egrity ceiling - design.md D4: example JSON now includes the commit and tool_version fields GATE-FR-003 mandates and the implementation emits (a parser built from the old example alone would miss two fields) - design.md D5: update the checkNotOnMain sketch to the run-context signature and document that a CI-recovered main ref fails the check - design.md R5 (new): document the review-marker integrity ceiling — presence-of-text evidence is only as strong as write access to tasks.md — with the dispatch-record binding as the follow-up direction - proposal.md: add the Principle VI (Deterministic Execution) assessment added by the v1.4.0 constitution amendment while this change was in review - docs/cli-reference.md: document branch-aware artifact resolution and coverage strategy detection keywords for the uf gate section, matching the command's own help text Review-council round 8 findings (curator LOW, guard 2 LOW; run ids 4ff52e9d, d527f36e). Blog-opportunity finding declined by maintainer (tracked via blog label on website#343). Assisted-by: enmaas/rits/zai-org/glm-5-3
c47e878 to
f1ea4aa
Compare
Completes b9e096a, which recorded the node engines floor in .opencode/package-lock.json but missed its scaffold mirror, so main's Local CI fails at tip on TestEmbeddedAssets_MatchSource drift (and TestPluginPackageInputs_MirrorsMatchCanonical, TestSCFR001, TestSCFR003). The mirror sync is the fix the drift test itself prescribes; no dependency pins change. Also unblocks PR unbound-force#582, whose required checks run against the drifted base. Assisted-by: enmaas/rits/zai-org/glm-5-3
Validator-review round on PR unbound-force#582 (head f1ea4aa) confirmed five findings with reproduced counterexamples; all are closed here. - resolveChange resolves one first-alphabetical change directory per run on unmapped branches (firstChangeDir: openspec/changes then specs, following symlinked change directories), so a phase can no longer pass by combining spec/tasks from one change with plan/coverage from another (GATE-FR-012). The per-file first-match fallback is deleted; checkArtifactExists, coverageArtifacts, and findTasksFile probe the single resolved change, removing the triplicated mode dispatch. Discovery failures travel on changeResolution.ResolveErr and exit 2. - validCIRef rejects control characters: a crafted GITHUB_HEAD_REF could render spoofed PASS lines in text output (Constitution V). - hasCoverageStrategy excludes negated headings such as "No coverage strategy" from the heading signal (GATE-FR-006). - checkTasksComplete ignores examples inside fenced code blocks (GATE-FR-007). - Run matches the EvalSymlinks not-exist sentinel with errors.Is, consistent with the rest of the package. - Assertion depth: invalid-format errors pin the text/json list, help output pins the coverage keywords, non-existent-dir errors pin the documented message, and newRootCmd() is extracted from main() so TestRootCmd_RegistersGate pins the FR-001 registration. - FR-006/007/012 amended with scenarios; design R1/R4, tasks 2.1, help text, and cli-reference restated to match; tasks.md 7.1 records the measured 92.7% internal/gate coverage. Validation: race suite green for internal/gate and cmd/unbound-force; golangci-lint 0 issues; scope coverage gate PASS; the five adversarial fixtures re-run with the fixed outcomes. Assisted-by: enmaas/rits/zai-org/glm-5-3 Signed-off-by: Yvonne Devlin <[email protected]>
Council review round on PR unbound-force#582 at head 1d75368 (runs af5b6744, 89b1004a, 4a697431, 6c7b9298, 4a9542e7): - hasCoverageStrategy skips fenced code blocks and excludes negated body text ("No unit tests are planned") and measured zero-percent lines ("current coverage: 0%") from the keyword and percentage signals: fenced coverage syntax is documentation, not strategy (GATE-FR-006) - fenceTracker implements CommonMark fence matching for both scanners: a fence closes only on its own marker character, at least as long as the opening fence, so a mixed-marker line inside an open fence is content and cannot mask later task lines (GATE-FR-007) - coverage-strategy and the tasks-consuming checks emit the quick-branch and no-change explanations the artifact-existence checks already carry, so by-design failures read as tier limitations rather than missing artifacts - docs: cli-reference documents the review-marker trust boundary (design R5) and the coverage exclusions; QUICKSTART notes markers are presence-of-text evidence; tasks.md 8.3 states website#343's role (website CLI-reference update, labeled docs and blog) - tests: git fixtures skip under -short (TC-011); TestRunGate_JSONOutput pins the CLI provenance wiring (Producer, ToolVersion, RFC3339 Timestamp); new regression tests for mixed-marker fences, fenced/negated/zero-percent coverage signals, fenceLine classification, and quick-branch messages; GATE-FR-006/007 amended with the new scenarios and design R4 restated to match internal/gate coverage 92.9%, cmd/unbound-force 84.4%; scope coverage gate PASS; golangci-lint 0 issues; adversarial fixtures re-run against the fixed binary (fenced heading, negated body, zero percent, mixed-marker fence fail; positive coverage control passes). Assisted-by: enmaas/rits/zai-org/glm-5-3 Signed-off-by: Yvonne Devlin <[email protected]>
… precedence - Extract the resolutionFailure helper: the quick-branch and no-change guards duplicated across checkArtifactExists, checkCoverageStrategy, and loadTasksFile collapse to one shared definition (check messages unchanged) - Unexport CheckFunc: runContext is unexported, so the exported alias was unconstructable outside internal/gate - QUICKSTART: the marker-trust caveat now covers the review and pr phases (checkReviewPass shares the marker-presence model) - GATE-FR-012: document the fallback's layout priority (openspec/changes/ first, then specs/ only when that layout holds no change directory) in the requirement bullet, a new scenario, design R1, and cli-reference; pinned by TestCheckSpecExists_UnmappedFallback_PrefersOpenSpecLayout Addresses PR unbound-force#582 review council findings at head 23465bb: architect dry MEDIUM + api-design LOW, curator documentation-accuracy LOW, guard spec-alignment LOW. The Options Format/Stdout/Stderr finding remains tracked in unbound-force#924. Assisted-by: enmaas/rits/zai-org/glm-5-3 Signed-off-by: Yvonne Devlin <[email protected]>
Summary
Adds
uf gate --phase <specify|plan|implement|review|pr> --format json— a headless, machine-readable CLI command that enforces constitution compliance checks at each workflow phase. The command exits non-zero when checks fail, making it usable as avalidation_loop.scriptfor FullSend harnesses (Inc3-5) and as a local pre-commit/pre-PR hook.Key capabilities:
openspec/changes/*/) and Speckit (specs/*/) artifact detectioninternal/doctor/package pattern (Options/Run/Format withio.Writerinjection)Closes #514
How to Test
How to Demo
go run ./cmd/unbound-force gate --phase specify— observe text output showing spec-exists check passinggo run ./cmd/unbound-force gate --phase specify --format json— observe structured JSON with provenance fieldsgo run ./cmd/unbound-force gate --phase implement— observe multiple checks, some failing (no coverage strategy in root)go run ./cmd/unbound-force gate --phase pr— observe branch and review checksKey Files Changed
New package:
internal/gate/models.go— CheckResult, Summary, GateReport structs with provenancechecks.go— 8 check functions + phase registry + checkArtifactExists helpergate.go— Options struct with DI, Run() with path canonicalizationformat.go— FormatJSON and FormatText (lipgloss) output formattersgate_test.go— 1118 lines of tests (93.4% coverage)CLI wiring:
cmd/unbound-force/gate.go— cobra command with --phase, --format, --dir flagsgate_test.go— CLI integration tests for all exit codesmain.go— single line:root.AddCommand(newGateCmd())OpenSpec artifacts:
openspec/changes/uf-gate/proposal.md— motivation, capabilities, constitution alignmentdesign.md— 7 design decisions (D1-D7), 4 risksspecs/gate-command.md— 11 FRs with Given/When/Then scenariostasks.md— 8 task groups, spec-review and code-review passedThis PR was generated by /uf.finale (AI-assisted).