refactor(builtin-skills): state comment rationale in present tense - #9794
Conversation
|
Intent: Make the Not a goal: Changing any behaviour. Rewriting the |
Opus 4.8 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
Design Review (Fable 5) — ✅ PASSDesign-level review of The Design-Verdict: PASS A hygiene pass with a real, gate-enforced criterion; every rewrite keeps the guard's rationale, and the one code line is provably equivalent and test-pinned. WatchThe regenerated baseline also lowers two files this PR never touches ( [DESIGN-REVIEWED] dfbeb3f |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
First Principles Review (Fable 5) — ✅ PASSPremise-level review of All counts verified: First-Principles-Verdict: PASS Description says the baseline header "moves by 13"; the diff moves it 15 — two extra entry drops for untouched files rode in, both verified accurate. Not justified as shipped
What this change shipsInventory (4 items) — 2 justifiedIntent: make the conductor scripts' comments state current rationale instead of narrating past revisions — a FIX (of documented-invariant violations, code-style.md's present-tense rule).
[FIRST-PRINCIPLES-REVIEWED] dfbeb3f |
c9b14ce to
dc75f84
Compare
self-added: no |
self-added: no |
The module's comments carried change-history narration that the
comment-history ratchet counts and that AGENTS.md forbids: prior-revision
accounts ("this comment used to say", "an earlier version wrote", "the
first version applied"), issue and PR references, and incident dates.
Each is restated as what is true now, keeping every fact the comment was
carrying - the failure it guards against, the measurement behind it, the
constraint it names - and dropping only the account of how the code got
here, which git already holds.
Also flattens one chained ternary in the security-conductor ledger's
propose-golden-path report path. `_read_golden_path_state` returns a
bool, so `int(state[0])` is the same value and the same type as
`(1 if state[0] else 0)`, and the emitted JSON is byte-identical.
The ratchet baseline drops by 12 markers across five entries, four of
which are pruned outright. Four markers stay in claim_preflight.py: they
are the English phrases its own closure regexes match ("no longer an
issue"), quoted by the comment that explains them, so rewriting them
would make the comment wrong. `--write-baseline` also recomputes
`_total`, which the base carried one higher than its own file sum.
dc75f84 to
6915662
Compare
self-added: no |
self-added: no |
|
Maintainer note (@bolichen97, agent-assisted): pushed a merge commit |
Problem / Motivation
Comments in the
builtin_skillsscripts told the story of how the code gothere instead of what it does now.
fleet_probe.pyopened a paragraph with"This comment used to say ... That premise is wrong";
claim_preflight.pysaid "it used to be CLOSE" and "The first version applied any withdrawal to
every earlier claim";
ledger_entry.pycited a PR number; three commentscarried an incident date.
A reader has to work out which half is current before they can trust any of
it. The repo already says so twice:
code-style.mdrequires present tense,and
scripts/check_comment_history.pyis a shrink-only CI ratchet thatcounts these markers per file.
Why it matters
These are the scripts the pipeline, security and goal conductors run to
decide whether to dispatch work, close somebody's item, or suppress a queued
one. The comments are the only place the reasons live. A reason written as
history makes the next reader guess, and guessing here withholds work or
acts on somebody else's item.
The ratchet also only moves when someone moves it.
What changed (motivation → approach → change)
Every comment in these five scripts that narrated a past revision now states
what is true. Nothing was deleted for being long: each rewrite keeps the
failure the comment guards against, the measurement behind it, the count, and
the identifiers — and drops only the account of which version had the bug,
which git already holds.
The ratchet is the criterion, so the file set is not a matter of taste. It
counts 16 markers in these five files, and
--write-baselinerecords the dropto 4 — twelve fewer, four entries pruned outright. Those 4 stay on purpose:
they are the English phrases
claim_preflight.py's own closure regexes match("no longer an issue"), quoted by the comment that explains them, so rewriting
them would make the comment wrong.
--write-baselinealso recomputes_total, which the base carried one higherthan its own
filessum. So the header moves by 13 while this diff accountsfor 12; the per-entry diff is the honest number.
One code line changes.
security-conductor/scripts/ledger.pycomputedactive = (1 if state[0] else 0) if state is not None else 0in thepropose-golden-pathreport path._read_golden_path_statealready returnsbool(int(row["active"])), soint(state[0])is the same value and the sameinttype, and the emitted JSON is byte-identical.The
prepare-pr/scripts/bundle keeps its 19 markers for its own pass: PR#9308 is rewriting
preflight.py, andpr_status.pyalready carries 10markers against a baseline of 9 on
main, so touching it would red the gatefor a reason this PR did not cause.
Tests
No new tests. Comment prose has no test to add, and the one code line is
already pinned:
test/test_security_conductor_ledger.pyasserts the exactemitted object (
{"id": ..., "created": False, "active": 1}and"active": 0)for a fresh proposal, a dedupe hit on an approved row, and a hand-retired row.
scripts/check_comment_history.pyis the gate that locks the baseline in, andit fails if any of these five files grows a marker back.
Ran green:
test_pipeline_conductor_*,test_security_conductor_*,test_conductor_ledger_entry,test_ledger_conductor_agent,test_builtin_skill_{scope,packaging,sync_safety},test_web_verify_downscale— 1166 passed. Plus flake8, isort, mypy, black-formatting,
subprocess-encoding, comment-history, brand-name, harness-parity, docs-lint
(both), per-file-coverage, builtin-skill-scope, vendor-manifest and
changelog-history, all exit 0.
Manual verification
N/A — unit coverage sufficient. The one behavioral surface is the
propose-golden-pathJSON, and a differential run of the pre- and post-change_dispatchover eight stored states (absent row, inert, approved, retired,and four corrupt column values) produced byte-identical stdout.
Review fleet
Before opening, five parallel subagent lenses reviewed the diff (AUTOSDE +
blocking rules, behaviour preservation, import semantics, security keystone,
comment accuracy), then two more verified the enlarged diff. What they found
and what happened:
from a baselined file requires lowering its entry in the same commit, and the
gate reads as green until the change is committed. The baseline is now in the
commit.
claim_preflight.py'sdocstring said Rule 3 is "SKIP and not CLOSE" — it is
REVIEW(verdict tableline 109, exit code 13). A tense flip made "returns CLOSE on a live item"
present tense, which nothing on that path does any more. And "two days behind
the newest" overstated a 38-hour measurement.
narration clauses the ratchet's patterns miss —
claim_preflight.py:188, andthe
plain_proseand rule-table paragraphs where "is now" and a line-wrapped"no longer" both slip past the gate. The criterion is now a tokenize+AST scan
of every comment and docstring in the touched files, not the gate's patterns;
it returns 11 remaining hits, all runtime state or quoted regex text.
that list lives in the sweep tooling, not the repo, and it is updated there.
Related Issues
no linked issue: a comment-hygiene and readability pass, not a reported defect.
Why no screenshot: backend only — five skill scripts and one gate baseline;
nothing under
website/and no rendered surface changes.Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)