Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/reference/FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ GENERATED , do not hand-edit. Regenerate: `bash lib/registry/feature-registry.sh
| `/kit:design` | `[H/I]` | Opt-in interactive solution-design beat between /think and /spec. Use when the operator wants to shape HOW to build after the idea passed /… | SPEC-003, SPEC-004, SPEC-005 +162 | test-anomalies-advisor.sh, test-board-mirror-cleanup.sh, test-ceremony-fits-diff.sh +40 |
| `/kit:devs-team` | `[H/I]` | Parallel multi-lens critique of a solution design (the active spec if present, else the decision brief). Dispatches 5 engineering lenses, m… | SPEC-016, SPEC-018, SPEC-019 +14 | test-gate-vocab-recording.sh, test-meta-review-verifiers.sh, test-meta-spec-depth.sh +1 |
| `/kit:dispatch` | `[H/I]` | Fire several disjoint VALIDATED specs concurrently, each in its own worktree, then converge. Cross-goal fan-out behind a disjointness gate … | SPEC-002, SPEC-016, SPEC-017 +114 | test-advisor.sh, test-agent-effectiveness.sh, test-attempt-state-race.sh +52 |
| `/kit:docs` | `[H/I]` | Update all project documentation to match the current codebase. Cross-references the diff against every doc file and fixes drift. | SPEC-001, SPEC-002, SPEC-003 +292 | conform.sh, test-active-spec-pick.sh, test-adapters.sh +161 |
| `/kit:docs` | `[H/I]` | Update all project documentation to match the current codebase. Cross-references the diff against every doc file and fixes drift. | SPEC-001, SPEC-002, SPEC-003 +292 | conform.sh, test-active-spec-pick.sh, test-adapters.sh +162 |
| `/kit:draft-agent` | `[H/I]` | Meta-agent agent-builder. From a one-line description, generates a new subagent definition OR a mega-goal sub-goal file and (by default) in… | SPEC-089, SPEC-108, SPEC-139 +1 | test-agent-effectiveness.sh, test-command-emit-sweep.sh, test-meta-agent.sh +1 |
| `/kit:execute` | `[H/I]` | Whole-spec execution with verification. Dispatches one builder for the whole spec, verifies every task's criteria once at the end, retries … | SPEC-001, SPEC-003, SPEC-004 +82 | test-board-work.sh, test-break-it.sh, test-config-registry.sh +29 |
| `/kit:explain` | `[H/I]` | Turn a merged change into a literate-diff explainer a human READS to understand: background -> goal + intuition -> a prose-ordered diff -> … | SPEC-050, SPEC-060, SPEC-094 +25 | test-boundary-lint.sh, test-clean-room.sh, test-command-emit-sweep.sh +13 |
Expand All @@ -40,8 +40,8 @@ GENERATED , do not hand-edit. Regenerate: `bash lib/registry/feature-registry.sh
| `/kit:review` | `[H/I]` | Paranoid code review. Security, architecture, regressions, missing tests, edge cases. Produces actionable TODOS. | SPEC-001, SPEC-002, SPEC-003 +155 | smoke.sh, test-adopt.sh, test-advisor.sh +90 |
| `/kit:ship` | `[H/I]` | Ship: review gate, tests, version bump, changelog, conventional commit, docs update, PR. Complete pipeline from done to merged. | SPEC-001, SPEC-002, SPEC-003 +111 | test-active-spec-pick.sh, test-adopt.sh, test-board-mirror.sh +64 |
| `/kit:spec-validate` | `[H/I]` | Adversarial review of a spec before implementation. 7 specialist lenses attack the spec from different angles (6 advisory, 1 blocking on th… | SPEC-002, SPEC-003, SPEC-004 +70 | test-command-emit-sweep.sh, test-design-record.sh, test-every-step-review.sh +10 |
| `/kit:spec` | `[H/I]` | Generate a development spec from a feature idea or decision brief. Creates docs/specs/ with structured requirements. | SPEC-001, SPEC-002, SPEC-003 +241 | test-active-spec-pick.sh, test-audit-verdict-grammar.sh, test-bin-forwarders.sh +109 |
| `/kit:start` | `[H/I]` | Detect project state and suggest the right next command. The entry point for any session. | SPEC-002, SPEC-003, SPEC-004 +94 | test-anomalies-advisor.sh, test-audit-cadence.sh, test-board-add.sh +95 |
| `/kit:spec` | `[H/I]` | Generate a development spec from a feature idea or decision brief. Creates docs/specs/ with structured requirements. | SPEC-001, SPEC-002, SPEC-003 +241 | test-active-spec-pick.sh, test-audit-verdict-grammar.sh, test-bin-forwarders.sh +110 |
| `/kit:start` | `[H/I]` | Detect project state and suggest the right next command. The entry point for any session. | SPEC-002, SPEC-003, SPEC-004 +94 | test-anomalies-advisor.sh, test-audit-cadence.sh, test-board-add.sh +96 |
| `/kit:test-plan-review-team` | `[H/I]` | Parallel multi-lens adversarial critique of a spec's test plan (the ## Test plan section), with a bounded revise loop that tightens it. Dis… | SPEC-031, SPEC-052, SPEC-062 +14 | test-meta-docs-registry.sh, test-meta-review-verifiers.sh, test-meta-vmodel-dispatch.sh +3 |
| `/kit:test-plan` | `[H/I]` | Derive a test-case coverage matrix from a spec's acceptance criteria before /kit:execute. Writes a `## Test plan` section into the active s… | SPEC-004, SPEC-016, SPEC-018 +38 | test-ceremony-lens.sh, test-e2e.sh, test-gate-ledger-inherit.sh +15 |
| `/kit:test-write` | `[H/I]` | Turn a SOLID-verdict `## Test plan critique` into real, executing test code via `kit:test-writer`, one case per matrix row. Never dispatche… | SPEC-203, SPEC-227, SPEC-237 +2 | test-test-writer-contract.sh |
Expand Down Expand Up @@ -153,7 +153,7 @@ GENERATED , do not hand-edit. Regenerate: `bash lib/registry/feature-registry.sh
| `classify floor` | `[V]` | `lib/classify/lane-classify.sh` | the diff floor: full when changed paths hit a hard path, else the size floor for the chosen lane | SPEC-036, SPEC-044, SPEC-045 +77 | test-active-spec-pick.sh, test-ceremony-fits-diff.sh, test-clean-room.sh +48 |
| `classify risk` | `[V]` | `lib/classify/lane-classify.sh` | risk verdict for a task and its files: full when the lane is full or a full-lane flag fires | SPEC-036, SPEC-044, SPEC-045 +77 | test-active-spec-pick.sh, test-ceremony-fits-diff.sh, test-clean-room.sh +48 |
| `flick` | `[V]` | `lib/decide/flick.sh` | pick one of N through a decision API; shadow-only, fails open, always exit 0 | SPEC-381, SPEC-427 | test-bin-forwarders.sh, test-flick.sh, test-hooks.sh +2 |
| `lane data` | `[V]` | `lib/gate/lane-data.sh` | the one reader of lane data ([lane.<name>] and [lanes] in kit.toml) for the gate ledger and the classifier | SPEC-044, SPEC-045, SPEC-048 +47 | test-active-spec-pick.sh, test-clean-room.sh, test-codex-hooks.sh +40 |
| `lane data` | `[V]` | `lib/gate/lane-data.sh` | the one reader of lane data ([lane.<name>] and [lanes] in kit.toml) for the gate ledger and the classifier | SPEC-044, SPEC-045, SPEC-048 +47 | test-active-spec-pick.sh, test-clean-room.sh, test-codex-hooks.sh +41 |
| `orchestrate --backend orca` | `[V]` | `lib/queue/orca-backend.sh` | opt-in Orca backend for the mega runner: sub-goals as Orca Tasks with supervised workers, state read live | SPEC-370 | test-orchestrate-orca.sh |
| `push-refs` | `[V]` | `lib/gate/push-refs.sh` | fail-closed parser that names which refs a shell command pushes, used by the ship-gate | SPEC-044, SPEC-045, SPEC-048 +43 | test-active-spec-pick.sh, test-clean-room.sh, test-codex-hooks.sh +37 |
| `recheck-sample decide` | `[V]` | `lib/gate/recheck-sample.sh` | decide and record whether an execute run rechecks its end-verifier PASSes, keyed on the rid | SPEC-369, SPEC-421 | test-whole-spec-dispatch.sh |
Expand Down
186 changes: 186 additions & 0 deletions docs/verification/l312-lane-prune.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
# Verification: l312-lane-prune

Headless shell library fix (`lib/gate/lane-data.sh`, branch `l312-lane-prune`, off `origin/master` `e75b5b2d`): no visible surface.

## Cause and baseline reproduction

In `lib/gate/lane-data.sh` (`lane_effective`), the awk rule matching a `lane-lower` override row checked only `$2 == "GATE" && $3 == "lane-lower" && $4 == "override"`, ignoring the writer tag (`$NF == "via=lane-lower"`). On a run started in a lighter lane under a stricter spec `Lane:` header (for example `START lane=tiny` under `Lane: full`), a hand override (`gate-ledger.sh override <rid> lane-lower "full -> tiny: x"`, tagged `| via=hand`) followed by a plain `start --amend <rid> tiny` (which required no `--lower` because the ledger lane was already `tiny`) lowered the resolved check lane from `full` to `tiny`. Two adjacent parsing bugs sat on the same line: `split($5, p, " -> "); t = p[n]` broke when a sanctioned `--reason` contained `" -> "` and accepted rows with no arrow at all (`n == 1`), and an intervening non-amend row did not clear `pend`.

Baseline red run of `tests/test-lane-lower-via.sh` on unchanged `origin/master` (`e75b5b2d`):

```text
Command: bash tests/test-lane-lower-via.sh
Exit: 1
Output:
=== hand override of lane-lower cannot lower check lane ===
FAIL override lane-lower (via=hand) + start --amend tiny stays full (got 'tiny', want 'full')
FAIL override lane-lower with forged trailing via=lane-lower stays full (got 'tiny', want 'full')
=== non-lane-lower writer tags and tag-less rows cannot lower check lane ===
FAIL lane-lower row with via=hand does not sanction amend (got 'tiny', want 'full')
FAIL lane-lower row with via=plan does not sanction amend (got 'tiny', want 'full')
FAIL lane-lower row with via=batch does not sanction amend (got 'tiny', want 'full')
FAIL lane-lower row with via=inherit does not sanction amend (got 'tiny', want 'full')
FAIL tag-less lane-lower row reads as hand and does not sanction amend (got 'tiny', want 'full')
=== adjacency and format checks on via=lane-lower rows ===
FAIL intervening line clears pending lane-lower before START-AMEND (got 'tiny', want 'full')
FAIL lane-lower row without arrow does not sanction amend (got 'tiny', want 'full')
PASS lane-lower aimed at tiny does not sanction amend to normal
=== sanctioned start --amend --lower still lowers check lane ===
PASS start --amend --lower --reason lowers full to tiny
FAIL reason containing ' -> ' still resolves target lane normal (got 'full', want 'normal')
PASS reason containing ' | ' still recognizes trailing via=lane-lower
PASS later non-lower amend after lowering restores stricter header full
=== direct lane_effective source check ===
FAIL direct lane_effective rejects hand-bypass (got 'tiny', want 'full')
PASS direct lane_effective accepts sanctioned lowering
---
PASS=5 FAIL=11
Verdict: RED (reproduced on unchanged origin/master)
```

## Fix

1. `lib/gate/lane-data.sh`: require `NF >= 6 && $NF == "via=lane-lower"` on `GATE | lane-lower | override` rows in `lane_effective`, parse the target lane from `p[2]` only when `split($5, p, " -> ")` yields `n >= 2`, clear `pend` on any non-matching intervening line, and remove the unused local variable `applies` in `_lane_resolve_layers` so `shellcheck -S warning` passes.
2. `tests/test-lane-lower-via.sh`: regression suite covering hand overrides, forged trailing `via=lane-lower`, other writer tags (`via=plan`, `via=batch`, `via=inherit`), tag-less legacy rows, intervening rows, arrow-less rows, target mismatch, reasons containing `" -> "` and `" | "`, subsequent non-lower amends, and direct `lane_effective` calls.
3. `docs/reference/FEATURES.md`: regenerated via `bash lib/registry/feature-registry.sh check --fix` to index the new test suite.

## Green runs

### 1. New regression suite on bash 5 and macOS bash 3.2, plus shellcheck

```text
Command: shellcheck -S warning lib/gate/lane-data.sh tests/test-lane-lower-via.sh && bash tests/test-lane-lower-via.sh && /bin/bash tests/test-lane-lower-via.sh
Exit: 0
Output:
=== hand override of lane-lower cannot lower check lane ===
PASS override lane-lower (via=hand) + start --amend tiny stays full
PASS override lane-lower with forged trailing via=lane-lower stays full
=== non-lane-lower writer tags and tag-less rows cannot lower check lane ===
PASS lane-lower row with via=hand does not sanction amend
PASS lane-lower row with via=plan does not sanction amend
PASS lane-lower row with via=batch does not sanction amend
PASS lane-lower row with via=inherit does not sanction amend
PASS tag-less lane-lower row reads as hand and does not sanction amend
=== adjacency and format checks on via=lane-lower rows ===
PASS intervening line clears pending lane-lower before START-AMEND
PASS lane-lower row without arrow does not sanction amend
PASS lane-lower aimed at tiny does not sanction amend to normal
=== sanctioned start --amend --lower still lowers check lane ===
PASS start --amend --lower --reason lowers full to tiny
PASS reason containing ' -> ' still resolves target lane normal
PASS reason containing ' | ' still recognizes trailing via=lane-lower
PASS later non-lower amend after lowering restores stricter header full
=== direct lane_effective source check ===
PASS direct lane_effective rejects hand-bypass
PASS direct lane_effective accepts sanctioned lowering
---
PASS=16 FAIL=0
Verdict: PASS
```

### 2. Local gate-ledger suites

```text
Command: bash tests/test-gate-ledger-amend.sh && bash tests/test-gate-ledger-override-via.sh && bash tests/test-gate-ledger-check-cache.sh
Exit: 0
Output:
gate-ledger amend: 39/39 passed
passed 20, failed 0
Passed: 48 / 48
All gate-ledger check cache tests passed.
Verdict: PASS
```

### 3. Repo lints, contract checks, and feature registry

```text
Command: bash tests/test-no-personal-paths.sh && bash tests/test-no-scattered-ids.sh && bash tests/test-operator-pin.sh && bash tests/test-kit-contract.sh && bash tests/test-boundary-lint.sh && bash tests/test-mktemp-template-guard.sh && bash tests/test-meta-docs-registry.sh && bash tests/test-meta-hard-claims.sh && bash scripts/secret-scan.sh && bash scripts/check-owners.sh
Exit: 0
Output:
Passed: 3 / 3
test-no-scattered-ids: all 9 passed
operator-pin: 4 passed, 0 failed
=== kit-contract: 33 passed, 0 failed ===
=== 36/36 passed ===
=== 11 passed, 0 failed ===
Passed: 123 / 123
Passed: 25 / 25
secret-scan: 2317 tracked files, no secret found
owners: 14 paths, all have a row
Verdict: PASS
```

## Negative control

### 1. Drop writer-tag check (`NF >= 6 && $NF == "via=lane-lower"`)

```text
Command: bash scripts/negctl.sh "bash tests/test-lane-lower-via.sh" "perl -i -pe 's/ && NF >= 6 && \\\$NF == \"via=lane-lower\"//' lib/gate/lane-data.sh"
Exit: 0
Output:
Command: bash tests/test-lane-lower-via.sh
Exit: 1
Output:
FAIL tag-less lane-lower row reads as hand and does not sanction amend (got 'tiny', want 'full')
...
FAIL direct lane_effective rejects hand-bypass (got 'tiny', want 'full')
PASS direct lane_effective accepts sanctioned lowering
---
PASS=8 FAIL=8
Verdict: RED, as expected
```

Restored automatically by `scripts/negctl.sh` via `git checkout`; tree clean and post-restore check exited `0`.

### 2. Revert target arrow index (`p[2]` back to `p[n]`)

```text
Command: bash scripts/negctl.sh "bash tests/test-lane-lower-via.sh" "perl -i -pe 's/t = p\[2\]/t = p[n]/' lib/gate/lane-data.sh"
Exit: 0
Output:
Command: bash tests/test-lane-lower-via.sh
Exit: 1
Output:
PASS start --amend --lower --reason lowers full to tiny
FAIL reason containing ' -> ' still resolves target lane normal (got 'full', want 'normal')
PASS reason containing ' | ' still recognizes trailing via=lane-lower
PASS later non-lower amend after lowering restores stricter header full
---
PASS=15 FAIL=1
Verdict: RED, as expected
```

Restored automatically by `scripts/negctl.sh` via `git checkout`; tree clean and post-restore check exited `0`.

### 3. Remove intervening-line pending clear (`{ pend = "" }`)

```text
Command: bash scripts/negctl.sh "bash tests/test-lane-lower-via.sh" "perl -i -pe 's/\{ pend = \"\" \}//' lib/gate/lane-data.sh"
Exit: 0
Output:
Command: bash tests/test-lane-lower-via.sh
Exit: 1
Output:
FAIL intervening line clears pending lane-lower before START-AMEND (got 'tiny', want 'full')
PASS lane-lower row without arrow does not sanction amend
PASS lane-lower aimed at tiny does not sanction amend to normal
---
PASS=15 FAIL=1
Verdict: RED, as expected
```

Restored automatically by `scripts/negctl.sh` via `git checkout`; tree clean and post-restore check exited `0`.

## Not proven locally

- `tests/test-lane-effective.sh` and `tests/test-lanes-data.sh` run on CI only (local push-pattern suites are deferred to GitHub Actions macOS + Ubuntu).

## Rollback

Revert the branch commits to restore `lib/gate/lane-data.sh`, `tests/test-lane-lower-via.sh`, and `docs/reference/FEATURES.md` to `e75b5b2d`:

```bash
git revert --no-edit <merge-sha>
```

No ledger file format or on-disk state changes; `gate-ledger.sh start --amend --lower` already emits `| via=lane-lower`.
9 changes: 6 additions & 3 deletions lib/gate/lane-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ lane_spec_header() {
# answers; ledgers are never rewritten.
# Check lane (the ship check): the STRICTER of the spec header and the ledger lane, by lane_rank_of, so a
# plain START cannot shed the header's gates. Two exceptions: an amend written through `--lower --reason`
# (it is preceded by its `lane-lower` override line) may go below the header, and a tie in rank keeps the
# (it is immediately preceded by its `lane-lower` override line tagged `via=lane-lower`) may go below the header, and a tie in rank keeps the
# older winner (amend: the ledger lane; start: the header). A lane with no rank (a lanes.d overlay lane, or
# an unknown header) never lowers a ranked one: an unranked ledger lane yields to a kit-lane header, and an
# unranked header under a plain START still wins, as before, so check() fails closed on it.
Expand All @@ -117,9 +117,12 @@ lane_effective() {
IFS=$'\t' read -r lane src lowered < <(awk -F' [|] ' -v names=" $(lane_declared_names) " '
function lane_of(s) { if (match(s, /lane=[^ ]+/)) return substr(s, RSTART + 5, RLENGTH - 5); return "" }
function ok(l) { return l != "" && index(names, " " l " ") > 0 }
$2 == "GATE" && $3 == "lane-lower" && $4 == "override" { n = split($5, p, " -> "); t = p[n]; sub(/:.*$/, "", t); pend = t; next }
$2 == "GATE" && $3 == "lane-lower" && $4 == "override" && NF >= 6 && $NF == "via=lane-lower" {
n = split($5, p, " -> "); if (n >= 2) { t = p[2]; sub(/:.*$/, "", t); pend = t } else pend = ""; next
}
$2 == "START-AMEND" { l = lane_of($3); if (ok(l)) { a = l; low = (pend == l) } pend = ""; next }
$2 == "START" && !seen { seen = 1; l = lane_of($3); if (ok(l)) first = l }
{ pend = "" }
END { if (a != "") print a "\tamend\t" (low ? 1 : 0); else if (first != "") print first "\tstart\t0" }' "$f") || true
fi
if [ -z "$lane" ] && [ -n "$hdr" ]; then lane="$hdr"; src=spec; fi
Expand Down Expand Up @@ -186,7 +189,7 @@ lane_resolve() {
return "$_ld_rc"
}
_lane_resolve_layers() {
local lane="$1" mode="${2:-}" layer f raw lraw ph known applies
local lane="$1" mode="${2:-}" layer f raw lraw ph known
LANE_PHASES=""; LANE_LIGHT=""
# Only the five kit lanes exist here. A committed `[lane.mega]` block must not make `mega` a
# lane whose gate check passes; drop-in lanes answer `plan` only, through lanes.d.
Expand Down
Loading
Loading