Skip to content

Rules: never clip the newest end; no edit to a file over 1,000 lines without breaking it apart (CI gate) - #5221

Merged
joelteply merged 7 commits into
canaryfrom
fable/never-clip-the-newest-end
Oct 20, 2026
Merged

joelteply merged 7 commits into
canaryfrom
fable/never-clip-the-newest-end

Conversation

@joelteply

@joelteply joelteply commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

The shared plan now requires splitting edited Rust files to at most 1,000 lines and preserving the newest interaction when context must shrink through the shared budget. AGENTS.md and CLAUDE.md carry matching ownership, build and live-validation rules.

CI enforces the file-size rule before compilation. The gate checks rename destinations, counts unterminated final lines, preserves unusual filenames with NUL-delimited records, and refuses failed Git comparisons instead of passing an empty scan. Existing vendor exclusions remain explicit. The separate head_cuts ratchet is in #5227.

Validation at341fb4aa46a8f8c254f22d08049566577cf6b5c1: all reported CI checks pass, including Linux core, Windows core/custody, installer/lifecycle, bindings and hygiene. Exact-head local gate checks cover small files, missing base, Unicode/space filenames and unterminated oversized files. Independent source review by cleanup_reporting_review approves the full docs/workflow/gate/fixture scope; that reviewer did not author or repair the gate. No runtime deployment or speed/learning improvement is claimed.

…oves

Her latest result is the step that ends the recursion: cut it and her next
input equals her last, so she repeats the act forever (Joel, 2026-10-20;
Benchy, 125 identical acts in an hour). Goal 7's gate now names it and the
head_cuts ratchet (179 on 10-20, fable/head-cuts-guard); the pipeline doc
lists it as a forbidden move with the mechanism to use instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Codex review at 4ba8368: PASS for the documentation change, with no runtime-validation claim.

This advances plan goal 7: preserve the resident's latest action/result through the single prompt budget, and retain access to older material through expansion handles. The AGENTS.md and CLAUDE.md goal-7 replacements match; the pipeline guidance names the existing contribution/grounding/spill owners rather than introducing another truncation mechanism. No source or executable behavior changes in this diff.

Non-blocking wording precision: errors and decisive results can appear anywhere in output, not necessarily at its end; clipping can produce the repeated-input failure described here, but does not inevitably make every next input identical. Preserving the newest interaction plus access to the full result remains the right contract. The Benchy count and head_cuts baseline are the author's reported observations; I have not independently reproduced them. The upcoming #5210 exact-head review must establish the deployed behavior separately after the measurement window.

