Skip to content

feat(corrections): prove never-broken rules and route style rules to the formatter - #16930

Merged
kyle-sexton merged 3 commits into
mainfrom
feat/codify-planted-proof-and-formatter-rung
Nov 17, 2026
Merged

kyle-sexton merged 3 commits into
mainfrom
feat/codify-planted-proof-and-formatter-rung

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

No related issue: workshop 06 close-out, owner decisions Q767 and Q768 (2026-11-17)

Summary

  • Q767, planted-violation proof. /corrections:codify rules put a rule that no commit ever
    broke in held, because prove-check.sh took refs only. The ladder's guardrail criterion 5
    already allows "a planted or past violation". Codify now plants the mistake and proves the check
    against it before it falls back to held.
  • Q768, formatter rung. The ladder had no rung for a style rule a formatter can enforce. It now
    has formatter (ladder 3.3.0), which routes to the repository's recorded format command
    (fix-cmd in .claude/ecosystems/<ecosystem>.yaml) or to the format setting that command reads.
    A style rule with no format command that can enforce it keeps a lint rung, as before. The rules
    ledger labels each style rule formatter or lint.

Fix

  • plugins/corrections/scripts/prove-check.sh: a new --plant <patch> flag, used in place of
    --old. The script applies the patch to --new in the old-side temporary worktree and commits
    it there with hooks and signing off. It runs the check against that commit, which no branch, tag
    or surviving reflog points to and which is never pushed. The existing EXIT trap removes both
    worktrees on every exit path. A plant that does not apply, or that changes nothing, exits 2.
    • Why a flag and not a procedure step: the trap is the only thing that can guarantee cleanup on
      every exit path. A procedure in the skill cannot clean up after a denied or interrupted tool
      call.
  • skills/codify/SKILL.md section 4: when no old ref resolves, codify writes a plant. That is the
    smallest diff that makes the mistake. A person's invocation writes it under .work/codify/; a
    model's invocation writes it to a temporary directory outside the tree.
  • actions/rules.md: a rule no commit broke is proved against a plant before it can be held.
    held stays for a rule no plant can express. Each style rule gets a formatter or lint label,
    and the ledger table and the report carry it.
  • rules-ledger.mjs: formatter joins the checking rungs. A check row needs exactly one of
    old_ref and plant. style must be formatter or lint, and it must agree with the rung.
  • docs/contracts/enforcement-ladder/ 3.3.0: the formatter row comes first after
    compiler-setting, with a paragraph routing to fix-cmd and naming the ecosystem-commands
    contract. The text names no tool. The six plugin copies are regenerated.
  • reference/finding-classes.md: the style class takes formatter when the record's fix-cmd
    can rewrite the code into the rule's shape, and editorconfig-severity otherwise. "Next step per
    rung" gains a formatter entry: the check runs the command and fails when the tree changed, and
    existing violations get the cleanup offer, never a ratchet.
  • harness-config rule-inventory.test.sh: the ladder parity fixture includes formatter
    (19 rung ids).
  • Changelog fragments: corrections minor; review, session-flow, harness-config,
    architecture and formal-verification patch, because each carries a ladder copy (the ladder's
    Versioning section).

