Skip to content

build: ratchet instruction file byte budgets - #5132

Merged
jakildev merged 2 commits into
masterfrom
claude/4970-task
Nov 17, 2026
Merged

jakildev merged 2 commits into
masterfrom
claude/4970-task

Conversation

@jakildev

@jakildev jakildev commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Enforce LF-normalized byte budgets beside existing instruction line budgets.
  • Record current byte-cap exceptions and cover byte ratcheting plus deleted tracked files.

Test plan

  • bash scripts/fleet/tests/run_all.sh --only lint_instruction_size
  • fleet-positive-control scripts/fleet/tests/test_lint_instruction_size.py origin/master --include scripts/lint_instruction_size.py --include scripts/ratchet_against.py
  • python3 scripts/lint_instruction_size.py --against origin/master
  • ruff check scripts/
  • python3 scripts/fleet/tests/test_validation_index.py

Acceptance evidence

Criterion Check run Observed
Byte cases and missing working-tree files bash scripts/fleet/tests/run_all.sh --only lint_instruction_size 1 suite passed; byte ratchet, +800 warning / +801 failure band boundaries, and missing-file cases included
Positive control fleet-positive-control ... origin/master 6 of 35 assertions fail against pre-change code
Ratchet report python3 scripts/lint_instruction_size.py --against origin/master exit 0; three byte baseline entries reported as reviewed raises; flat run has no byte offenders
Python lint ruff check scripts/ All checks passed
Validator index python3 scripts/fleet/tests/test_validation_index.py 5 tests passed

Notes for reviewer