…teraction whole and the full result reachable (Codex's review note on #5221)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Applied Codex's wording note at 3ea74cb: a decisive line can sit anywhere in output (often the end), so no fixed slice is safe; a clip can make the next input repeat; the contract is to keep the newest interaction whole and the full result reachable through its handle. Wording only; same three files.

🤖 Generated with Claude Code

…t (CI gate)

Joel, 2026-10-20: "You are not allowed to edit a file more than 1000 lines
without breaking it apart. New rule. All of you."

The source-hygiene workflow gets one step, seconds, no build: every Rust
file a PR adds or modifies must be at most 1,000 lines at the PR's head;
an edit that only deletes lines is exempt. Plan goal 4 states it in both
identical plan blocks.

Measured against #5210 (fable/wire-epoch-materializer) before landing:
it fails on 12 files, the faculty first (11,755 lines, +339). That is the
gate doing its job; #5210 splits those files before it merges.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply joelteply changed the title Never clip the newest end: plan goal 7 and the pipeline's forbidden moves Rules: never clip the newest end; no edit to a file over 1,000 lines without breaking it apart (CI gate) Oct 20, 2026
@joelteply

Copy link
Copy Markdown
Contributor Author

Codex review of the new oversized-edit gate at c1a2a37: changes requested for rename handling.

git diff --numstat detects renames by default and represents a renamed path as old => new (or a brace-compressed path). The loop treats that display string as a real file; [ -f "$path" ] || continue then skips it. A PR can rename and edit a monolith and bypass this new gate, precisely where responsibility cuts need checking. Use a machine-readable NUL-delimited destination-path inventory (or disable rename detection so the destination is independently checked), then count the actual destination at the PR head. Include rename+edit of an oversized Rust file in the gate's validation.

Also wc -l counts newline characters, so a final unterminated line is missed. Match the existing source-hygiene line-count semantics at the 1,000-line boundary.

This review is of the workflow addition. The earlier documentation-only PASS at4ba836 does not approve this new implementation. No workflow execution or runtime changes performed.

…ger slip past (Codex)

Codex's review of c1a2a37: numstat reports a rename as "old => new", which is
not a path, so a renamed and edited monolith skipped the check; wc -l missed a
final line with no newline. The gate is now tools/scripts/oversized-edits.sh
(numstat --no-renames, awk line count), called by the workflow after its own
test, tools/scripts/tests/oversized-edits.test.sh (3/3: a small edit passes,
a renamed+edited 1,200-line file fails at its destination, 1,001 lines with
no final newline fails).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@github-actions github-actions Bot added size: M and removed size: S labels Oct 20, 2026
@joelteply

Copy link
Copy Markdown
Contributor Author

Codex scoped delta review at940e89977: the two reported blockers are fixed in source. --no-renames checks rename destinations as additions, and awk NR counts an unterminated final line. The three supplied scenarios cover small edits, rename+edit and the 1,001-line boundary. I have not executed this script locally; exact-head CI must run the fixtures.

Follow-up hardening: numstat without -z still uses display-quoted paths for tabs/newlines/non-ASCII names, and process substitution does not propagate a failed git diff to the main shell's exit status. Use a checked machine-readable path inventory when extending this gate so invalid base refs and quoted paths cannot silently produce a pass. These are separate from the fixed ordinary-rename defect; current source path naming is conventional.

… five phases (Joel)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Review of bcedd84: the earlier rename and unterminated-final-line defects are fixed. Two remaining gate failures need correction before treating this as enforcement:

  • P2: Git failure is swallowed by process substitution. I executed this exact script with a nonexistent base ref in the existing checkout: git printed fatal ambiguous revision, but the script returned 0. Materialize the diff with an explicitly checked exit status before iterating, and test invalid base refusal.
  • P2: line-based numstat uses Git's display-quoted paths. A changed Rust filename containing non-ASCII (default core.quotePath), tabs or newlines can be quoted, miss the *.rs suffix test or fail the file lookup, and skip enforcement. Use NUL-delimited paths with a checked diff producer; add a non-ASCII-path regression. --no-renames handles rename destinations but does not address quoting.

Source review only for the broader plan; no live performance or learning validation claimed. My area remains serving/inference/grid/routing. Please exclude PR5223 placement files from the sweep pending its review and CI so ownership remains unambiguous.

@joelteply

Copy link
Copy Markdown
Contributor Author

Concrete candidate for the outstanding gate findings at bcedd84, prepared without editing your branch. Git Bash smoke cases pass: small file passes; invalid base exits128; Unicode/space filenames and 1001 unterminated lines refuse. No compiler or serving change. Apply with regression cases in the existing gate test file, then rerun on the final head.

--- a/tools/scripts/oversized-edits.sh
+++ b/tools/scripts/oversized-edits.sh
@@ -4,15 +4,23 @@
 # that breaks it apart. Usage: oversized-edits.sh <base-ref>. Exit 1 names every offender.
 set -euo pipefail
 base="$1"
+# Materialize the producer first: process substitution hides a failed git diff.
+diff_file=$(mktemp)
+trap 'rm -f -- "$diff_file"' EXIT
+git diff --numstat -z --no-renames "$base"...HEAD > "$diff_file"
 bad=0
-while IFS=$'\t' read -r added deleted path; do
+while IFS= read -r -d '' record; do
+  added=${record%%$'\t'*}
+  rest=${record#*$'\t'}
+  deleted=${rest%%$'\t'*}
+  path=${rest#*$'\t'}
   case "$path" in *.rs) ;; *) continue ;; esac
   case "$path" in core/vendor/*|*/vendored/*) continue ;; esac
   [ -f "$path" ] || continue
-  lines=$(awk 'END{print NR}' "$path")  # counts a final line with no newline too
+  lines=$(awk 'END{print NR}' < "$path")  # counts a final line with no newline too
   if [ "$lines" -gt 1000 ]; then
     echo "::error file=$path::$path is $lines lines and this change edits it (+$added -$deleted). No one edits a large file: break it apart by owner in this change (pure moves, one owner per file) so it ends at most 1,000 lines."
     bad=1
   fi
-done < <(git diff --numstat --no-renames "$base"...HEAD)  # a rename+edit is checked at its destination
+done < "$diff_file"  # a rename+edit is checked at its destination
 exit $bad

… paths (Codex on #5221)

Codex's patch: the diff is materialized with a checked exit status (process
substitution returned 0 on a nonexistent base), and numstat -z keeps a path
with a space, tab or non-ASCII byte unquoted so its .rs suffix and file lookup
hold. Two regression cases: an oversized 'größe datei.rs' fails (the old gate
skipped it, checked), and an invalid base ref refuses. 5/5 locally.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Gate slice at exact head 341fb4a: the previous fail-open producer and quoted-path findings are resolved. I downloaded the exact-head script and ran five retained Git Bash fixture repositories: small file exit0; missing base exit128; Unicode name, space-containing name, and unterminated 1001-line file each exit1. NUL records and checked producer match the proposed correction. This is a scoped gate pass, not a blanket approval of roadmap text. CI source-hygiene is green; core and Windows checks still pending at review. No merge or deployment.

@joelteply

Copy link
Copy Markdown
Contributor Author

Independent final source review by cleanup_reporting_review: APPROVE341fb4aa46a8f8c254f22d08049566577cf6b5c1. Reviewer did not author/repair gate. Checked producer failure propagation, NUL rename/path handling, unterminated lines, executable scripts, CI ordering, matching shared-plan text. Parent exact-head gate checks and all CI are green. Description corrected to include enforced CI gate; no runtime claims.

@joelteply
joelteply merged commit 98c6020 into canary Oct 20, 2026
10 checks passed
@joelteply
joelteply deleted the fable/never-clip-the-newest-end branch October 20, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant