From 348f731e1cda8e289d5a1ccf568d7e7a75079309 Mon Sep 17 00:00:00 2001 From: Alex Wegener Date: Sun, 15 Nov 2026 14:24:28 +0100 Subject: [PATCH 01/20] feat: spec delta in the worker report, checked by ytstack-brief check (#75) The brief's Spec impact section states the duty to edit the area file a change makes false; the report's Spec: line names the edited sections or none -- . check fails a bare none and prose without area and path. Co-Authored-By: Claude Opus 5.5 --- .ytstack/DECISIONS.md | 19 +++++++++++++++++++ .ytstack/spec/checks-and-evals.md | 2 +- CHANGELOG.md | 9 +++++++++ bin/ytstack-brief | 12 +++++++++++- skills/spawn-milestone-team/SKILL.md | 2 +- skills/spawn-milestone-team/brief-template.md | 5 ++++- tests/ytstack-brief.test.sh | 19 ++++++++++++++++++- 7 files changed, 63 insertions(+), 5 deletions(-) diff --git a/.ytstack/DECISIONS.md b/.ytstack/DECISIONS.md index 80459004..7120d97d 100644 --- a/.ytstack/DECISIONS.md +++ b/.ytstack/DECISIONS.md @@ -1218,3 +1218,22 @@ Plus: ops-layer split during the same session (yopstack created as own public re **Chose:** A roadmap status `backlog` (frontmatter and the global ROADMAP column): planned, kept, not picked by `ytstack-frontier` while no milestone is current. Making it current sets `status: planned` and `current_milestone` again. **Supersedes:** None. Extends the roadmap state values in `docs/ux/skill-structure.md`. + +## 2026-11-15: The spec delta is the report's existing `Spec:` label, checked for its form (issue #75) + +**Context:** Lanes of a long coordinator run updated receipts and changelogs and never the area files their change made false. The brief listed the area files only as reading context, and the report's `Spec:` line accepted any text. + +**Options considered:** +- A) A twelfth label `Spec delta:` beside `Spec:`. +- B) Rename `Spec:` to `Spec delta:`. +- C) Keep `Spec:` and give it a checked form: `: (
)` per edited section, joined by `;`, or `none -- `, with the brief stating the duty to edit the section. + +**Chose:** C. + +**Reason:** The label already says what the plan's `## Spec impact` promised, in the plan's own two forms (`summarize-task` records the same two forms under `## Spec`). A second label would hold the same fact twice; a rename breaks every report and fixture for no gain. What was missing was the duty in the brief and a check that a bare `none` or prose fails. + +**How to apply:** +- The reasons after `none --` are the plan rule's: restores the described behaviour, no behaviour or contract changes, not covered by an area. +- `bin/ytstack-brief check` checks the form only; whether the diff matches the delta is checked by `bin/ytstack-finish-lane route`. + +**Supersedes:** None. diff --git a/.ytstack/spec/checks-and-evals.md b/.ytstack/spec/checks-and-evals.md index 5eb5af9d..2fea0be0 100644 --- a/.ytstack/spec/checks-and-evals.md +++ b/.ytstack/spec/checks-and-evals.md @@ -87,7 +87,7 @@ Everything that tells a contributor whether a change is acceptable: the static c - A bash script on awk. `render --task ` or `--slice ` prints a brief built from the plan files and `skills/spawn-milestone-team/brief-template.md`, and includes the body of `skills/minimal-code/SKILL.md` as the work contract, read at render time. It prints no brief when the plan, its `## Files` section, the template or the contract is missing (exit 1). - `render --kind implement|review|prepare` adds what the worker may do; a review brief pins the commit range it reviews (`--head`, optionally `--base`) and has no Git section. `render --lesson F###` builds the brief of the lesson lane `lesson-F###` from the lesson in `signals/` (outcome from its title, target and "Assessment"; scope and check from its "Files" and "Verification"; commit prefix the lane). -- `check` validates a worker's report from a file or stdin: the labels of the template's "Report" section, each with a value, an exit code in every `Checks run:` line, one of the three `Status:` values and its consistency with `Blockers:`. It prints one line per problem and exits 1, or `report ok`. +- `check` validates a worker's report from a file or stdin: the labels of the template's "Report" section, each with a value, an exit code in every `Checks run:` line, one of the three `Status:` values and its consistency with `Blockers:`, and a spec delta under `Spec:` (`none -- `, or `: ` per edited section, joined by `;`; a bare `none` fails). It prints one line per problem and exits 1, or `report ok`. The brief's "Spec impact" section makes the edit a duty: a change that makes a sentence of a listed area file false edits that section in the same commits. **The coordinator scripts** (formats and rules: `docs/ux/coordinator-format.md`; each has a suite of the same name under `tests/`) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43e54aa0..d92a81eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- **A worker's report carries a spec delta** (issue #75): the brief's + "Spec impact" section now says that a change which makes a sentence of an + area file false edits that section in the same commits, and the report's + `Spec:` line names the edited sections (`: (
)`) or + says `none -- `. `ytstack-brief check` fails a bare `none` and prose + without an area and a path. `spawn-milestone-team` 0.5.1 (brief template). + ## [0.11.0] - 2026-11-15 ### Added diff --git a/bin/ytstack-brief b/bin/ytstack-brief index 65773a48..cf993231 100755 --- a/bin/ytstack-brief +++ b/bin/ytstack-brief @@ -42,7 +42,9 @@ # check validates the eleven labels of the template's "Report" section: each # present at the start of a line and with a value, an exit code in every # "Checks run:" line, "Status:" one of complete, partial, blocked, and -# consistent with "Blockers:" (blocked names one, complete has none). A report +# consistent with "Blockers:" (blocked names one, complete has none), and +# "Spec:" a spec delta: "none -- ", or ": " per edited +# section (a "(
)" may follow), several joined by ";". A report # that carries one of the four labels of a review (Risk, Severity, Reach, # Invariants touched) has to carry all four with a value, and "Risk:" is low, # normal or high. A report that carries "Lens:" or "Evidence:" has to carry @@ -403,6 +405,14 @@ cmd_check() { else if (empty[i]) { print "empty: " L[i]; bad = 1 } } for (i = 1; i <= nc; i++) { print "Checks run: no exit code in \"" nocode[i] "\""; bad = 1 } + # The spec delta: "none -- ", or one ": " entry per + # edited section, joined by ";". + sp = V["Spec"] + if (sp != "" && sp !~ /^[Nn]one -- [^ ]/) { + k = split(sp, E, ";"); fine = 1 + for (i = 1; i <= k; i++) { e = E[i]; gsub(/^[ \t]+|[ \t]+$/, "", e); if (e !~ /^[a-z0-9][a-z0-9-]*: [^ <>|]+/) fine = 0 } + if (!fine) { print "Spec: \"" sp "\" is no spec delta: name each edited section as \": (
)\", or write \"none -- \""; bad = 1 } + } s = V["Status"]; b = V["Blockers"] if (s != "" && s !~ /^(complete|partial|blocked)$/) { print "Status: \"" s "\" is not complete, partial or blocked"; bad = 1 } if (b != "") { diff --git a/skills/spawn-milestone-team/SKILL.md b/skills/spawn-milestone-team/SKILL.md index 5a77105a..25da0b78 100644 --- a/skills/spawn-milestone-team/SKILL.md +++ b/skills/spawn-milestone-team/SKILL.md @@ -3,7 +3,7 @@ name: spawn-milestone-team description: "Dispatches the current milestone's slices to parallel workers: by default one worktree-isolated implementer subagent per slice plus a fresh verifier per slice, orchestrated from the main session which never edits source; with PREFERENCES team on, a Claude Code Agent Team instead. Use after slice-milestone and plan-eng-review when the slices are independent, or when the user says spawn the team, run the slices in parallel, dispatch the milestone. Not for a single slice or sequential work (plan-task)." metadata: tier: task - version: 0.5.0 + version: 0.5.1 triggers: - spawn team - dispatch milestone diff --git a/skills/spawn-milestone-team/brief-template.md b/skills/spawn-milestone-team/brief-template.md index b9ea8d5a..b83958fd 100644 --- a/skills/spawn-milestone-team/brief-template.md +++ b/skills/spawn-milestone-team/brief-template.md @@ -66,6 +66,8 @@ Other plans, summaries and the history in STATE.md are not needed for this task. {{SPEC_IMPACT}} +This is a duty, not background. When your change makes a sentence of an area file under "Read for context" false (behaviour, a contract, a guard, an error path, where it is implemented), edit that section in the same commits, or the source the area file names. The report's `Spec:` line names what you edited; an unchanged spec needs its reason there. + ## Gates {{GATES}} @@ -91,6 +93,7 @@ End with exactly this report: all eleven labels, in this order, each at the star - `Status:` is one of the three words and nothing else. `partial` and `blocked` are said there, never in a paragraph. `blocked` names what blocks under `Blockers:`; `complete` has `Blockers: none`. - One `Checks run:` line per check, with the raw exit code. No check ran: `Checks run: none -- `. - `Uncommitted:` names every file you changed and did not commit. +- `Spec:` is the spec delta: per section you edited `: (
)`, several joined by `;`, or `none -- ` (restores the described behaviour, no behaviour or contract changes, not covered by an area). A bare `none` fails the check, and a change to behaviour, a contract or a guard without an edited section or a reason does not merge without a person. - Claim nothing that has no line here. What you did not run goes under `Not checked:`, not into `Outcome:`. ``` @@ -100,7 +103,7 @@ Outcome: Commits: ..HEAD, or "none"> Uncommitted: Checks run: -- exit at in -Spec: +Spec: : (
); ... | none -- Deviations: Blockers: Not checked: diff --git a/tests/ytstack-brief.test.sh b/tests/ytstack-brief.test.sh index 9fbda42e..08806eb3 100644 --- a/tests/ytstack-brief.test.sh +++ b/tests/ytstack-brief.test.sh @@ -447,6 +447,20 @@ eq "Status: blocked with a blocker passes, also one that starts with 'none'" "re chk "$(printf '%s\n' "$GOOD" | sed -e 's/^Status:.*/Status: partial/' -e 's/^Blockers:.*/Blockers: None./')" eq "Status: partial passes with or without a blocker" "report ok" "$OUT" +# The spec delta (issue #75): the edited spec section with its path, or +# "none -- "; a bare "none" or prose is no delta. +chk "$(printf '%s\n' "$GOOD" | sed 's#^Spec:.*#Spec: auth: .ytstack/spec/auth.md (Behavior); billing: docs/billing.md (Export)#')" +eq "Spec: two edited sections with their paths pass" "report ok" "$OUT" +chk "$(printf '%s\n' "$GOOD" | sed 's/^Spec:.*/Spec: none -- restores the described behaviour/')" +eq "Spec: none with a reason passes" "report ok" "$OUT" +chk "$(printf '%s\n' "$GOOD" | sed 's/^Spec:.*/Spec: none/')" +eq "Spec: a bare none fails" 1 "$EC" +eq "and says what it needs" 'Spec: "none" is no spec delta: name each edited section as ": (
)", or write "none -- "' "$OUT" +chk "$(printf '%s\n' "$GOOD" | sed 's/^Spec:.*/Spec: updated the auth docs/')" +eq "Spec: prose without an area and a path fails" 'Spec: "updated the auth docs" is no spec delta: name each edited section as ": (
)", or write "none -- "' "$OUT" +chk "$(printf '%s\n' "$GOOD" | sed 's#^Spec:.*#Spec: auth: .ytstack/spec/auth.md; the rest is unchanged#')" +eq "Spec: every entry needs an area and a path" 1 "$EC" + chk "$(printf '%s\n' "$GOOD" | sed 's/^Not checked:.*/Not checked: /')" eq "an empty Not checked fails" 1 "$EC" eq "and is named" "empty: Not checked" "$OUT" @@ -522,10 +536,13 @@ SHAPE=$(part Report) eq "the shape names the eleven labels, in the order of the format document" \ "Task,Status,Outcome,Commits,Uncommitted,Checks run,Spec,Deviations,Blockers,Not checked,Next," \ "$(printf '%s\n' "$SHAPE" | sed -n 's/^\([A-Z][A-Za-z ]*\): <.*/\1/p' | tr '\n' ',')" +has "the shape says the spec delta is a duty" 'is the spec delta' "$SHAPE" +has "Spec impact: the duty to edit the area file" 'edit that section in the same commits' "$(part "Spec impact")" chk "$SHAPE" eq "the unfilled report shape does not pass" 'Checks run: no exit code in " -- exit at in " +Spec: ": (
); ... | none -- " is no spec delta: name each edited section as ": (
)", or write "none -- " Status: "" is not complete, partial or blocked' "$OUT" -chk "$(printf '%s\n' "$SHAPE" | sed -e 's/exit /exit 0/' -e 's/^Status:.*/Status: partial/')" +chk "$(printf '%s\n' "$SHAPE" | sed -e 's/exit /exit 0/' -e 's/^Status:.*/Status: partial/' -e 's/^Spec:.*/Spec: none -- no behaviour or contract changes/')" eq "with an exit code and a status filled in, its labels are complete" "report ok" "$OUT" OUT=$(bash "$BIN" check "$TMP/none.txt" 2>&1); eq "an unreadable report file: exit 64" 64 "$?" From 445bfcfb34e6982b78749505a4832e0c3ee5446b Mon Sep 17 00:00:00 2001 From: Alex Wegener Date: Sun, 15 Nov 2026 14:29:03 +0100 Subject: [PATCH 02/20] feat: plan-first brief for an unplanned task (#76) render --task on a task its slice plan lists without a task plan now renders a brief whose first deliverable is the task plan in plan-task's format, committed alone, then the files it names. The slice brief names the plan to write per unplanned task instead of "plan it yourself". Co-Authored-By: Claude Opus 5.5 --- .ytstack/DECISIONS.md | 19 ++++++++ .ytstack/spec/checks-and-evals.md | 2 +- CHANGELOG.md | 6 +++ bin/ytstack-brief | 48 ++++++++++++++++++- skills/spawn-milestone-team/brief-template.md | 9 +++- tests/ytstack-brief.test.sh | 32 +++++++++++-- 6 files changed, 110 insertions(+), 6 deletions(-) diff --git a/.ytstack/DECISIONS.md b/.ytstack/DECISIONS.md index 7120d97d..7fbb7e0f 100644 --- a/.ytstack/DECISIONS.md +++ b/.ytstack/DECISIONS.md @@ -1237,3 +1237,22 @@ Plus: ops-layer split during the same session (yopstack created as own public re - `bin/ytstack-brief check` checks the form only; whether the diff matches the delta is checked by `bin/ytstack-finish-lane route`. **Supersedes:** None. + +## 2026-11-15: A brief for an unplanned task makes the task plan its first deliverable (issue #76) + +**Context:** In a long coordinator run no lane planned its tasks. `ytstack-brief render` said "not planned yet: run ytstack:plan-task first, or plan it yourself", so lanes coded without Files, Verification or Spec impact. + +**Options considered:** +- A) `render` runs `plan-task` inline before the brief. +- B) A plan-first brief: the worker writes the task plan in `plan-task`'s format first, commits it alone, then implements what it names. +- C) Refuse to render until the plan exists. + +**Chose:** B. + +**Reason:** A script cannot run a skill, and `plan-task` asks questions a coordinator answers poorly at dispatch time (A). C was the old behaviour for `--task` and is what coordinators routed around by writing briefs by hand. B keeps the dispatch on the rendered path and leaves a plan on disk that `summarize-task`, `ytstack-spec impact` and `finish-lane` can check. + +**How to apply:** +- The plan goes beside the slice plan; the slice plan's backticked paths of the task line are hints, not the scope. +- A review of an unplanned task still has no brief: there is nothing to review against. + +**Supersedes:** None. diff --git a/.ytstack/spec/checks-and-evals.md b/.ytstack/spec/checks-and-evals.md index 2fea0be0..ad7ae7aa 100644 --- a/.ytstack/spec/checks-and-evals.md +++ b/.ytstack/spec/checks-and-evals.md @@ -85,7 +85,7 @@ Everything that tells a contributor whether a change is acceptable: the static c **`bin/ytstack-brief`: the brief of a dispatched worker and its report** -- A bash script on awk. `render --task ` or `--slice ` prints a brief built from the plan files and `skills/spawn-milestone-team/brief-template.md`, and includes the body of `skills/minimal-code/SKILL.md` as the work contract, read at render time. It prints no brief when the plan, its `## Files` section, the template or the contract is missing (exit 1). +- A bash script on awk. `render --task ` or `--slice ` prints a brief built from the plan files and `skills/spawn-milestone-team/brief-template.md`, and includes the body of `skills/minimal-code/SKILL.md` as the work contract, read at render time. It prints no brief when the plan, its `## Files` section, the template or the contract is missing (exit 1). A task without a plan whose slice plan lists it as open gets a plan-first brief (not for `--kind review`): its first deliverable is the task plan beside the slice plan, in the format of `plan-task` Step 9 (Files, What this does, Spec impact, Verification), committed alone, then the files that plan names; Scope lists the backticked paths of the task line as hints. A slice brief names the plan to write for each unplanned task. No brief tells the worker to plan it some other way. - `render --kind implement|review|prepare` adds what the worker may do; a review brief pins the commit range it reviews (`--head`, optionally `--base`) and has no Git section. `render --lesson F###` builds the brief of the lesson lane `lesson-F###` from the lesson in `signals/` (outcome from its title, target and "Assessment"; scope and check from its "Files" and "Verification"; commit prefix the lane). - `check` validates a worker's report from a file or stdin: the labels of the template's "Report" section, each with a value, an exit code in every `Checks run:` line, one of the three `Status:` values and its consistency with `Blockers:`, and a spec delta under `Spec:` (`none -- `, or `: ` per edited section, joined by `;`; a bare `none` fails). It prints one line per problem and exits 1, or `report ok`. The brief's "Spec impact" section makes the edit a duty: a change that makes a sentence of a listed area file false edits that section in the same commits. diff --git a/CHANGELOG.md b/CHANGELOG.md index d92a81eb..24769d54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 `Spec:` line names the edited sections (`: (
)`) or says `none -- `. `ytstack-brief check` fails a bare `none` and prose without an area and a path. `spawn-milestone-team` 0.5.1 (brief template). +- **A brief for an unplanned task plans it first** (issue #76): `ytstack-brief + render --task` on a task its slice plan lists without a task plan no longer + fails or says "plan it yourself"; the brief's first deliverable is the task + plan beside the slice plan, in `plan-task`'s format (Files, What this does, + Spec impact, Verification), committed alone, then the files it names. A + slice brief names the plan file to write per unplanned task. ## [0.11.0] - 2026-11-15 diff --git a/bin/ytstack-brief b/bin/ytstack-brief index cf993231..b9d0ab25 100755 --- a/bin/ytstack-brief +++ b/bin/ytstack-brief @@ -21,6 +21,11 @@ # else. Skeleton, fixed sentences and the report shape: # skills/spawn-milestone-team/brief-template.md. # +# A task without a plan whose slice plan lists it as open (implement or +# prepare): the brief makes the task plan the first deliverable, in the format +# of skills/plan-task (Step 9), beside the slice plan, then the implementation +# of what that plan names. A slice brief says the same per unplanned task. +# # KIND says what the worker may do (docs/ux/coordinator-format.md, "Lane kinds"): # implement (default) change files inside the scope, commit with the prefix # review read only: review the range --base..--head, or the commit --head @@ -106,6 +111,39 @@ add() { x=$(section "$2" Gates); [ -z "$x" ] || B_GATES=$(para "$B_GATES" "$l$x") } +# fill : the sentences of that name with the path of the +# plan to write and the plan format filled in; a template without them ends +# the render. +fill() { + local s m='{{PLAN}}' f='{{PLAN_FORMAT}}' p + s=$(lens_snip "$1") || exit 1 + p=$(rel "$2"); s=${s//"$m"/"$p"} + s=${s//"$f"/"$ROOT/skills/plan-task/SKILL.md"} + printf '%s' "$s" +} + +# plan_first : the brief of a task its slice plan lists +# and no task plan describes (issue #76). Its first deliverable is the task +# plan in the format of skills/plan-task (Step 9), then what that plan names. +plan_first() { + local t=${2##*-} line to x + line=$(section "$1" Tasks | sed -n "s/^- \[ \] $t -- //p" | head -1) + [ -n "$line" ] || die "no plan for $2, and $(rel "$1") lists no open task $t" + to="$(dirname "$1")/$2-PLAN.md" + x=$(fill plan-first "$to") || exit 1 + B_OUTCOME=$(para "$line" "${x//$NL/$NL$NL}") + B_FILES=$(fill plan-first-scope "$to") || exit 1 + # The paths the task line names in backticks: a hint for the plan, and what + # the area lookup below reads. + ALL_FILES=$(printf '%s\n' "$line" | grep -oE '`[^`]+`' | tr -d '`' | grep -E '[/.]' | sort -u) + if [ -n "$ALL_FILES" ]; then + x=$(lens_snip plan-first-hint) || exit 1 + B_FILES=$(para "$B_FILES" "$x$NL$NL$(printf '%s\n' "$ALL_FILES" | sed 's/^/- `/; s/$/`/')") + fi + B_VERIFICATION=$(lens_snip plan-first-verification) || exit 1 + B_SPEC_IMPACT=$(lens_snip plan-first-spec-impact) || exit 1 +} + # ---- the lens of a review ------------------------------------------------------ # lens_def : REVIEW.md on stdin; the lens of that name as four lines: its # line, its reads (comma separated), its evidence, its skill. Nothing when the @@ -234,6 +272,11 @@ cmd_render() { ref="lesson-$ref" else plan=$(find_plan "$ref") + # A task without a plan whose slice plan exists: the brief to plan it first. + # A review has nothing to review against without one. + if [ -z "$plan" ] && [ "$kind" = task ] && [ "$lane" != review ]; then + plan=$(find_plan "${ref%-T[0-9][0-9]}"); [ -z "$plan" ] || kind=unplanned + fi [ -n "$plan" ] || die "no plan for $ref: looked for ${YT_DIR:-$TOP/.ytstack}/$ref-PLAN.md" fi @@ -252,6 +295,8 @@ cmd_render() { elif [ "$kind" = task ]; then B_OUTCOME=$(para "$(field "$plan" Summary)" "$(section "$plan" "What this does")") add "" "$plan" + elif [ "$kind" = unplanned ]; then + plan_first "$plan" "$ref" else B_COMMIT_PREFIX="$ref-T##" B_OUTCOME=$(para "$(field "$plan" Goal)" "$(section "$plan" Tasks)") @@ -266,7 +311,8 @@ cmd_render() { for t in $ids; do tp=$(find_plan "$ref-$t") if [ -n "$tp" ]; then add "$t" "$tp"; continue; fi - B_FILES=$(para "$B_FILES" "**$t** -- $(snip unplanned)") + x=$(fill unplanned "$(dirname "$plan")/$ref-$t-PLAN.md") || exit 1 + B_FILES=$(para "$B_FILES" "**$t** -- $x") B_VERIFICATION=$(para "$B_VERIFICATION" "**$t** -- $(snip unplanned-part)") B_SPEC_IMPACT=$(para "$B_SPEC_IMPACT" "**$t** -- $(snip unplanned-part)") done diff --git a/skills/spawn-milestone-team/brief-template.md b/skills/spawn-milestone-team/brief-template.md index b83958fd..a850ed95 100644 --- a/skills/spawn-milestone-team/brief-template.md +++ b/skills/spawn-milestone-team/brief-template.md @@ -3,8 +3,15 @@ - + + + + + + + + diff --git a/tests/ytstack-brief.test.sh b/tests/ytstack-brief.test.sh index 08806eb3..ec558d30 100644 --- a/tests/ytstack-brief.test.sh +++ b/tests/ytstack-brief.test.sh @@ -9,7 +9,9 @@ # technical spec covers the planned files; Gates only when # the plan has some; Git only with --branch # render --slice goal and task list; per planned task its parts; a task -# without a plan is named as not planned +# without a plan gets the plan to write as its first step +# render --task of a task the slice plan lists and no plan describes: a +# plan-first brief, the task plan is the first deliverable # render --kind "## Kind" says what the worker may do: implement (the # default) commits with the prefix; review is read only, pins # the range from --head (a commit hash, required) and --base, @@ -180,7 +182,7 @@ has "a plan under milestones/M###/ is found" '- `.ytstack/milestones/M002/M002-S # ---- 2. render --slice -------------------------------------------------------- echo "# render --slice" R=$(new_repo slice) -printf -- '---\nstatus: planned\n---\n\n# Slice Plan\n\n**Goal:** Token login works end to end\n\n## Tasks\n\n- [ ] T01 -- accept a token\n- [ ] T02 -- reject an expired token\n\n## Gates\n\n- [ ] G01 -- pilot customer agrees | decides: Kim | how: call | lapses: unknown\n\n## Done when\n\nAll tasks done.\n' > "$R/.ytstack/M001-S01-PLAN.md" +printf -- '---\nstatus: planned\n---\n\n# Slice Plan\n\n**Goal:** Token login works end to end\n\n## Tasks\n\n- [ ] T01 -- accept a token\n- [ ] T02 -- reject an expired token in `src/auth/login.sh`\n\n## Gates\n\n- [ ] G01 -- pilot customer agrees | decides: Kim | how: call | lapses: unknown\n\n## Done when\n\nAll tasks done.\n' > "$R/.ytstack/M001-S01-PLAN.md" plan "$R/.ytstack/M001-S01-T01-PLAN.md" "Accept a token" yes run "$R" render --slice M001-S01 --branch ytstack/M001-S01 eq "a slice with one planned and one unplanned task renders" 0 "$EC" @@ -191,7 +193,8 @@ S=$(part Scope) has "Scope: the planned task's files under its label" '**T01** - Modify: `src/auth/login.sh:10-20`' "$S" -has "Scope: the unplanned task is named as such" "**T02** -- not planned yet: run ytstack:plan-task first, or plan it yourself with exact files and a verification command before you write code" "$S" +has "Scope: the unplanned task's plan is its first deliverable" "**T02** -- not planned yet: first write its plan \`.ytstack/M001-S01-T02-PLAN.md\` in the format of \`ytstack:plan-task\`" "$S" +hasnt "nobody is told to plan it himself" "plan it yourself" "$OUT" C=$(part "Read for context") has "Context: the slice plan" '- `.ytstack/M001-S01-PLAN.md`' "$C" has "Context: the task plan" '- `.ytstack/M001-S01-T01-PLAN.md`' "$C" @@ -204,6 +207,29 @@ has "Gates: the slice's gate" "G01 -- pilot customer agrees" "$G" has "Gates: the task's gate" "G01 -- sign-off" "$G" has "Git: one prefix per task" 'prefix `M001-S01-T##:`' "$(part Git)" +# An unplanned task of a planned slice (issue #76): a plan-first brief whose +# first deliverable is the task plan, then the implementation. +run "$R" render --task M001-S01-T02 --branch ytstack/M001-S01 +eq "an unplanned task of a planned slice renders" 0 "$EC" +O=$(part Outcome) +has "plan first: the task line" "reject an expired token" "$O" +has "plan first: the plan is the first deliverable" 'Your first deliverable is its plan: write `.ytstack/M001-S01-T02-PLAN.md`' "$O" +has "plan first: in the format of plan-task" "Step 9 of \`$ROOT/skills/plan-task/SKILL.md\`" "$O" +has "plan first: the sections of a task plan" '`## Files` with the exact paths' "$O" +has "plan first: the plan is committed before the code" "it goes into your first commit, alone" "$O" +hasnt "plan first: nobody is told to plan it himself" "plan it yourself" "$OUT" +S=$(part Scope) +has "plan first: Scope starts with the plan file" '`.ytstack/M001-S01-T02-PLAN.md` (the plan you write first), then the files that plan names under `## Files`.' "$S" +has "plan first: the paths the slice plan names for the task" '- `src/auth/login.sh`' "$S" +has "plan first: Verification comes from the plan the worker writes" 'The command your plan names under `## Verification`.' "$(part Verification)" +has "plan first: Spec impact comes from that plan too" 'What your plan names under `## Spec impact`.' "$(part "Spec impact")" +has "plan first: the slice plan is read" '- `.ytstack/M001-S01-PLAN.md`' "$(part "Read for context")" +has "plan first: the commit prefix is the task" 'prefix `M001-S01-T02:`' "$(part Git)" +run "$R" render --task M001-S01-T02 --kind review --head abc1234 +eq "plan first: a review of an unplanned task has nothing to review against: exit 1" 1 "$EC" +run "$R" render --task M001-S01-T07 +eq "plan first: a task the slice plan does not list: exit 1" 1 "$EC" + # granularity: slice -- the slice plan carries Files and Verification itself plan "$R/.ytstack/M002-S01-PLAN.md" "unused" printf '\n**Goal:** Whole slice in one plan\n\n## Tasks\n\n- [ ] T01 -- all of it\n' >> "$R/.ytstack/M002-S01-PLAN.md" From e5fe5c73cc45f4ae95cec4ada53ef6d73c41cea0 Mon Sep 17 00:00:00 2001 From: Alex Wegener Date: Sun, 15 Nov 2026 14:37:07 +0100 Subject: [PATCH 03/20] feat: finish-lane route checks the spec delta against the lane's diff (#75) route runs ytstack-spec impact (new --head) on base..head for every plan of the lane that states a Spec impact; without one, each touched area needs its area file or a source in the diff, or the report's Spec: none -- (--report). A gap is a reason: spec line and turns unattended into person. Co-Authored-By: Claude Opus 5.5 --- .ytstack/DECISIONS.md | 21 +++++ .ytstack/spec/checks-and-evals.md | 4 +- .ytstack/spec/skills.md | 2 +- CHANGELOG.md | 9 +++ bin/ytstack-finish-lane | 122 +++++++++++++++++++++++++++++- bin/ytstack-spec | 21 +++-- docs/ux/coordinator-format.md | 6 +- docs/ux/review-policy-format.md | 2 +- docs/ux/spec-format.md | 4 + skills/finish-lane/SKILL.md | 15 ++-- tests/ytstack-finish-lane.test.sh | 54 ++++++++++++- tests/ytstack-spec.test.sh | 16 ++++ 12 files changed, 252 insertions(+), 24 deletions(-) diff --git a/.ytstack/DECISIONS.md b/.ytstack/DECISIONS.md index 7fbb7e0f..850d3d63 100644 --- a/.ytstack/DECISIONS.md +++ b/.ytstack/DECISIONS.md @@ -1256,3 +1256,24 @@ Plus: ops-layer split during the same session (yopstack created as own public re - A review of an unplanned task still has no brief: there is nothing to review against. **Supersedes:** None. + +## 2026-11-15: `finish-lane`'s route checks the spec delta; a gap routes to a person (issue #75) + +**Context:** `summarize-task` checks a plan's spec impact, but lanes that skip it merged with no check at all. `finish-lane` read the receipt and the gates, never the spec. + +**Options considered:** +- A) A separate `finish-lane` step `spec` the skill has to call. +- B) Inside `ytstack-finish-lane route`: after `ytstack-risk route`, the spec delta; a gap is a `reason: spec` line and makes the route `person`. +- C) Inside `ytstack-risk route`, for every caller. + +**Chose:** B. + +**Reason:** A step that can be skipped is the failure this issue reports. `route` is already the one call a merge without a person needs. `ytstack-risk` reads a policy at the base commit and stays a function of the diff and the review records; the worker's report is a lane artifact, which only `finish-lane` holds (C would make it read a file it has no record of). + +**How to apply:** +- Plans first: a plan that states `## Spec impact` is checked with `ytstack-spec impact --base --head`, and the report cannot override it. Without one, an area the diff touches needs its area file or a source in the diff, or `Spec: none -- ` in the report given with `--report`. +- The area files are read from the coordinating checkout's working tree, not at the base commit; a change to an area file's frontmatter is a `person` floor anyway. +- Under `merge_by: coordinator` a `reason: spec` line still sends the lane back to the worker. +- No technical spec: `spec: no technical spec`, nothing changes. + +**Supersedes:** None. diff --git a/.ytstack/spec/checks-and-evals.md b/.ytstack/spec/checks-and-evals.md index ad7ae7aa..5506a2f4 100644 --- a/.ytstack/spec/checks-and-evals.md +++ b/.ytstack/spec/checks-and-evals.md @@ -55,7 +55,7 @@ Everything that tells a contributor whether a change is acceptable: the static c **`bin/ytstack-spec`: the technical spec of any project** -- A bash script on git and awk. `lint` checks the format of `.ytstack/spec/`, `drift` lists areas whose `paths` changed after the description or one of its `sources` was last touched, `impact` checks a task plan's "Spec impact" against what the task changed, `areas` names the area of a path. Rules and exit codes: `docs/ux/spec-format.md` and the comment at the top of the script. +- A bash script on git and awk. `lint` checks the format of `.ytstack/spec/`, `drift` lists areas whose `paths` changed after the description or one of its `sources` was last touched, `impact` checks a task plan's "Spec impact" against what the task changed (with `--base` and `--head` against that commit range only, without the working tree: a lane's branch read from another checkout), `areas` names the area of a path. Rules and exit codes: `docs/ux/spec-format.md` and the comment at the top of the script. - `drift` is advisory and exits 0 unless `--exit-code` is given. It never reads `verified_at`; an area file that is new or edited in the working tree is skipped. - `lint` fails on an `auto_merge` outside `none`, `low` and `normal`, on a `REVIEW.md` that `SPEC.md` does not link, and on every line `bin/ytstack-risk check` prints. `REVIEW.md` is not an area file: `drift`, `impact` and `areas` do not read it. @@ -94,7 +94,7 @@ Everything that tells a contributor whether a change is acceptable: the static c - `bin/ytstack-frontier`: `list` prints lane, state and detail per slice (done, claimed, blocked, ready) of the current milestone (with `none`: the highest roadmap not `done`, `dropped`, `shipped-informally` or `backlog`), then one lesson lane `lesson-F###` per open or planned lesson whose target is a check (blocked without non-empty "Files" and "Verification" in the lesson; listed also without a milestone); `claim` refuses a held lane and names the holder; `claim`, `set` and `release` change one row of `LANES.md` under a lock; `check` validates the file. The lock is the file `LANES.md.lock`, created by the shell under noclobber and not by `mkdir`, which is no lock on Ubuntu 26.04 (see `.ytstack/KNOWLEDGE.md`). - `bin/ytstack-plans` (`docs/ux/external-plans.md`): `scan` counts the work rows (task-list items, rows of tables with a status or checkbox column, nothing in a code fence) of `plans/`, `roadmap/` and their variants and prints one line per directory with `verdict=large` from 10 open rows and the answer recorded in `PREFERENCES.md`; exit 0 only for a large directory without an answer. `rows` prints `path:line`, state, id, section and title per row; a relative PATH is read from where the command was started, else from the repository root, and the output names files relative to the root. It writes nothing; the mapping is the agent's (`reconcile`, `adopt-brownfield`). - `bin/ytstack-questions`: `new`, `list`, `next`, `ask` (once), `answer` (refused without text under "Answer"), `check`. -- `bin/ytstack-finish-lane`: one step per call (`leftovers`, `commit`, `push`, `open-pr`, `wait-head`, `body-check`, `gates`, `merge`, `route`); every gate is read from GitHub through `gh` at the moment of the call, and `merge` passes the reviewed commit to the host so that a moved head cannot be merged. `route --lane [--pr ]` reads the lane's worker (the author) and plan from `LANES.md` and runs `bin/ytstack-risk route`; with `--pr` it passes the pull request on, and a lane without a plan file is routed from the host's reviews. `leftovers` and `commit` leave the evidence directory out. Its suite uses a stand-in for `gh` and a local bare remote. +- `bin/ytstack-finish-lane`: one step per call (`leftovers`, `commit`, `push`, `open-pr`, `wait-head`, `body-check`, `gates`, `merge`, `route`); every gate is read from GitHub through `gh` at the moment of the call, and `merge` passes the reviewed commit to the host so that a moved head cannot be merged. `route --lane [--pr ] [--report ]` reads the lane's worker (the author) and plan from `LANES.md` and runs `bin/ytstack-risk route`; with `--pr` it passes the pull request on, and a lane without a plan file is routed from the host's reviews. With a technical spec it then checks the spec delta and prints `spec:` lines: every plan of the lane with a "Spec impact" (a slice lane's task plans too) through `ytstack-spec impact --base --head`; without one, every area the diff touches needs its area file or a source in the diff, or `Spec: none -- ` in the worker's report; a path the report names must be in the diff. Each gap is a `reason: spec` line and turns `unattended` into `person` (exit 10). `leftovers` and `commit` leave the evidence directory out. Its suite uses a stand-in for `gh` and a local bare remote. - `bin/ytstack-handover`: `new` copies `skills/handover-step/template.sh`; `check` is the static verification of a staged script (syntax, unchanged helper block, no raw command, a confirmation of its own before every mutation, no pipe into a shell). The helpers hold the same rule when the script runs: one yes carries one change. - `bin/ytstack-watch`: polls pull requests through `gh` and prints a line only when head, checks, review or mergeability changed; `--once` prints the snapshot with its read time. `release --commit ` runs `deployed` of "Release" until it names the commit (or `--timeout`, default 900 s), then `healthy` for the settle time, and ends with five receipt lines (`Target:`, `Commit:`, `Arrived:`, `Health:`, `Result:`) with read times. Exit 0 released or no health command, 2 not arrived, 3 unhealthy, 4 no "Release" section, 1 `RUNTIME.md` fails its check. It runs only those two commands and changes nothing. diff --git a/.ytstack/spec/skills.md b/.ytstack/spec/skills.md index db359330..967a29f8 100644 --- a/.ytstack/spec/skills.md +++ b/.ytstack/spec/skills.md @@ -107,7 +107,7 @@ Formats: `docs/ux/coordinator-format.md`. The four skills below are for the sess - `coordinate` is a loop with a fixed order: start from the standing instructions (the entries of `standing/` in the resolved `YT_DIR`, project or user scope, newest first without superseded ones, and `STANDING.md`), `LANES.md`, the frontier and the questions (never from a conversation summary), read host facts fresh and stamp them with their read time, claim a lane before dispatching it, finish lanes through `finish-lane`, run the factory tools of Step 7 (one table of command, when and skip condition; the preamble prints `MERGE_BY`, `REVIEW_POLICY`, `OWN_REVIEWERS`, `PR_WATCH` with the heartbeat age, `RELEASE` and `SIGNALS`): the route before every merge, also one it makes itself outside `finish-lane` (then through `ytstack-finish-lane merge` and `finish-lane`'s rule of who merges), with the PR watch on (flag set and a worker heartbeat under 10 minutes old) register the repository's open pull requests to itself as their owning session (`ytstack-pr-watch register --all-open` without `--session`, at the start, after every restart or rotation and after a worker opened one) and otherwise poll through `bin/ytstack-watch`, `ytstack-watch release` after every merge to production, `signal-intake` / `incident` for signals and `review-lessons` after a merge with a bot finding, `lesson` on a red `main` and on every slip of a lane or its own (the open lessons in every status from the preamble's `LESSONS` line, a lesson proposal asked with the daily question, lesson lanes `lesson-F###` dispatched from the frontier with `ytstack-brief render --lesson` and set `fixed` after their merge), ask one question at a time from a question file, write a standing instruction down when it is given (a new file in `standing/`; `STANDING.md` only where no `standing/` exists), stop a lane that failed verification twice or needs a third review, and rotate after the first compaction in one step while lanes run: a handoff written from the files with the "Rotation" block of `docs/ux/coordinator-format.md` (PR watch session, background watches, each running worker's address), the successor's Step 3 takes the PR watches over with `ytstack-pr-watch handover --from `, and the old session stays open only as a relay that appends its workers' reports to `HANDOFF.md`. - `spawn-milestone-team` claims each lane with `bin/ytstack-frontier` before it dispatches, keeps the lane's row current, and looks at the frontier again whenever a lane is verified or merged. -- `finish-lane` takes a reported lane to a merged pull request with `bin/ytstack-finish-lane`: review pinned to the host's head, the required lenses, `route`, the gates read from the host, the merge decided by `merge_by` and the route, then `bin/ytstack-watch release` on the merge commit when `RUNTIME.md` has a "Release" section (in the background; the receipt goes into the report, nothing is rolled back). A merge without a person is reported in one line with class, ceiling and lenses. After a merge it made itself, and when `REVIEW.md` declares own reviewers, it invokes `review-lessons` for the pull request. Before a lane goes back for a review that requested changes, a failed lens or a failed check, it invokes `lesson` (its Step 14). These two are the skills it may invoke. The pipeline supports GitHub through `gh` only; on another host the skill stops after the route. +- `finish-lane` takes a reported lane to a merged pull request with `bin/ytstack-finish-lane`: review pinned to the host's head, the required lenses, `route` with the worker's report (its spec delta is checked against the diff, so a lane that skipped `summarize-task` and changed an area without its description or a reason goes to a person, under `merge_by: coordinator` back to the worker), the gates read from the host, the merge decided by `merge_by` and the route, then `bin/ytstack-watch release` on the merge commit when `RUNTIME.md` has a "Release" section (in the background; the receipt goes into the report, nothing is rolled back). A merge without a person is reported in one line with class, ceiling and lenses. After a merge it made itself, and when `REVIEW.md` declares own reviewers, it invokes `review-lessons` for the pull request. Before a lane goes back for a review that requested changes, a failed lens or a failed check, it invokes `lesson` (its Step 14). These two are the skills it may invoke. The pipeline supports GitHub through `gh` only; on another host the skill stops after the route. - **The class of a change.** `code-review` prints the floor of `bin/ytstack-risk` and has a reviewer that is not the author end with `Risk:`, `Severity:`, `Reach:` and `Invariants touched:`, read against "Invariants and security boundaries" and "Decisions that apply now" of the touched areas, also when only code moved. The round line records class, invariants and reviewer; a session reviewing its own change writes `by: self`, which routes to a person. On a pull request `finish-lane` and `code-review` post the round and lens lines in the body of a review on the reviewed head, and `finish-lane` routes with `--pr`: the record needs no commit that would move the head away from a head-bound review. Each lens the floor names gets a separate fresh reviewer with the lens brief (`bin/ytstack-brief render --kind review --lens `) and one lens line. - `visual-review` is the lens reviewer of a user interface change: its own worktree at the reviewed commit, `bin/ytstack-runtime up`, a browser tool that renders and returns screenshots, its own screenshots of the changed views, states and two widths, reviewed against the lens documents; evidence with `MANIFEST` in the main checkout. It is `not run`, never `pass`, when the reviewer is the author, a document or the "Run" section is missing, the product does not come up or no browser tool exists. It edits no product file. - `signal-intake` reads every source of "Signals" once with its read time, separates findings from noise by stated rules, records through `bin/ytstack-signals new` (an unreadable source is a finding too) and changes nothing else. `incident` puts the mitigation before the cause: facts with read times, timeline, hypotheses, mitigations as handover scripts it never runs, one question at a time, and never picks a mitigation without a person; once mitigated it records the lesson through `lesson` with `--incident`, and the cause goes to `systematic-debugging` afterwards, which records the cause's lesson the same way. diff --git a/CHANGELOG.md b/CHANGELOG.md index 24769d54..767fe5b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 plan beside the slice plan, in `plan-task`'s format (Files, What this does, Spec impact, Verification), committed alone, then the files it names. A slice brief names the plan file to write per unplanned task. +- **`finish-lane` checks the spec delta before a merge without you** (issue + #75): `ytstack-finish-lane route --report ` runs `ytstack-spec impact` + on the lane's commits for every plan that states a "Spec impact"; without + one, every area the diff touches needs its area file or a source in the + diff, or `Spec: none -- ` in the worker's report. A gap prints + `reason: spec -- ...` and turns `unattended` into `person`, so a lane that + skipped `summarize-task` is still caught. `ytstack-spec impact` takes + `--head` to check a commit range that is not checked out. `finish-lane` + 0.6.0. ## [0.11.0] - 2026-11-15 diff --git a/bin/ytstack-finish-lane b/bin/ytstack-finish-lane index 84f53ee4..be3593d0 100755 --- a/bin/ytstack-finish-lane +++ b/bin/ytstack-finish-lane @@ -13,7 +13,7 @@ # [--verdict-pattern ERE] [--allow-no-checks] # ytstack-finish-lane merge --pr N --at SHA [--method squash|merge|rebase] # [--max-open N] [--verdict-pattern ERE] [--allow-no-checks] -# ytstack-finish-lane route --lane REF --base SHA --head SHA [--pr N] +# ytstack-finish-lane route --lane REF --base SHA --head SHA [--pr N] [--report F] # # All commands take -C DIR first: the lane's worktree (default: $PWD). A # relative --body-file is read from where the command was started. For route @@ -77,6 +77,15 @@ # plan is routed from them; without --pr a lane without a plan has # no review record: "route: person". The evidence directory of a # visual lens is read from the main checkout of the repository. +# Then the spec delta (issue #75), when the project has a +# technical spec: each plan of the lane that states a "Spec +# impact" is checked with `ytstack-spec impact` on --base..--head; +# without one, every area whose paths the diff touches needs its +# area file or a source in the diff, or "Spec: none -- " +# in the worker's report (--report F). A path the report names +# as edited must be in the diff. Printed as "spec:" lines; each +# gap is a "reason: spec -- ..." line and turns "unattended" into +# "person". # # Exit codes: 0 done; 1 refused or a gate does not hold (the reason is # printed); 64 usage. route: 0 "route: unattended"; 10 "route: person"; 65 git @@ -483,14 +492,111 @@ cmd_merge() { } # ---- route --------------------------------------------------------------------- +# touched_by : is the path, or a file under it, in CHANGED? +touched_by() { + local p s="${1%/}" + while IFS= read -r p; do + case "$p" in "$s"|"$s"/*) return 0 ;; esac + done < : whether the technical spec +# moved with the change (issue #75). Prints "spec: ..." lines for what holds and +# one "reason: spec -- ..." line per gap; returns 1 when there is a gap. In +# order: the impact every plan of the lane states (bin/ytstack-spec impact on +# base..head; a slice lane's task plans too), the paths the report's "Spec:" +# line names (each must be in the diff), and, when no plan states an impact, +# every area whose paths the diff touches: its area file or a source changed, +# or the report says "none -- ". The area files are read from this +# checkout's working tree. +spec_delta() { + local lane="$1" base="$2" head="$3" report="$4" spec="$SELF_DIR/ytstack-spec" bad=0 stated=0 + local claim="" p out ec l e a ep f s hit why + [ -f "$YT_DIR/spec/SPEC.md" ] || { echo "spec: no technical spec"; return 0; } + [ -f "$spec" ] || { echo "reason: spec -- bin/ytstack-spec is not next to this script: the spec delta is unknown"; return 1; } + CHANGED=$(git -c core.quotePath=false diff --name-only "$base..$head" 2>/dev/null) + [ -z "$report" ] || claim=$(sed -n 's/^Spec:[ \t]*//p' "$report" | head -1) + + while IFS= read -r p; do + [ -n "$p" ] || continue + out=$(bash "$spec" -C "$TOP" impact --plan "$p" --base "$base" --head "$head" 2>&1); ec=$? + case "$ec" in + 3) continue ;; + 0) stated=1; echo "spec: ${p#"$TOP"/} -- $(printf '%s\n' "$out" | grep -v '^$' | tr '\n' ';' | sed 's/;$//; s/;/; /g')" ;; + *) stated=1; bad=1 + while IFS= read -r l; do + case "$l" in FAIL*|UNVERIFIABLE*|impact:*) echo "reason: spec -- ${p#"$TOP"/}: $l" ;; esac + done </dev/null) + [ -n "$hit" ] || { echo "spec: no area covers the changed paths"; return "$bad"; } + for a in $hit; do + f="$YT_DIR/spec/$a.md"; why="" + case "$f" in "$TOP"/*) f=${f#"$TOP"/} ;; *) + echo "reason: spec -- $a: $f lies outside the repository, the diff cannot show its edit"; bad=1; continue ;; + esac + for s in "$f" $(yt_fm "$TOP/$f" | awk -F'\t' '$1 == "sources" { print $2 }'); do + touched_by "$s" && { why="$s changed"; break; } + done + if [ -z "$why" ]; then + case "$claim" in + [Nn]one\ --*) why="unchanged -- ${claim#* -- } (the worker's report)" ;; + *) while IFS= read -r e; do + e=$(printf '%s' "$e" | sed 's/^[ \t]*//'); ep=${e#*: }; ep=${ep%% *} + [ "${e%%:*}" = "$a" ] && touched_by "$ep" && { why="$ep changed (the worker's report)"; break; } + done <\" in the report given with --report)" + bad=1 + fi + done + return "$bad" +} + cmd_route() { - local lane="" base="" head="" pr="" author="" plan="" shown root + local lane="" base="" head="" pr="" report="" author="" plan="" shown root r ec s while [ $# -gt 0 ]; do [ $# -ge 2 ] || bad_usage "$1 needs a value" case "$1" in --lane) lane="$2" ;; --base) base="$2" ;; --head) head="$2" ;; + --report) report=$(abs "$2"); [ -r "$report" ] && [ ! -d "$report" ] || bad_usage "cannot read report '$2'" ;; --pr) pr="$2"; is_int "$pr" || bad_usage "--pr is a pull request number" ;; *) bad_usage "route: unknown argument '$1'" ;; esac @@ -530,8 +636,16 @@ cmd_route() { [ -z "$plan" ] || set -- "$@" --plan "$plan" [ -z "$pr" ] || set -- "$@" --pr "$pr" [ -z "$author" ] || set -- "$@" --author "$author" - bash "$SELF_DIR/ytstack-risk" "$@" - exit $? + r=$(bash "$SELF_DIR/ytstack-risk" "$@"); ec=$? + # A gap in the spec delta keeps the change from merging without a person. + if [ "$ec" -eq 0 ] || [ "$ec" -eq 10 ]; then + if ! s=$(spec_delta "$lane" "$base" "$head" "$report") && [ "$ec" -eq 0 ]; then + r=$(printf '%s\n' "$r" | sed '1s/^route: unattended$/route: person/'); ec=10 + fi + fi + printf '%s\n' "$r" + [ -z "${s:-}" ] || printf '%s\n' "$s" + exit "$ec" } case "$CMD" in diff --git a/bin/ytstack-spec b/bin/ytstack-spec index 5f3e8097..e06e5c7e 100755 --- a/bin/ytstack-spec +++ b/bin/ytstack-spec @@ -3,8 +3,10 @@ # # ytstack-spec lint format of .ytstack/spec/ (SPEC.md + area files) # ytstack-spec drift [--exit-code] areas whose paths changed after their description -# ytstack-spec impact --plan FILE [--grep ERE] [--base SHA] +# ytstack-spec impact --plan FILE [--grep ERE] [--base SHA [--head SHA]] # a task's "## Spec impact" against what it changed +# (--head: only the commits base..head, not the +# working tree; for a lane's branch) # ytstack-spec areas [--names] PATH... which area describes a path (--names: the area names only) # # All commands take -C DIR first (default: $PWD). @@ -49,7 +51,7 @@ DIR="$PWD" if [ "${1:-}" = "-C" ]; then DIR="${2:-}"; shift 2 || true; fi CMD="${1:-}"; [ $# -gt 0 ] && shift -usage() { sed -n '2,12p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; } +usage() { sed -n '2,14p' "${BASH_SOURCE[0]}" | sed 's/^# \{0,1\}//'; } case "$CMD" in lint|drift|impact|areas) ;; -h|--help|help) usage; exit 0 ;; *) usage >&2; exit 64 ;; esac yt_git_ctx "$DIR" @@ -306,18 +308,20 @@ EOF # ---- impact -------------------------------------------------------------------- cmd_impact() { - local plan="" pat="" base="" body first line area f changed committed fails=0 unver=0 hit how s first_ct="" + local plan="" pat="" base="" head="" body first line area f changed committed fails=0 unver=0 hit how s first_ct="" while [ $# -gt 0 ]; do [ $# -ge 2 ] || { echo "impact: $1 needs a value" >&2; return 64; } case "$1" in --plan) plan="$2" ;; --grep) pat="$2" ;; --base) base="$2" ;; + --head) head="$2" ;; *) echo "impact: unknown argument $1" >&2; return 64 ;; esac shift 2 done [ -f "$plan" ] || { echo "impact: plan file '$plan' not found" >&2; return 64; } + [ -z "$head" ] || [ -n "$base" ] || { echo "impact: --head needs --base" >&2; return 64; } body=$(awk ' /^```/ { fence = !fence } @@ -339,8 +343,13 @@ cmd_impact() { # Paths come as NUL-delimited records (-z): the plain output quotes a name # with a space or a non-ASCII byte, and a quoted name never equals the path # a plan or an area file names. - committed="" - if [ "$YT_IS_GIT" = yes ]; then + committed=""; changed="" + if [ "$YT_IS_GIT" = yes ] && [ -n "$head" ]; then + # A range that need not be checked out (a lane read from the coordinating + # checkout): its commits only, the working tree belongs to somebody else. + committed=$(git -C "$TOP" diff --name-only -z "$base..$head" 2>/dev/null | nul_paths) + first_ct=$(git -C "$TOP" log --format='%ct %h' "$base..$head" 2>/dev/null | tail -1) + elif [ "$YT_IS_GIT" = yes ]; then if [ -n "$pat" ]; then committed=$(git -C "$TOP" log --no-merges -E --grep "$pat" --name-only -z --format= 2>/dev/null | nul_paths) first_ct=$(git -C "$TOP" log --no-merges -E --grep "$pat" --format='%ct %h' 2>/dev/null | tail -1) @@ -350,8 +359,6 @@ cmd_impact() { first_ct=$(git -C "$TOP" log --format='%ct %h' "$base..HEAD" 2>/dev/null | tail -1) fi changed=$(git -C "$TOP" status --porcelain -z --untracked-files=all 2>/dev/null | status_paths) - else - changed="" fi # outside_when : the file's modification time against the task's first diff --git a/docs/ux/coordinator-format.md b/docs/ux/coordinator-format.md index 89685b60..1c9677c3 100644 --- a/docs/ux/coordinator-format.md +++ b/docs/ux/coordinator-format.md @@ -97,7 +97,7 @@ Outcome: Commits: ..HEAD, or "none"> Uncommitted: Checks run: -- exit at in -Spec: +Spec: : (
); ... | none -- Deviations: Blockers: Not checked: @@ -106,6 +106,8 @@ Next: `partial` and `blocked` are values of `Status:`, never a word in a paragraph. `Status: blocked` needs a `Blockers:` value other than `none`; `Status: complete` needs `Blockers: none`. +`Spec:` is the **spec delta**: what the change did to the technical spec (`docs/ux/spec-format.md`). Either one entry per edited section, `: (
)` with the area file or the source it names, several joined by `;`, or `none -- ` with a reason from the plan rule (restores the described behaviour, no behaviour or contract changes, not covered by an area). It is the worker's side of the plan's `## Spec impact`: the plan says what will change, the report what did. A bare `none` and prose without a path are no delta. `finish-lane` checks the delta against the diff before a merge without a person (`bin/ytstack-finish-lane route --report`). + ## `questions/` -- what only the human can decide One file per pending question: `.ytstack/questions/Q###-.md`. @@ -224,6 +226,6 @@ The old session stays open as a relay until every listed worker has reported. Pe - `bin/ytstack-frontier check`: `LANES.md` has the ten columns, lane references are unique, `Status` and `Kind` hold listed values, a held lane has a claim time. - `bin/ytstack-questions check`: ids are unique and match the file name, `state` holds a listed value, `asked` and `answered` are set exactly when the state says so, an answered file has text under `## Answer`. -- `bin/ytstack-brief check`: the report labels, the three `Status:` values and their consistency with `Blockers:`. +- `bin/ytstack-brief check`: the report labels, the three `Status:` values and their consistency with `Blockers:`, and the form of the spec delta under `Spec:`. - `bin/ytstack-handover check`: the staged script of a human-only step (see `skills/handover-step/SKILL.md`). - `bin/ytstack-check --standing []`: every entry in `standing/` has a name of the form above with a date and time that exist, `given` as an existing ISO UTC time in the minute of its name, a `scope` and a body, and every `supersedes` names an earlier entry that exists (missing seconds count as `00`). Without a directory argument it resolves `.ytstack` like the skill preambles, user scope included. diff --git a/docs/ux/review-policy-format.md b/docs/ux/review-policy-format.md index cf74af53..30767b7b 100644 --- a/docs/ux/review-policy-format.md +++ b/docs/ux/review-policy-format.md @@ -281,7 +281,7 @@ The route is `unattended` only when all of this holds: 3. The class (the higher of floor and stated risk) is not above the ceiling of the touched areas. A change that touches no area has the ceiling `none`. 4. Every required lens has a newest line with `pass` that is valid for the head, from a reviewer other than the author, and its `reads` documents exist at the head. For `evidence: visual` the directory the line names holds a `MANIFEST` with at least one image; every listed image is there with the listed SHA-256, and its line states `url`, `viewport` and `shows`. -The route reads the host only for the review records, and only with `--pr`; it says nothing about the host's gates. `finish-lane` reads the host's gates (checks, review threads, mergeability, the reviewed commit) as before, and merges on its own only when both hold and `merge_by` is `risk`. +The route reads the host only for the review records, and only with `--pr`; it says nothing about the host's gates. `finish-lane` reads the host's gates (checks, review threads, mergeability, the reviewed commit) as before, and merges on its own only when both hold and `merge_by` is `risk`. Its own `route` (`bin/ytstack-finish-lane route`) adds the spec delta: a change to an area's paths without its area file or a source in the diff, without a plan that states the impact and without `Spec: none -- ` in the worker's report is `person` (`docs/ux/spec-format.md`, "Before a merge"). | `merge_by` | Who merges | |---|---| diff --git a/docs/ux/spec-format.md b/docs/ux/spec-format.md index 729c8924..42f3ecbd 100644 --- a/docs/ux/spec-format.md +++ b/docs/ux/spec-format.md @@ -159,6 +159,10 @@ A spec in user scope (`~/.ytstack/projects//spec/`) lies outside the reposi The summary records what was updated under `## Spec`: the area, the file and section, or `none` with the plan's reason. +### Before a merge + +A dispatched worker states the spec delta in its report's `Spec:` line: the edited sections as `: (
)`, or `none -- ` (`docs/ux/coordinator-format.md`, "The report"). `bin/ytstack-finish-lane route` checks it against the lane's diff before a merge without a person, so a lane that never ran `summarize-task` is still caught: each plan of the lane with a `## Spec impact` goes through `impact` on the commit range; without one, every area whose paths the diff touches needs its area file or a source in the diff, or the report's reason. A path the report names as edited has to be in the diff. A gap sends the change to a person. + ### Drift `bin/ytstack-spec drift` compares, for every area that is not `planned`, the commits that touched its `paths` with the last commit that touched the area file or one of its `sources`. When code changed after that commit, it prints a **possible documentation impact**. That is a prompt to look, not a finding that the description is wrong: a refactoring changes paths and leaves the contract alone. diff --git a/skills/finish-lane/SKILL.md b/skills/finish-lane/SKILL.md index cf52a6ce..682d3550 100644 --- a/skills/finish-lane/SKILL.md +++ b/skills/finish-lane/SKILL.md @@ -3,7 +3,7 @@ name: finish-lane description: "Takes a delegated lane from the worker's report to a pull request merged at the reviewed commit, with every gate read from the host. Use in the coordinating session when a lane reported and its work has to become a merged pull request, or when the user says finish the lane, land this lane, get this lane merged. Not for the session's own branch (finish-branch), not for a release (ship) and not for the worker of the lane." metadata: tier: task - version: 0.5.0 + version: 0.6.0 allowed-tools: - Bash - Read @@ -41,7 +41,7 @@ You MUST create a TodoWrite task for each of these items and complete them in or 6. **Commission the review** -- a `review` lane pinned to that commit, in a fresh context; at most two rounds 7. **Post the review, record head and round** -- on the pull request with the round line in its body, then `ytstack-frontier set`, then the same line in the lane's plan where you may write 8. **Dispatch the required lenses** (only if `floor` names some) -- one fresh reviewer per lens with the lens brief, the lens lines posted as a review and in the lane's plan -9. **Read the route** -- `route --pr`: `unattended`, or `person` with its reasons +9. **Read the route** -- `route --pr --report`: `unattended`, or `person` with its reasons, the spec delta among them 10. **Read the gates** -- `gates`; a failing gate is handled by what it is 11. **Merge or hand over** -- `MERGE_BY: risk` with route `unattended`, or `coordinator`: `merge`; every other case: stop with the command and the reasons 12. **Watch the release** (only after a merge, by anyone) -- `ytstack-watch release --commit `; the receipt goes into the report; `not arrived` and `unhealthy` go to the person at once @@ -179,7 +179,7 @@ Read the standing instructions in full now, before anything is pushed: every fil ### Step 3: Read the report, commit leftovers -Read the worker's report by its labels (`docs/ux/coordinator-format.md`, "The report"). A report that has not passed `bin/ytstack-brief check` yet is checked first. `Status:` other than `complete` is not finished work: the lane goes back to whoever dispatched it, with the `Blockers:` value. +Read the worker's report by its labels (`docs/ux/coordinator-format.md`, "The report"). A report that has not passed `bin/ytstack-brief check` yet is checked first. `Status:` other than `complete` is not finished work: the lane goes back to whoever dispatched it, with the `Blockers:` value. Save the report as it came to a file outside the worktree, `{REPORT_FILE}`: Step 9 checks its `Spec:` line, the spec delta, against the diff. A `prepare` lane commits nothing by design, and any lane can leave files behind. If the lane's kind is `prepare` or `Uncommitted:` is not `none`: @@ -337,10 +337,12 @@ Post the lens lines as one more review on the pull request (`gh pr review {N} -- Whether a person has to look at this change is decided per change, from its risk (`docs/ux/review-policy-format.md`, "The route"). Run this in the checkout of this session, without `-C {WT}`: it reads `LANES.md` and the lane's plan here, and the reviews of the pull request on the host. ```bash -"${CLAUDE_SKILL_DIR}/../../bin/ytstack-finish-lane" route --lane {REF} --base {BASE_SHA} --head {SHA} --pr {N} +"${CLAUDE_SKILL_DIR}/../../bin/ytstack-finish-lane" route --lane {REF} --base {BASE_SHA} --head {SHA} --pr {N} --report {REPORT_FILE} ``` -On a host other than GitHub leave out `--pr`: the plan is then the only record. The first line says what it read: the lane, the worker of its row as the author, the plan, the pull request. Then come the lines of `bin/ytstack-risk route`: `route: unattended` or `route: person`, `class:`, `ceiling:`, `floor:`, `areas:`, `lenses:`, `round:` (where the round line came from: a review on the host, the plan, or none), and one `reason:` per condition that failed. Exit 0 means `unattended`. Everything else, an error included, means "not unattended". Keep the lines for the report. +On a host other than GitHub leave out `--pr`: the plan is then the only record. The first line says what it read: the lane, the worker of its row as the author, the plan, the pull request. Then come the lines of `bin/ytstack-risk route`: `route: unattended` or `route: person`, `class:`, `ceiling:`, `floor:`, `areas:`, `lenses:`, `round:` (where the round line came from: a review on the host, the plan, or none), and one `reason:` per condition that failed. Last come the `spec:` lines of the spec delta. Exit 0 means `unattended`. Everything else, an error included, means "not unattended". Keep the lines for the report. + +**The spec delta.** With a technical spec, `route` checks itself that the spec moved with the change, also for a lane that never ran `summarize-task`: every plan of the lane that states a `## Spec impact` (a slice lane's task plans too) is checked with `bin/ytstack-spec impact` on `{BASE_SHA}..{SHA}`; without such a plan, every area whose paths the diff touches needs its area file or one of its `sources` in the diff, or `Spec: none -- ` in the report. A path the report names as edited has to be in the diff. Each gap is a `reason: spec -- ...` line and makes the route `person`. The repair is the worker's: edit the section the change made false, or state the reason in the report, and the fix round follows. You do not edit the area file and you do not write the reason for the worker. `unattended` needs all of this: a floor from the diff that is not `person`; a newest round line that approves, is valid for `{SHA}`, states `risk` and `invariants: none`, and names a reviewer other than the lane's worker; a class within the ceiling (`auto_merge`) of every area the change touches; and for every required lens a newest line that says `pass`, comes from a reviewer other than the worker, is valid for `{SHA}` and, for a visual lens, names an evidence directory whose `MANIFEST` matches its images. A project that declared nothing gets `person` for every change, which is what `merge_by: human` does. @@ -374,7 +376,7 @@ Who merges is the project's decision, not this session's. It is read from `MERGE | `risk` (the default) | `unattended` | You merge at `{SHA}`. The person gets one line in the report: what merged without them, at which class, under which ceiling, with which lenses. | | `risk` | `person`, or no answer | Stop. A person merges; they get the command and the `reason:` lines. | | `human` | any | Stop. A person merges; the route lines go along for information. | -| `coordinator` | any | You merge at `{SHA}`. The route is printed in the report and not applied. | +| `coordinator` | any | You merge at `{SHA}`. The route is printed in the report and not applied, except a `reason: spec` line: that lane goes back to the worker first. | A standing instruction that reserves the merge wins over every row: a person merges. @@ -443,6 +445,7 @@ A review that requested changes, a lens that failed and a check that failed are > - review: round {n}, {verdict}, at {SHA}; risk {the reviewer's class}, invariants {none | what it named} > - lenses: {per lens: verdict, reviewer, evidence directory | none required} > - route: {unattended | person}, class {class}, ceiling {ceiling}, round from {the `round:` value}; {the `reason:` lines, or "no reason"} +> - spec: {the `spec:` lines of the route} > - gates: {the gate lines}, read {UTC time} > - merge: {merged unattended at : class , ceiling , lenses | merged at (merge_by: coordinator, the route said ) | ready, a person merges: ; because: | not ready: } > - release: {the five receipt lines | watching since | not watched: | nothing merged} diff --git a/tests/ytstack-finish-lane.test.sh b/tests/ytstack-finish-lane.test.sh index 7601c4fb..cc9e7355 100644 --- a/tests/ytstack-finish-lane.test.sh +++ b/tests/ytstack-finish-lane.test.sh @@ -24,7 +24,9 @@ # host is read without --pr; the evidence of a visual lens is # read from the main checkout, also when the session works in a # linked worktree; with --pr the round comes from the review on -# the host, also for a lane without a plan +# the host, also for a lane without a plan; with a technical +# spec a change to an area's paths without its area file, a +# plan's impact or a reason in the report (--report) is "person" # usage exit 64 # # The host is a fake `gh` first in PATH that answers from fixture files and @@ -493,6 +495,56 @@ has "the plan is named as the source" "round: plan" "$OUT" quiet; run "$RT" route --lane M001-S01 --base "$RB" --head "$RH" --pr seven eq "a pull request that is no number: exit 64" 64 "$EC" +# The spec delta (issue #75): with a technical spec, a change to an area's +# paths needs an edited area file, a plan that states the impact, or a reason +# in the worker's report; otherwise it does not merge without a person. +RS="$TMP/routes"; mkdir -p "$RS/src" "$RS/.ytstack/spec" +( cd "$RS" || exit 1 + git init -q -b main && git config user.email t@t.t && git config user.name t && git config commit.gpgsign false || exit 1 + echo a > src/a.sh + printf -- '---\nproject: p\n---\n\n# p\n\n## Areas\n\n| Area | File |\n|---|---|\n| core | [core.md](core.md) |\n\n## Keeping this true\n\n- x\n' > .ytstack/spec/SPEC.md + printf -- '---\narea: core\nstatus: implemented\npaths:\n - src/**\nauto_merge: low\n---\n\n# core\n\n## Behavior\n\n- a\n\n## Invariants and security boundaries\n\n- x\n\n## Decisions that apply now\n\n- none\n' > .ytstack/spec/core.md + git add -A && git commit -qm base + git checkout -q -b code && echo b >> src/a.sh && git commit -qam "M001-S01-T01: change a" + git checkout -q -b documented && awk '{ print } /^- a$/ { print "- b" }' .ytstack/spec/core.md > core.tmp && mv core.tmp .ytstack/spec/core.md && git commit -qam "M001-S01-T01: describe b" + git checkout -q main ) >/dev/null 2>&1 +SB=$(git -C "$RS" rev-parse main); SC=$(git -C "$RS" rev-parse code); SD=$(git -C "$RS" rev-parse documented) +printf -- '---\nupdated: 2026-11-13T10:00:00Z\n---\n\n# Lanes\n\n| Lane | Kind | Status | Claimed by | Branch | Worktree | PR | Reviewed head | Round | Next action |\n|---|---|---|---|---|---|---|---|---|---|\n| M001-S01 | implement | in-review | impl-M001-S01 2026-11-13T09:00Z | code | - | 7 | - | 1 | - |\n' > "$RS/.ytstack/LANES.md" +# splan : the slice plan with an approving round on that head +splan() { + printf -- '---\nstatus: in-progress\n---\n\n# Slice Plan\n\n## Review\n\n- Round 1: %s..%s -- approved; blocking: 0; follow-ups: 0; risk: low; invariants: none; by: review-M001-S01\n' "${SB:0:7}" "${1:0:7}" > "$RS/.ytstack/M001-S01-PLAN.md" +} +# report : a worker's report with that Spec: line +report() { printf 'Task: M001-S01\nStatus: complete\nSpec: %s\nNext: review\n' "$1" > "$TMP/report.md"; } +sroute() { quiet; run "$RS" route --lane M001-S01 --base "$SB" --head "$1" ${2:+--report "$TMP/report.md"}; } + +splan "$SC"; sroute "$SC" +eq "code changed, no plan states an impact, no report: exit 10" 10 "$EC" +has "the route is person" "route: person" "$OUT" +hasnt "and never unattended" "route: unattended" "$OUT" +has "the spec delta is the reason" "reason: spec -- core: the change touches its paths, neither .ytstack/spec/core.md nor its sources changed" "$OUT" +report "none -- no behaviour or contract changes"; sroute "$SC" r +eq "the report states why the spec is unchanged: exit 0" 0 "$EC" +has "the reason is printed" "spec: core unchanged -- no behaviour or contract changes (the worker's report)" "$OUT" +report "core: .ytstack/spec/core.md (Behavior)"; sroute "$SC" r +eq "the report names an edit the diff does not have: exit 10" 10 "$EC" +has "and says so" "reason: spec -- the report names .ytstack/spec/core.md, which the change does not touch" "$OUT" +splan "$SD"; sroute "$SD" +eq "the lane edited the area file: exit 0" 0 "$EC" +has "and the edit is named" "spec: core -- .ytstack/spec/core.md changed" "$OUT" +splan "$SC" +printf -- '---\ntask: T01\n---\n\n# plan\n\n## Files\n\n- `src/a.sh`\n\n## Spec impact\n\n- core: Behavior -- b\n' > "$RS/.ytstack/M001-S01-T01-PLAN.md" +report "none -- no behaviour or contract changes"; sroute "$SC" r +eq "a task plan names the area and the lane did not edit it: exit 10, the report does not override the plan" 10 "$EC" +has "the impact check is the reason" "reason: spec -- .ytstack/M001-S01-T01-PLAN.md: FAIL core: neither .ytstack/spec/core.md nor its sources" "$OUT" +printf -- '---\ntask: T01\n---\n\n# plan\n\n## Files\n\n- `src/a.sh`\n\n## Spec impact\n\nnone -- restores the described behaviour\n' > "$RS/.ytstack/M001-S01-T01-PLAN.md" +sroute "$SC" +eq "the task plan states none with a reason: exit 0" 0 "$EC" +has "and its line is printed" "spec: .ytstack/M001-S01-T01-PLAN.md -- spec impact: none -- restores the described behaviour" "$OUT" +rm -f "$RS/.ytstack/M001-S01-T01-PLAN.md" +quiet; run "$RS" route --lane M001-S01 --base "$SB" --head "$SC" --report "$TMP/none.md" +eq "a report file that cannot be read: exit 64" 64 "$EC" + # A visual lens. The reviewer stored its images in the main checkout; the # coordinating session works in a linked worktree of the same repository. RV="$TMP/routev"; RW="$TMP/routev-wt"; mkdir -p "$RV/src/ui" "$RV/docs" "$RV/.ytstack/spec" diff --git a/tests/ytstack-spec.test.sh b/tests/ytstack-spec.test.sh index 20c6a24a..ea250c3f 100644 --- a/tests/ytstack-spec.test.sh +++ b/tests/ytstack-spec.test.sh @@ -274,6 +274,22 @@ plan "- auth: Behavior -- a\n- billing: Known limits -- b" run "$R" impact --plan "$P" --base "$BASE" eq "two areas, both satisfied" 0 "$EC" +# --head: a range that is not checked out (a lane's branch, read from the +# coordinating checkout). The working tree is not the lane's and is not read. +LH=$(head_of "$R"); plan "- auth: Behavior -- a" +( cd "$R" && git checkout -q -b lane-x "$BASE" && echo a3 > src/auth/login.sh && git commit -qam "lane: code only" && git checkout -q - ) >/dev/null 2>&1 +LX=$(git -C "$R" rev-parse lane-x) +run "$R" impact --plan "$P" --base "$BASE" --head "$LX" +eq "--head: the lane changed code and no description: exit 1" 1 "$EC" +printf '\nedited\n' >> "$R/.ytstack/spec/auth.md" +run "$R" impact --plan "$P" --base "$BASE" --head "$LX" +eq "--head: an edit in the working tree does not count for the lane" 1 "$EC" +run "$R" impact --plan "$P" --base "$BASE" --head "$LH" +eq "--head: the range BASE..HEAD of another branch counts its own commits" 0 "$EC" +git -C "$R" show HEAD:.ytstack/spec/auth.md > "$R/.ytstack/spec/auth.md.tmp" && mv "$R/.ytstack/spec/auth.md.tmp" "$R/.ytstack/spec/auth.md" +run "$R" impact --plan "$P" --head "$LX" +eq "--head without --base: usage error" 64 "$EC" + # Filenames git quotes in its plain output (a space, a non-ASCII byte) are # compared as the real names: the records are read NUL-delimited. # srcarea : an implemented area whose one source has a space or From d1e7eac1b3c9a7a5f1daeca5ca8a85a3a29bc4e6 Mon Sep 17 00:00:00 2001 From: Alex Wegener Date: Sun, 15 Nov 2026 14:48:14 +0100 Subject: [PATCH 04/20] feat: checks inventory in REVIEW.md, noted by finish-lane and code-review (#75) A ## Checks section lists the machine checks reviewers rely on ( | file: | guards: ), validated by ytstack-risk check. code-review treats a guard added without its line as a finding; finish-lane route prints a checks: line when a change edits CI and the inventory did not move. Co-Authored-By: Claude Opus 5.5 --- .ytstack/DECISIONS.md | 19 +++++++++++++++++++ .ytstack/spec/checks-and-evals.md | 4 ++-- CHANGELOG.md | 10 ++++++++++ bin/ytstack-finish-lane | 21 +++++++++++++++++++-- bin/ytstack-risk | 29 +++++++++++++++++++++++++---- docs/ux/review-policy-format.md | 19 ++++++++++++++++++- skills/code-review/SKILL.md | 4 ++-- skills/finish-lane/SKILL.md | 2 +- tests/ytstack-finish-lane.test.sh | 9 +++++++++ tests/ytstack-risk.test.sh | 12 +++++++++++- 10 files changed, 116 insertions(+), 13 deletions(-) diff --git a/.ytstack/DECISIONS.md b/.ytstack/DECISIONS.md index 850d3d63..4df668c9 100644 --- a/.ytstack/DECISIONS.md +++ b/.ytstack/DECISIONS.md @@ -1277,3 +1277,22 @@ Plus: ops-layer split during the same session (yopstack created as own public re - No technical spec: `spec: no technical spec`, nothing changes. **Supersedes:** None. + +## 2026-11-15: The checks inventory is a `## Checks` section of `REVIEW.md`, not an area file (issue #75) + +**Context:** A guard that a lane added (component levels in CI) was described only in its receipt; reviewers had no place that says which machine checks they can rely on. + +**Options considered:** +- A) `.ytstack/spec/checks.md` as an area file. +- B) A sixth section `## Checks` in `REVIEW.md`: ` | file: | guards: `. + +**Chose:** B. + +**Reason:** An area file describes a part of the system with fixed sections, `paths` and a `status` (`docs/ux/spec-format.md`); an inventory of checks across areas has none of these, and `lint`, `drift` and `impact` would read it as an area. `REVIEW.md` is already the page of what reviewers go by, it is read at the base commit and its changes are `person`, so the inventory cannot be relaxed on the route it informs. + +**How to apply:** +- The line says what holds; the rule itself stays in the area file or its source. +- `ytstack-risk check` checks the form and that `file` exists. Whether a change adds a guard is the reviewer's judgment (`code-review`); `finish-lane` only notes a CI edit without an inventory change. +- This repository keeps no `REVIEW.md` yet; its checks are listed in `checks-and-evals.md`. + +**Supersedes:** None. diff --git a/.ytstack/spec/checks-and-evals.md b/.ytstack/spec/checks-and-evals.md index 5506a2f4..6b845ebf 100644 --- a/.ytstack/spec/checks-and-evals.md +++ b/.ytstack/spec/checks-and-evals.md @@ -63,7 +63,7 @@ Everything that tells a contributor whether a change is acceptable: the static c - `floor --base --head ` prints the lowest class of the tree difference (`low`, `normal` or `person`), one `reason:` per path and rule, the touched areas, their ceiling and the required lenses. It reads the policy at the base commit, never from the working tree; git matches the globs. - `route [--plan ] [--pr [--repo ]] --base --head --author ` exits 0 with `route: unattended` only when the floor is not `person`, the newest round line approves, states `risk` and `invariants: none`, names a reviewer other than the author and is valid for the head, the class is within the ceiling, and every required lens has a passing line with its evidence (for `evidence: visual` a `MANIFEST` whose hashes match). Every other case exits 10 with `route: person` and one reason per failed condition. `by: self` and a missing `--author` always route to a person. With `--pr` the round and lens lines come first from the bodies of the pull request's reviews (one `gh api` read; submitted, not dismissed, by an owner, member or collaborator; the reviewer of a used line must have `admin`, `maintain` or `write` permission, read once per reviewer, a failed read routes to a person), each taken for the `commit_id` the host tied its review to; the plan counts only when no review carries a line of that kind, and a `round:` line names the source. A line naming another commit than the host's, a review that requests changes (also one without a record line, when it is its reviewer's newest review) and a failed read route to a person. -- `check` validates `REVIEW.md`, its "Own reviewers" too (slug names, a unique `marker`, a `lessons` file that exists); `reviewers` prints the own reviewers tab separated; `manifest ` writes hash and name of every image into the `MANIFEST` of an evidence directory. +- `check` validates `REVIEW.md`, its "Own reviewers" too (slug names, a unique `marker`, a `lessons` file that exists) and its "Checks", the inventory of machine checks reviewers rely on (a slug name, a `file` that exists, `guards`); `reviewers` prints the own reviewers tab separated; `manifest ` writes hash and name of every image into the `MANIFEST` of an evidence directory. **`bin/ytstack-review-escapes`: review-bot findings the own reviewers missed** (`docs/ux/review-policy-format.md`, "Escapes") @@ -94,7 +94,7 @@ Everything that tells a contributor whether a change is acceptable: the static c - `bin/ytstack-frontier`: `list` prints lane, state and detail per slice (done, claimed, blocked, ready) of the current milestone (with `none`: the highest roadmap not `done`, `dropped`, `shipped-informally` or `backlog`), then one lesson lane `lesson-F###` per open or planned lesson whose target is a check (blocked without non-empty "Files" and "Verification" in the lesson; listed also without a milestone); `claim` refuses a held lane and names the holder; `claim`, `set` and `release` change one row of `LANES.md` under a lock; `check` validates the file. The lock is the file `LANES.md.lock`, created by the shell under noclobber and not by `mkdir`, which is no lock on Ubuntu 26.04 (see `.ytstack/KNOWLEDGE.md`). - `bin/ytstack-plans` (`docs/ux/external-plans.md`): `scan` counts the work rows (task-list items, rows of tables with a status or checkbox column, nothing in a code fence) of `plans/`, `roadmap/` and their variants and prints one line per directory with `verdict=large` from 10 open rows and the answer recorded in `PREFERENCES.md`; exit 0 only for a large directory without an answer. `rows` prints `path:line`, state, id, section and title per row; a relative PATH is read from where the command was started, else from the repository root, and the output names files relative to the root. It writes nothing; the mapping is the agent's (`reconcile`, `adopt-brownfield`). - `bin/ytstack-questions`: `new`, `list`, `next`, `ask` (once), `answer` (refused without text under "Answer"), `check`. -- `bin/ytstack-finish-lane`: one step per call (`leftovers`, `commit`, `push`, `open-pr`, `wait-head`, `body-check`, `gates`, `merge`, `route`); every gate is read from GitHub through `gh` at the moment of the call, and `merge` passes the reviewed commit to the host so that a moved head cannot be merged. `route --lane [--pr ] [--report ]` reads the lane's worker (the author) and plan from `LANES.md` and runs `bin/ytstack-risk route`; with `--pr` it passes the pull request on, and a lane without a plan file is routed from the host's reviews. With a technical spec it then checks the spec delta and prints `spec:` lines: every plan of the lane with a "Spec impact" (a slice lane's task plans too) through `ytstack-spec impact --base --head`; without one, every area the diff touches needs its area file or a source in the diff, or `Spec: none -- ` in the worker's report; a path the report names must be in the diff. Each gap is a `reason: spec` line and turns `unattended` into `person` (exit 10). `leftovers` and `commit` leave the evidence directory out. Its suite uses a stand-in for `gh` and a local bare remote. +- `bin/ytstack-finish-lane`: one step per call (`leftovers`, `commit`, `push`, `open-pr`, `wait-head`, `body-check`, `gates`, `merge`, `route`); every gate is read from GitHub through `gh` at the moment of the call, and `merge` passes the reviewed commit to the host so that a moved head cannot be merged. `route --lane [--pr ] [--report ]` reads the lane's worker (the author) and plan from `LANES.md` and runs `bin/ytstack-risk route`; with `--pr` it passes the pull request on, and a lane without a plan file is routed from the host's reviews. With a technical spec it then checks the spec delta and prints `spec:` lines: every plan of the lane with a "Spec impact" (a slice lane's task plans too) through `ytstack-spec impact --base --head`; without one, every area the diff touches needs its area file or a source in the diff, or `Spec: none -- ` in the worker's report; a path the report names must be in the diff. Each gap is a `reason: spec` line and turns `unattended` into `person` (exit 10). When `REVIEW.md` keeps a "Checks" section and the diff edits CI without touching `REVIEW.md`, one `checks:` line says so (a note, CI changes go to a person anyway). `leftovers` and `commit` leave the evidence directory out. Its suite uses a stand-in for `gh` and a local bare remote. - `bin/ytstack-handover`: `new` copies `skills/handover-step/template.sh`; `check` is the static verification of a staged script (syntax, unchanged helper block, no raw command, a confirmation of its own before every mutation, no pipe into a shell). The helpers hold the same rule when the script runs: one yes carries one change. - `bin/ytstack-watch`: polls pull requests through `gh` and prints a line only when head, checks, review or mergeability changed; `--once` prints the snapshot with its read time. `release --commit ` runs `deployed` of "Release" until it names the commit (or `--timeout`, default 900 s), then `healthy` for the settle time, and ends with five receipt lines (`Target:`, `Commit:`, `Arrived:`, `Health:`, `Result:`) with read times. Exit 0 released or no health command, 2 not arrived, 3 unhealthy, 4 no "Release" section, 1 `RUNTIME.md` fails its check. It runs only those two commands and changes nothing. diff --git a/CHANGELOG.md b/CHANGELOG.md index 767fe5b3..19379aa4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 `--head` to check a commit range that is not checked out. `finish-lane` 0.6.0. +### Added + +- **A checks inventory in `REVIEW.md`** (issue #75): a `## Checks` section + lists the machine checks a reviewer can rely on, one line each + (` | file: | guards: `); `ytstack-risk check` + validates it. A pull request that adds a guard adds its line there: + `code-review` 0.5.1 treats a guard without its line as a finding, and + `ytstack-finish-lane route` prints a `checks:` line when a change edits CI + and the inventory did not move. + ## [0.11.0] - 2026-11-15 ### Added diff --git a/bin/ytstack-finish-lane b/bin/ytstack-finish-lane index be3593d0..812beac0 100755 --- a/bin/ytstack-finish-lane +++ b/bin/ytstack-finish-lane @@ -517,7 +517,6 @@ spec_delta() { local claim="" p out ec l e a ep f s hit why [ -f "$YT_DIR/spec/SPEC.md" ] || { echo "spec: no technical spec"; return 0; } [ -f "$spec" ] || { echo "reason: spec -- bin/ytstack-spec is not next to this script: the spec delta is unknown"; return 1; } - CHANGED=$(git -c core.quotePath=false diff --name-only "$base..$head" 2>/dev/null) [ -z "$report" ] || claim=$(sed -n 's/^Spec:[ \t]*//p' "$report" | head -1) while IFS= read -r p; do @@ -588,8 +587,24 @@ EOF return "$bad" } +# checks_note: when REVIEW.md keeps a checks inventory ("## Checks", the +# machine checks reviewers rely on) and the change edits CI without touching +# REVIEW.md, one "checks:" line: a guard the change adds or changes gets its +# line there. A note, not a gap: a change to CI goes to a person anyway. +checks_note() { + local p ci="" + [ -f "$YT_DIR/spec/REVIEW.md" ] && grep -x '## Checks' "$YT_DIR/spec/REVIEW.md" >/dev/null || return 0 + touched_by "${YT_DIR#"$TOP"/}/spec/REVIEW.md" && return 0 + while IFS= read -r p; do + case "$p" in .github/workflows/*|.gitlab-ci.yml) ci="$ci${ci:+, }$p" ;; esac + done </dev/null) if ! s=$(spec_delta "$lane" "$base" "$head" "$report") && [ "$ec" -eq 0 ]; then r=$(printf '%s\n' "$r" | sed '1s/^route: unattended$/route: person/'); ec=10 fi + n=$(checks_note); [ -z "$n" ] || s="$s${s:+$'\n'}$n" fi printf '%s\n' "$r" [ -z "${s:-}" ] || printf '%s\n' "$s" diff --git a/bin/ytstack-risk b/bin/ytstack-risk index 494202f8..fb59e507 100755 --- a/bin/ytstack-risk +++ b/bin/ytstack-risk @@ -201,6 +201,7 @@ section() { # review_parse: REVIEW.md on stdin as records, one per line: # person| neverlow| size|| # lens||||| +# own|||| check||| # bad| # Everything that can be judged without the file system is judged here, so # check and floor agree on what is malformed. @@ -217,8 +218,8 @@ review_parse() { fence { next } /^## / { sec = trim(substr($0, 4)) - if (sec != "Always a person" && sec != "Never low" && sec != "Lenses" && sec != "Size" && sec != "Own reviewers") { - bad("section \047## " sec "\047 is not one of Always a person, Never low, Lenses, Size, Own reviewers"); sec = "" + if (sec != "Always a person" && sec != "Never low" && sec != "Lenses" && sec != "Size" && sec != "Own reviewers" && sec != "Checks") { + bad("section \047## " sec "\047 is not one of Always a person, Never low, Lenses, Size, Own reviewers, Checks"); sec = "" } next } @@ -273,6 +274,23 @@ review_parse() { else mk[marker] = name if (lessons == "") bad("own reviewer " name " has no lessons") print "own|" name "|" marker "|" lessons "|" bots + next + } + # A machine check reviewers rely on: " | file: | guards: ". + sec == "Checks" { + n = split(item, part, "|"); name = trim(part[1]) + file = ""; guards = "" + for (i = 2; i <= n; i++) { + p = trim(part[i]); k = p; sub(/:.*/, "", k); v = trim(substr(p, length(k) + 2)) + if (k == "file") file = v + else if (k == "guards") guards = v + else bad("check " name ": field \047" k "\047 is not file or guards") + } + if (name !~ /^[a-z0-9][a-z0-9-]*$/) bad("check name \047" name "\047 is not a lowercase slug") + if (chk[name]++) bad("check " name " is defined twice") + if (file == "") bad("check " name " has no file") + if (guards == "") bad("check " name " has no guards") + print "check|" name "|" file "|" guards } ' } @@ -299,7 +317,7 @@ EOF # ---- check --------------------------------------------------------------------- cmd_check() { - local f="${YT_DIR:+$YT_DIR/spec/REVIEW.md}" bad=0 n=0 o=0 kind a b c d e doc + local f="${YT_DIR:+$YT_DIR/spec/REVIEW.md}" bad=0 n=0 o=0 k=0 kind a b c d e doc [ $# -eq 0 ] || { usage >&2; return 64; } if [ -z "$f" ] || [ ! -f "$f" ]; then echo "no review policy"; return 0; fi while IFS='|' read -r kind a b c d e; do @@ -308,6 +326,9 @@ cmd_check() { own) o=$((o + 1)) [ -z "$c" ] || [ -e "$TOP/$c" ] || { bad=$((bad + 1)); echo "REVIEW.md: own reviewer $a: lessons $c does not exist"; } ;; + check) + k=$((k + 1)) + [ -z "$b" ] || [ -e "$TOP/$b" ] || { bad=$((bad + 1)); echo "REVIEW.md: check $a: file $b does not exist"; } ;; lens) n=$((n + 1)) while IFS= read -r doc; do @@ -321,7 +342,7 @@ EOD $(review_parse < "$f") EOF [ "$bad" -eq 0 ] || return 1 - echo "review policy ok: $n lens(es), $o own reviewer(s)" + echo "review policy ok: $n lens(es), $o own reviewer(s), $k check(s)" } # ---- reviewers ----------------------------------------------------------------- diff --git a/docs/ux/review-policy-format.md b/docs/ux/review-policy-format.md index 30767b7b..758d26d4 100644 --- a/docs/ux/review-policy-format.md +++ b/docs/ux/review-policy-format.md @@ -90,6 +90,11 @@ It is the highest class that may merge into this area without a person. No field - code | marker: (`code`) | lessons: .github/reviewers/code.md | bots: cursor, greptile-apps - tests | marker: (`tests`) | lessons: .github/reviewers/tests.md + +## Checks + +- component-levels | file: scripts/check-levels.mjs | guards: an atom imports no molecule; the import directions of .ytstack/spec/web.md +- secret-scan | file: .github/workflows/secret-scan.yml | guards: no token reaches a pushed commit ``` Paths are git pathspec globs relative to the repository root, one per line. Every section is optional. Git itself matches them, the way `bin/ytstack-spec lint` and `drift` read `paths`: `*` stays inside one directory, `**` crosses directories, and `**/name` also matches at the root. @@ -144,6 +149,18 @@ A lesson is a change to the `lessons` file, and that is a rule change: it is pro `bin/ytstack-risk reviewers` prints the section, one tab separated line per role: name, marker, lessons, bots. +## Checks: what a reviewer can rely on + +A project that runs machine checks of its own (a guard script, a lint rule, a CI step, a test that pins a contract) lists them here, so that a reviewer knows what it does not have to read for and a new rule is not only told in a receipt. Without the section nothing changes. + +| Field | Required | Holds | +|---|---|---| +| name | yes | A lowercase slug, unique. | +| `file` | yes | The file that is the check, or that runs it. It exists in the repository. | +| `guards` | yes | What holds when the check passes, in one line; the rule itself stays in the area file or the source it names. | + +A pull request that adds a guard, or changes what one guards, adds or updates its line here in the same commits. `bin/ytstack-finish-lane route` prints a `checks:` line when the project keeps the section and a change edits CI (`.github/workflows/`, `.gitlab-ci.yml`) without touching `REVIEW.md`; a change to CI goes to a person anyway, and that person reads the line. `code-review` treats a guard added without its line as a finding. + ## Escapes `bin/ytstack-review-escapes [-C ] --pr [--repo ]` reads one pull request through `gh` and prints one tab separated line per review-bot thread under a header: @@ -291,7 +308,7 @@ The route reads the host only for the review records, and only with `--pr`; it s ## Checked mechanically -`bin/ytstack-risk check` reads the `REVIEW.md` of the working tree. It fails on a section outside the five, a lens whose name is not a lowercase slug, a lens without `applies`, `reads` or `evidence`, a lens field outside the five, an `evidence` outside the two values, a `reads` document that does not exist, a lens name used twice, a `size` line that is not two numbers, an own reviewer whose name is not a lowercase slug or is used twice, one without `marker` or `lessons`, a marker another role has, a `lessons` file that does not exist, and an own reviewer field outside the three. It prints one line per problem (`REVIEW.md: `) and exits 1; a clean policy and a project without `REVIEW.md` exit 0. +`bin/ytstack-risk check` reads the `REVIEW.md` of the working tree. It fails on a section outside the six, a lens whose name is not a lowercase slug, a lens without `applies`, `reads` or `evidence`, a lens field outside the five, an `evidence` outside the two values, a `reads` document that does not exist, a lens name used twice, a `size` line that is not two numbers, an own reviewer whose name is not a lowercase slug or is used twice, one without `marker` or `lessons`, a marker another role has, a `lessons` file that does not exist, an own reviewer field outside the three, and a check whose name is not a lowercase slug or is used twice, one without `file` or `guards`, a `file` that does not exist and a check field outside the two. It prints one line per problem (`REVIEW.md: `) and exits 1; a clean policy and a project without `REVIEW.md` exit 0. `bin/ytstack-spec lint` runs that check when `REVIEW.md` exists and counts each line as a failure. It also fails on an `auto_merge` outside the three values and on a `REVIEW.md` that `SPEC.md` does not link. diff --git a/skills/code-review/SKILL.md b/skills/code-review/SKILL.md index c079b82e..c43f586a 100644 --- a/skills/code-review/SKILL.md +++ b/skills/code-review/SKILL.md @@ -2,7 +2,7 @@ name: code-review metadata: tier: task - version: 0.5.0 + version: 0.5.1 description: "Reviews the active task's commits with a fresh-context reviewer subagent and handles the feedback with technical rigor, through the vendored superpowers requesting-code-review and receiving-code-review procedures, with the task plan and commit range injected. Use after a task's commits exist and before summarize-task, before a merge or PR, or when the user says review this, code review, check my changes. Not for reviewing a plan (plan-eng-review) and not without commits for the task." allowed-tools: - Bash @@ -106,7 +106,7 @@ You are invoked inside a ytstack project after the active task's commits exist. HARD-GATE: if `IS_GIT=no`, abort. If `ACTIVE_TASK` has `none` in it or `TASK_PLAN_EXISTS=no`, abort with "no active task plan; run `ytstack:plan-task` or review a plain diff without ytstack". If `COMMITS_SOURCE=none` or `BASE_SHA=none`, abort with "no commits found for the task; commit with the `M###-S##-T##:` prefix (or set `commit_ref_pattern` in PREFERENCES) and re-run". -**Spec check, bounded to the touched area.** When `SPEC_EXISTS=yes`, add to the reviewer's requirements the plan's `## Spec impact` section and the paths listed under `SPEC_AREAS` (the area files of `.ytstack/spec/` that cover the changed files). The reviewer reads those area files, and the section of a `sources` document they point to, against the diff. Two things are findings: the diff changes behaviour, an interface, an invariant or an error path that an area file describes while the plan says `none`; or an area file (or its source) now states something the diff contradicts. A change that restores the described behaviour needs no spec edit and is not a finding. The reviewer does not audit the rest of the spec, other areas or the repository's documentation. +**Spec check, bounded to the touched area.** When `SPEC_EXISTS=yes`, add to the reviewer's requirements the plan's `## Spec impact` section and the paths listed under `SPEC_AREAS` (the area files of `.ytstack/spec/` that cover the changed files). The reviewer reads those area files, and the section of a `sources` document they point to, against the diff. Two things are findings: the diff changes behaviour, an interface, an invariant or an error path that an area file describes while the plan says `none`; or an area file (or its source) now states something the diff contradicts. A change that restores the described behaviour needs no spec edit and is not a finding. A third is a finding when `.ytstack/spec/REVIEW.md` keeps a `## Checks` section (the machine checks reviewers rely on, `docs/ux/review-policy-format.md`): the diff adds a guard or changes what one guards (a check script, a lint rule, a CI step) and the section did not change with it. The reviewer does not audit the rest of the spec, other areas or the repository's documentation. ## Bounded review (ytstack) diff --git a/skills/finish-lane/SKILL.md b/skills/finish-lane/SKILL.md index 682d3550..6e0c2a63 100644 --- a/skills/finish-lane/SKILL.md +++ b/skills/finish-lane/SKILL.md @@ -342,7 +342,7 @@ Whether a person has to look at this change is decided per change, from its risk On a host other than GitHub leave out `--pr`: the plan is then the only record. The first line says what it read: the lane, the worker of its row as the author, the plan, the pull request. Then come the lines of `bin/ytstack-risk route`: `route: unattended` or `route: person`, `class:`, `ceiling:`, `floor:`, `areas:`, `lenses:`, `round:` (where the round line came from: a review on the host, the plan, or none), and one `reason:` per condition that failed. Last come the `spec:` lines of the spec delta. Exit 0 means `unattended`. Everything else, an error included, means "not unattended". Keep the lines for the report. -**The spec delta.** With a technical spec, `route` checks itself that the spec moved with the change, also for a lane that never ran `summarize-task`: every plan of the lane that states a `## Spec impact` (a slice lane's task plans too) is checked with `bin/ytstack-spec impact` on `{BASE_SHA}..{SHA}`; without such a plan, every area whose paths the diff touches needs its area file or one of its `sources` in the diff, or `Spec: none -- ` in the report. A path the report names as edited has to be in the diff. Each gap is a `reason: spec -- ...` line and makes the route `person`. The repair is the worker's: edit the section the change made false, or state the reason in the report, and the fix round follows. You do not edit the area file and you do not write the reason for the worker. +**The spec delta.** With a technical spec, `route` checks itself that the spec moved with the change, also for a lane that never ran `summarize-task`: every plan of the lane that states a `## Spec impact` (a slice lane's task plans too) is checked with `bin/ytstack-spec impact` on `{BASE_SHA}..{SHA}`; without such a plan, every area whose paths the diff touches needs its area file or one of its `sources` in the diff, or `Spec: none -- ` in the report. A path the report names as edited has to be in the diff. Each gap is a `reason: spec -- ...` line and makes the route `person`. The repair is the worker's: edit the section the change made false, or state the reason in the report, and the fix round follows. You do not edit the area file and you do not write the reason for the worker. A `checks:` line says that the change edits CI while the project's checks inventory (`## Checks` in `REVIEW.md`) did not change: it goes to the person who merges, and back to the worker when the change adds a guard. `unattended` needs all of this: a floor from the diff that is not `person`; a newest round line that approves, is valid for `{SHA}`, states `risk` and `invariants: none`, and names a reviewer other than the lane's worker; a class within the ceiling (`auto_merge`) of every area the change touches; and for every required lens a newest line that says `pass`, comes from a reviewer other than the worker, is valid for `{SHA}` and, for a visual lens, names an evidence directory whose `MANIFEST` matches its images. A project that declared nothing gets `person` for every change, which is what `merge_by: human` does. diff --git a/tests/ytstack-finish-lane.test.sh b/tests/ytstack-finish-lane.test.sh index cc9e7355..be3e1299 100644 --- a/tests/ytstack-finish-lane.test.sh +++ b/tests/ytstack-finish-lane.test.sh @@ -544,6 +544,15 @@ has "and its line is printed" "spec: .ytstack/M001-S01-T01-PLAN.md -- spec impac rm -f "$RS/.ytstack/M001-S01-T01-PLAN.md" quiet; run "$RS" route --lane M001-S01 --base "$SB" --head "$SC" --report "$TMP/none.md" eq "a report file that cannot be read: exit 64" 64 "$EC" +# The checks inventory: a CI change without its line in REVIEW.md "## Checks". +( cd "$RS" && git checkout -q -b ci main && mkdir -p .github/workflows && echo 'on: push' > .github/workflows/levels.yml \ + && git add -A .github && git commit -qm "M001-S01-T01: level guard" && git checkout -q main ) >/dev/null 2>&1 +SG=$(git -C "$RS" rev-parse ci); splan "$SG" +printf '# Review policy\n\n## Checks\n\n- spec | file: .ytstack/spec/core.md | guards: x\n' > "$RS/.ytstack/spec/REVIEW.md" +sroute "$SG" +has "a CI change without its line in the checks inventory is named" 'checks: the change edits CI (.github/workflows/levels.yml) and .ytstack/spec/REVIEW.md "## Checks" did not change' "$OUT" +rm -f "$RS/.ytstack/spec/REVIEW.md"; sroute "$SG" +hasnt "without an inventory there is no such line" "checks:" "$OUT" # A visual lens. The reviewer stored its images in the main checkout; the # coordinating session works in a linked worktree of the same repository. diff --git a/tests/ytstack-risk.test.sh b/tests/ytstack-risk.test.sh index 433f3e07..b86b4c30 100644 --- a/tests/ytstack-risk.test.sh +++ b/tests/ytstack-risk.test.sh @@ -283,7 +283,17 @@ check_fails() { #