fleet-pr-overlap --base master found only inherited base conflicts on the
cross-cutting validation row (PRs #5101, #5110, #5119, #5121, and #5124).

Closes #4970

Measure instruction files in LF-normalized bytes alongside their existing line budgets. Record current byte-cap exceptions and preserve inherited-offender handling when a base ref predates the new baseline.
@jakildev jakildev added fleet:wip Work in progress — not ready for review fleet:author-codex Implementation last authored by Codex; route review to Claude fleet:authored-on-macos PR was authored and smoke-tested on macOS Metal backend and removed fleet:wip Work in progress — not ready for review labels Nov 17, 2026

@jakildev jakildev left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review — build: ratchet instruction file byte budgets

Verdict: needs-fix

The byte ratchet works and is well tested for the line-cap/byte-cap split, recorded-budget and inherited cases, but plan criterion 1(e), the byte warning band, has no test, so the byte ::warning / ::error paths and BYTE_WARN_BAND run in no test.

Needs-fix

  • scripts/fleet/tests/test_lint_instruction_size.py (AgainstRef, beside test_an_introduced_excess_within_the_band_warns_and_passes / test_an_introduced_excess_past_the_band_fails, ~line 381–398) — the issue's acceptance criterion requires "an excess inside the 800-byte band warns and passes, past it fails", and the PR's byte-side --against coverage is the inherited case only (grep of the test file for band/800/BYTE_WARN finds only the line-band cases). Add two cases: an introduced byte excess of ≤800 (e.g. +800) exits 0 with within the 800-byte band, and +801 exits 1 with past the 800-byte band. Keep the line count under the line cap so only the byte path fires. Then re-run fleet-positive-control and update Row 1 of the evidence table to name the band cases.

Nits (follow-up)

  • scripts/lint_instruction_size.py (main, args.warn_band) — --warn-band moves only the line band; the byte band is the fixed BYTE_WARN_BAND, so --warn-band 0 still tolerates 800 bytes. State "lines only" in the docstring and the VALIDATION.md row, or scale the flag by 80 for bytes.
  • scripts/lint_instruction_size.py module docstring — the regeneration sentence still names only write_baseline(scan_tree()[0]), and the line "so it shows in the PR diff where a reviewer weighs it. The baseline is regenerated only when" is now over-long; mention the byte baseline.
  • scan_tree / scan_bytes are near-duplicate loops; a shared iterator over instruction files would keep the two in step.

Acceptance (issue #4970)

4 of 5 met. Unmet:

  • Criterion 1(e): byte band warns at ≤800 and fails past it — no test exercises an introduced byte excess (mirrored in Needs-fix above).

Checked

  • Read the full diff and scripts/lint_instruction_size.py / scripts/ratchet_against.py at head 696c2a4.
  • Ran scripts/fleet/tests/test_lint_instruction_size.py: 33 tests, OK.
  • Ran scripts/lint_instruction_size.py --against origin/master: exit 0; three byte ::notice budget raised lines (16000 → 16105 / 20823 / 17883) match the new baseline; the nine line offenders are all inherited (same on master).
  • Combined exit-code logic for line + byte report_against reads correct (2 > 1 > 0; None only when neither side is over).
  • CI: instruction-size, instruction-refs, python-lint, comment-refs, whitespace, closes-lint, no-plan-files green on the head; fleet-tests and render-harness-tests still running at review time, so unread — I ran the fleet suite for this script locally instead.
  • Not independently re-run: the 4-of-33 positive-control figure.

Escalation: author-agent to address, then re-request review.

🤖 Reviewed by Claude Sonnet 5.5 (review-pr skill)

Opus recheck not required.

@jakildev jakildev added fleet:needs-fix Fleet reviewer found issues — author must address and removed fleet:reviewing-mac-pool-1 labels Nov 17, 2026
@jakildev jakildev added fleet:changes-made Agent addressed human feedback — ready for human re-review and removed fleet:needs-fix Fleet reviewer found issues — author must address fleet:amending-mac-pool-1 labels Nov 17, 2026
@jakildev

Copy link
Copy Markdown
Owner Author

Addressed feedback:

  • Byte warning band coverage — added introduced-byte boundary cases proving +800 emits a warning and exits 0, while +801 emits an error and exits 1; both fixtures remain one line and therefore below the line cap.
  • Acceptance evidence — reran the focused suite (35 tests), positive control (6 of 35 assertions fail against pre-change code), ratchet, ruff, and validator-index checks; updated Row 1 and the positive-control count in the PR body.
  • Follow-up nits — not included in this amendment because the review explicitly marked them follow-up work; they remain for the next PR on this surface under the fleet feedback protocol.

— worker (Codex)

@jakildev jakildev removed the fleet:changes-made Agent addressed human feedback — ready for human re-review label Nov 17, 2026

@jakildev jakildev left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review — build: ratchet instruction file byte budgets

Verdict: approve

The one prior needs-fix (no test of the byte warning band) is closed by two new boundary tests at ea07fc0, and nothing else changed since the last review.

Prior-review resolution

  • ✅ scripts/fleet/tests/test_lint_instruction_size.py (AgainstRef) — byte band untested — verified fixed at ea07fc0: test_an_introduced_byte_excess_within_the_band_warns_and_passes (+800 → rc 0, ::warning … within the 800-byte band) and test_an_introduced_byte_excess_past_the_band_fails (+801 → rc 1, ::error … past the 800-byte band). Both fixtures are one line, so only the byte path fires.
  • ↗ Nits (follow-up) from the first pass (--warn-band lines-only wording, module docstring regeneration sentence, scan_tree/scan_bytes duplication) — deliberately deferred by the author; they ride the next PR on this surface, no label.

Acceptance (issue #4970)

5 of 5 met (criterion 1(e) now covered by the two band tests).

Checked

  • Read the delta 696c2a4..ea07fc0 (test file only, +32 lines); no executable code changed.
  • Ran scripts/fleet/tests/test_lint_instruction_size.py at head: 35 tests, OK.
  • Ran scripts/lint_instruction_size.py --against origin/master: exit 0; three byte ::notice budget raised lines match the baseline; the five line offenders shown are inherited.
  • CI: instruction-size, instruction-refs, python-lint, comment-refs, whitespace, closes-lint, no-plan-files green on the head; fleet-tests and render-harness-tests had not completed at review time, so unread — I ran the suite for this script locally instead.
  • Not independently re-run: the 6-of-35 positive-control figure.

Escalation: none. Safe for merge.

🤖 Reviewed by Claude Sonnet 5.5 (review-pr skill)

Opus recheck not required.

@jakildev jakildev added fleet:approved Fleet reviewer approved — ready for human merge and removed fleet:reviewing-mac-pool-5 labels Nov 17, 2026
@evin-mac-claude-app evin-mac-claude-app Bot added the fleet:checks-red Info only: approved PR whose head has a failed check of its own; reconcile R12 adds and removes it label Nov 17, 2026
@jakildev
jakildev merged commit b6e3921 into master Nov 17, 2026
11 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fleet:approved Fleet reviewer approved — ready for human merge fleet:author-codex Implementation last authored by Codex; route review to Claude fleet:authored-on-macos PR was authored and smoke-tested on macOS Metal backend fleet:checks-red Info only: approved PR whose head has a failed check of its own; reconcile R12 adds and removes it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fleet: budget instruction files by bytes as well as lines

1 participant