Repository navigation
fix(loop): an unbudgeted kind fails, and budget.mjs owns the marker rule - #157
Conversation
…dict word `budget.mjs`'s CLI exited 0 on `UNBUDGETED`, so a typo'd or unnamed `--kind` read as a pass. That silence hid the missing review-body budget for three weeks (#145). Every verdict but `OK` now exits 1. The exit code alone cannot carry the answer, and keying on it was the second half of the same bug. `--fit` already exited 1 on `UNBUDGETED`, and `handler-journal` read that as "cut prose from Friction" — so a run that mistyped the kind was told to cut text that was never over budget. Both skills now act on the printed verdict word: `OVER` means cut, `UNBUDGETED` means fix the kind and cut nothing. Two details the review caught. A missing `--kind` fell through to `argv[0]` and reported the node binary as the kind, which the new rule would send a run hunting for — it now names the missing flag. And `handler-journal` says what `UNBUDGETED` means where only `journalEntry` is passed: the config lost the key, so report it and post unfitted. Five CLI tests cover the exit mapping, which no test reached before. Refs #155 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Fqz8efubu3hcBmVgeCJkrK
`handler-preflight` asked for `identity.commentMarker` on every comment in
prose, and SahajAtlasWeb#233 shipped a review with no attribution while
following it. `CLAUDE.md` gives a mechanical rule to a script, and
`budget.mjs` already holds the artefact on stdin and the marker from
`loadLoopConfig()`.
`writing.markerRequired` lists the kinds that must carry it, as a sibling of
`writing.budgets` rather than a shape change to it: both of the script's
lookups need a number, so a per-kind `{chars, marker}` object would break
them, the fallback's `deepEqual`, and every `--kind` call the skills make.
`journalEntry` is absent, which is also why `--fit` never checks.
Two decisions the ticket left open, both taken here:
- **Presence, not position.** A loop comment carries the harness attribution
footer after the marker, so an ends-with test would fail a correct artefact
to catch a failure nobody has made.
- **Unconditional, not behind a flag.** A flag would have to be named in
run-loaded prose, and a run that forgot it would get back the silence #155
removes.
`MISSING_MARKER` is reported before `OVER`, because the marker is 124
characters and they count.
Refs #155
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Fqz8efubu3hcBmVgeCJkrK
Five review lenses over `origin/main...HEAD`. Each fix below is theirs.
**The marker rule now defaults on.** `check()`'s options defaulted to `[]`
and `''`, so the library function's unsafe behaviour was its default — the
per-caller flag `docs/why.md` argues against in the same paragraph. They
default to `DEFAULT_MARKER_REQUIRED` and `DEFAULT_MARKER`, like `budgets`,
and measuring a budget alone takes an explicit `{ markerRequired: [] }`.
**A new budget kind can no longer be silently marker-exempt.** `markerRequired`
is an allowlist, which is the shape of the silence #155 removes: `reviewBody`
went three weeks unmeasured for exactly that reason. A test now holds every
budgeted kind to declaring itself, listed there or exempt in the test, so
adding a kind fails the suite until someone decides.
**The verdict words are an interface, so a test holds the prose to them.**
`VERDICTS` names what the script can print, and the suite fails if a skill
keys on a word it cannot.
**The `if (!kind)` guard is gone.** It printed the verdict on stderr while
every other non-`--fit` verdict goes to stdout — in the change whose premise
is that skills read the printed word. Slicing `process.argv` is the whole fix:
an absent flag is an empty kind, which is already `UNBUDGETED`. The argv read
is `flag()` from `config.mjs` now, as in `payload.mjs` and `merge-verdict.mjs`.
**Run-loaded prose shrank.** `handler-journal` keys on `OVER` and "any other
verdict" instead of enumerating one that the corpus test makes unreachable,
and says which stream carries the word, since the command beside it redirects
stdout. `handler-preflight` keeps the marker rule in its one existing home and
names the verdict there. The retrospective copies in `budget.mjs` went back to
one imperative plus the anchor, and `loop-config.json`'s `$comment` back to
naming the value.
**Tests: 21, from 24.** Seven child-process spawns were 77% of the suite's
runtime; five remain, each proving one thing. One parse of `loop-config.json`
serves the file, and the marker unit tests use frozen fixtures, so no live
value threads through the "frozen fixtures, not a copy of the config" contract.
Refs #155
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Fqz8efubu3hcBmVgeCJkrK
The one sentence describing the script said it checks a character budget. It also decides the marker, and its exit code no longer distinguishes the verdicts, so a contributor editing it needs both facts here. Refs #155 Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Fqz8efubu3hcBmVgeCJkrK
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
Both phases match #155, and nothing is smuggled in beside them. Phase 1 is the right fix: the exit code cannot carry two verdicts that need opposite responses, and --fit is correctly left alone rather than guarded.
The ticket bought two commits for separate revertability, and 53c28b1 spends it. It moves check()'s marker defaults from []/'' to the two constants df875ed adds, so reverting df875ed alone leaves the file naming constants that no longer exist. Squash the review pass into the two commits it edits.
The prose total is the other cost. ~16 lines of behaviour arrive with ~24 comment lines in budget.mjs, 49 in docs/why.md and 4 in AGENTS.md, and the verdict contract is now stated four times. Three homes, no overlap, is the rule.
Findings
should-fix— the new verdict-drift test cannot seeMISSING_MARKER, the one word this PR adds to prose.budget.test.mjs:228.should-fix—53c28b1breaks the revert path the two-commit split exists for. Above, no single line.consider—--kind=is parsed by hand beside the newflag()call, and nothing uses it.budget.mjs:202.consider—AGENTS.md:118states the verdict contract a fourth time, and already drifts from it.
What was checked
Read whole on the branch, against all four commits: budget.mjs, budget.test.mjs, config.mjs's flag(), both changed skills, the why.md additions.
Verified by query: flag() is argv.indexOf('--'+name) alone, so it never reads =, and --kind= appears nowhere but line 202. The new DEFAULT_MARKER copy carries a drift test. fit() never calls check(), so the marker rule is unreachable on --fit. The verdict regex, run over every SKILL.md on the branch, returns OVER and UNBUDGETED and nothing else.
No contract surface outside this repo changes. Profile read.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
The scan required `means` or `→` after a backticked word, so it saw `OVER` and `UNBUDGETED` and nothing else. `MISSING_MARKER` — the one verdict this PR adds to run-loaded prose — reads "answers `MISSING_MARKER` until you do" at handler-preflight/SKILL.md:68, which the regex escaped. Renaming that verdict in the script would have left the test green and the skill naming a word budget.mjs cannot print, which is the drift the test exists to catch. Every backticked ALL-CAPS token in every SKILL.md now counts, and the nine that are not verdicts — env vars, git refs, HTTP verbs, review states — are named in NOT_VERDICTS. A new token fails until someone says which list it belongs in, the same shape as MARKER_EXEMPT above it. The size>0 sanity assertion is replaced by one that names MISSING_MARKER, so the gap cannot reopen silently. Verified: replacing MISSING_MARKER with a word VERDICTS lacks fails the test; restoring it passes. 21 tests pass. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Ascs6E1jaFiN7KJuFWmqye
The `--kind=` branch had no caller: no skill, doc or test in the repo uses that form, and `flag()` on the next line cannot read it. Two parsers for one flag is a half-migration, and the surviving one is the shared `flag()` that payload.mjs and merge-verdict.mjs already use. Dropped rather than taught to `flag()` in config.mjs: widening `flag()` changes three callers for a form nobody writes. `--kind=comment` now exits 1 with UNBUDGETED naming an empty kind, so the unsupported form fails loudly instead of being half-supported. Verified: `--kind comment` → MISSING_MARKER exit 1, no flag → UNBUDGETED exit 1, `--kind nosuchkind` → UNBUDGETED naming the kind. 21 tests pass. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Ascs6E1jaFiN7KJuFWmqye
The paragraph stated the verdict/exit contract a fourth time, after budget.mjs's header block, handler-preflight's budgets paragraph, and docs/why.md#a-verdict-word-not-an-exit-code. It had already drifted from the script it described: `--fit` prints its verdict to stderr and never checks the marker, so "it prints a verdict word ... and exits non-zero" was true of one of the two paths. Three homes, no overlap: the value in loop-config.json, the rule in the skill, the story behind the anchor. AGENTS.md keeps what a contributor needs — the script exists, it grades the marker too, read the word not the code — and cites the anchor for the rest. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Ascs6E1jaFiN7KJuFWmqye
|
Three threads adopted, one review-body finding declined. Pushed
Declined: squash Gate passed. 142 tests, 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
budget.mjs's CLI exited 0 onUNBUDGETED, so a mistyped--kindread as a pass. Every verdict butOKexits 1, and the skills key on the printed word.identity.commentMarker" rule moves from prose into the script, asMISSING_MARKER, driven bywriting.markerRequired.One commit per behaviour, Phase 1 first:
296c175(the verdict/exit contract) anddf875ed(the marker check).53c28b1is the review pass over both,106f376the docs sync.Change outline
Contract — what the CLI promises a caller
Behaviour —
check()check(text, kind, budgets, { markerRequired, marker }) workflow/lib/budget.mjs no budget for kind → UNBUDGETED + kind is marker-required, text lacks the marker + → MISSING_MARKER # answered BEFORE the overage: the + # marker is 124 chars and they count chars > limit → OVER else → OK + both marker options default ON, like `budgets` — a budget-only + measurement passes `{ markerRequired: [] }` deliberatelyContract —
loop-config.jsonwriting: budgets: { comment, reviewReply, reviewBody, journalEntry } # untouched, still integers + markerRequired: [comment, reviewReply, reviewBody] # journalEntry posts no markerFlow — how the two run-loaded skills respond
Test results
claude plugin validate ./workflow --strict→√ Validation passed, exit 0node --test workflow/lib/budget.test.mjs→ 21 passed, from 6 onmain.node --test dispatcher/test/*.test.mjs→ 106 passednode workflow/lib/rule-delta.mjs --base origin/main workflow/skills→directives: 62 → 62, no directive disappearednode workflow/lib/comment-lint.mjs --base origin/main→ no banned comment addedpython3 workflow/lib/ste-lint.pyon both changed skills → 3 violations, 0 hard, baseline 0; all three are pre-existing linesEvery command in the ticket's verification checklist was run.
--kind nosuchkindexits 1 naming the kind,--fit --kind nosuchkindexits 1 printingUNBUDGETEDnotOVER,--kind commentexits 1 naming the missing marker and exits 0 with the real marker appended,--kind journalEntryexits 0.Manual verification
BOT_DISPATCH=dry, then a scratch@sydevs-bot answer …watched end to end (docs/routine-setup.md§6).journalEntryis deliberately outsidemarkerRequired, becausehandler-journal's template carries no marker. Checked against the template in this run; a regression here would fail every run's last write.Notes for reviewer
Two open questions from the ticket, both settled from the code.
--fitdoes not enforce the marker. It runs onjournalEntryalone, which is not marker-required, so the interaction is unreachable. No guard added.check()enforces it unconditionally, not behind a flag. A flag would have to be named in run-loaded prose, and a run that forgot it would get back the silence this ticket removes. The review pass took this further: the options now default on, so the opt-out is the thing you type.One deliberate deviation from an acceptance criterion. The criterion says a required kind fails when the text "does not end with" the marker. It tests presence instead. A loop comment carries the harness attribution footer after the marker — this ticket's own comments do — so an ends-with test would fail a correct artefact to catch a failure nobody has made. What SahajAtlasWeb#233 shipped was no marker at all. Tighten it to position once #145's footer question is settled.
Findings raised and dismissed, with reasons.
--append-marker), not grade it. Right, and out of scope:MISSING_MARKERonly fires for a run that measures, so a run that skips the step still omits the marker — the fix(review-pr): name how to read a file as the branch has it #233 class survives. A generator is a different behaviour and wants its own PR. APreToolUsehook would not cover the cloud routines at all, since hooks run in a maintainer's session.writing.markerExempt: ["journalEntry"]. Genuinely safer — a new budget kind would default to checked rather than silently exempt — but it contradicts the criteria the ticket sets, which namemarkerRequiredand a kind "declared to require" the marker. The gap is closed by a test instead: every budgeted kind must be listed inmarkerRequiredor named exempt in the suite, so adding a kind fails until someone decides. Worth revisiting as a data edit.comment-lint.mjsdoes with its exit 2. The ticket decided the opposite, from the code, and--fitwas already keying on a boolean. Instead a test now holds the prose to the words:VERDICTSnames what the script can print, and the suite fails if a skill keys on one it cannot.--config, aspayload.mjsandmerge-verdict.mjshave. Out of scope: no skill passes it, and the test'scwdpin documents a real property ofloadLoopConfig()rather than working around a missing flag.markerRequiredmembership test out ofcheck()into the CLI. Declined: keeping it inside means one function answers "is this artefact acceptable for this kind", and that is what the unit tests exercise.Two of the ticket's premises were stale by the time this ran, and neither changes the work. It says
mainand #153's branch are both at2.5.0;mainwas at2.7.0, so this raises it to2.8.0. And it says to wait for #153 — #153 merged asef83cfband closed #145 before this fired.Blast radius.
budget.mjsis invoked by every run in all five repos, andhandler-preflightandhandler-journalare read on every dispatch. After this merges, a mistyped--kindfails a run instead of passing it, and a comment with no marker fails before it posts. No consumer repo file changes, socontractSyncis not involved.Detail
Why the exit code alone could not be the fix.
--fitalready exited 1 onUNBUDGETED, andhandler-journalread that as "cut prose from Friction" — so a run that mistyped the kind was told, forever, to cut text that was never over budget. Fixing only the check path's exit code would have left the loop acting on the wrong signal on the other path.Why
markerRequiredis a sibling ofwriting.budgets, not a shape change to it.budget.mjsis the only reader of that key, and both of its lookups require a number. Turning each budget into{chars, marker}would break them, break the fallback'sdeepEqual, and break every--kindcall the skills make.What the review pass removed. The
if (!kind)guard printed its verdict on stderr while every other non---fitverdict goes to stdout — in the change whose premise is that skills read the printed word. Slicingprocess.argvis the whole fix: an absent flag is an empty kind, which is alreadyUNBUDGETED. The argv read isflag()fromconfig.mjsnow, as inpayload.mjsandmerge-verdict.mjs.Prose cost.
handler-journalkeys onOVERand "any other verdict" rather than enumerating one the corpus test makes unreachable.handler-preflightkeeps the marker rule at the bullet that already stated it. The retrospective narratives inbudget.mjswere cut back to one imperative plus the(why: …)anchor, andloop-config.json's$commentwent back to naming the value, since that file holds values and not rules.Test shape. Seven child-process spawns were 77% of the suite's runtime; five remain, each proving one thing. One parse of
loop-config.jsonserves the file. The marker unit tests use frozen fixtures, so no live config value threads through the "frozen fixtures, not a copy of the config" contract the file already had. Two new drift tests: every budgeted kind declares its marker status, and every verdict word a skill keys on is one the script can print.Anomaly, recorded not explained. The ticket reports
claude plugin validate ./workflow --strictpassing clean onmain, against #145's three and #153's four${CLAUDE_PLUGIN_ROOT}warnings. It passes clean here too, onef83cfband on this branch, under the CLI this session has.Not verified. SahajAtlasWeb#233 and the other cited PRs live in repos outside this run's scope, so their measurements stand as the filing sessions' own. The 124-character marker length was re-measured here.
Closes #155
🤖 Generated with Claude Code
https://claude.ai/code/session_01Fqz8efubu3hcBmVgeCJkrK
Generated by Claude Code