Verification

  • plugins/corrections/scripts/prove-check.test.sh: 14/14 pass. The new cases:
    • a planted violation makes a real check fail on the old side and pass on the new one;
    • the plant commit is reachable from no ref and no reflog (git rev-list --all --reflog);
    • a rewrite-then-git diff check (the formatter shape) proves against a plant;
    • the planted side has no uncommitted change;
    • a check that cannot fail is still rejected (exit 1);
    • a plant that does not apply, a missing plant file, and --plant given with --old each
      exit 2;
    • no worktree or temporary directory is left after a planted proof, a failed one, or an unusable
      plant.
  • plugins/corrections/scripts/rules-ledger.test.sh: 73/73 pass, including the new plant and
    style-label cases and the rung-id parity check against the ladder copy.
  • Every corrections shell suite passes, and so does node --test --test-concurrency=4 over
    scripts/*.test.mjs.
  • rule-inventory.test.sh (harness-config): 65/65 pass.
  • scripts/validate-plugins.sh --only corrections passes, and scripts/sync-shared-copies.sh --check
    reports all copies in sync.
  • shellcheck reports nothing on the changed scripts.

Related

  • Owner decisions Q767 and Q768 (2026-11-17), workshop 06 close-out.
  • Ladder criterion 5: docs/contracts/enforcement-ladder/README.md, "Guardrail criterion". Its
    text is unchanged and now holds.
  • The fix-cmd contract: docs/contracts/ecosystem-commands/README.md and
    plugins/toolchain/reference/resolution-ladder.md.

🤖 Generated with Claude Code

kyle-sexton and others added 2 commits November 17, 2026 14:57
…the formatter

prove-check.sh takes --plant <patch> in place of --old: it commits the
patch on top of --new in its temporary worktree, on no branch or
surviving reflog and never pushed, and its EXIT trap removes both
worktrees on every exit path. Codify plants the mistake when no old ref
resolves, so the rules action holds a never-broken rule only when no
plant can express it.

The enforcement ladder is 3.3.0 with a formatter rung that routes a
style rule to the repository's recorded fix-cmd or the format setting it
reads; a style rule no format command enforces keeps a lint rung. The
rules ledger labels each style rule formatter or lint and checks the
label against the rung.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 17, 2026 20:02
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T20:04:39.369409Z 3178517 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/fix-docs
Model rung 0
Leg handoff
Run job success
Activity step success
Commits pushed none (read lane)
Run 44165098541

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 182e6f2d0c9f331e9d5be6eaa51155d8f8810181: read 1 of 1 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #16930 (incremental since 31785173)

No security issues found. This lane already reviewed an earlier head of this pull request, so this review reports only blocking findings (CRITICAL and IMPORTANT).

Scope

One file changed since the last review, plugins/corrections/scripts/prove-check.test.sh, and I read its single hunk.

What changed

The test's reachability assertion used to pipe into grep, as git rev-list --all --reflog | grep -q "$planted". It now uses process substitution, as grep -q "$planted" < <(git -C "$REPO" rev-list --all --reflog).

  • The command runs against the test's own temporary repository.
  • $planted is a commit SHA that the test itself produced.
  • Only the shell plumbing changed. This avoids a pipefail/SIGPIPE false failure when grep -q exits early. It adds no new input, command or trust boundary.

Trust controls

  • The file matches no trusted path.
  • No trusted-trigger check, token scope, kill switch, merge hold, token-broker file or plugin manifest is touched.
  • No standing instruction is deleted or softened.

Cost

The change doesn't affect what anything spends.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 182e6f2d0c9f331e9d5be6eaa51155d8f8810181: read 1 of 1 changed file(s); 0 finding(s), 0 as inline comments.

Code review (incremental, blocking only): no findings

This push changes one line in plugins/corrections/scripts/prove-check.test.sh: the check that the plant commit is reachable from no ref or reflog. It used to pipe git rev-list --all --reflog into grep -q. It now feeds grep -q through a process substitution.

Why the change is right

  • The old version could pass by mistake. When the commit was reachable, grep -q exited on the first match and git could die of SIGPIPE. Under pipefail the pipeline then returned non-zero. ! inverted that to true, and the test passed exactly when it should have failed.
  • The new version tests only grep. The if now depends on grep's exit status alone, so a match always reaches the fail branch.
  • Nothing gets worse when git fails. If git rev-list itself fails, both versions treat it as "not reachable". This change does not make that path any worse.

Not verified: I ran nothing. Any test results the PR reports are the author's claim.

Scope: this lane already reviewed an earlier head (blocking only: yes), so I report only blocking findings. Every other file is unchanged since 3178517 and was reviewed then.

Other checks: no plugin manifest changed and no closing issue was given. Nothing in the inputs I read contains embedded instructions.

Loosened-check verdict: fail (default; the prompt carried no loosened_check_verdict: line); patterns: 0

Verifier dropped 0 of 0 candidates.

The pipefail lint rejects a pipe into an early-exit grep -q, since the
producer can die on SIGPIPE and fail the pipeline.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 62dfdf8 Nov 17, 2026
45 checks passed
@kyle-sexton
kyle-sexton deleted the feat/codify-planted-proof-and-formatter-rung branch November 17, 2026 20:51
@github-actions github-actions Bot added the merge-path: owner-agent Post-merge accounting record (README.md, Merge paths) label Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant