8000 fix: fail instruction-budget when a surface grows past its declared count by inkatze · Pull Request #267 · inkatze/dotfiles · GitHub
[go: up one dir, main page]

Skip to content

fix: fail instruction-budget when a surface grows past its declared count - #267

Merged
inkatze merged 4 commits into
mainfrom
planwright/flight/mc-dotfiles-ad-hoc-8728f719
Nov 14, 2026
Merged

inkatze merged 4 commits into
mainfrom
planwright/flight/mc-dotfiles-ad-hoc-8728f719

Conversation

@inkatze
@inkatze inkatze commented Nov 14, 2026 •
Copy link
Copy Markdown
Owner

What

instruction-budget.sh now fails when a surface's measured word count is greater than its declared n, naming the path, both numbers and the --count command that re-derives the row. Previously only the thresholds and the measured count were checked, so a row left one word behind (7250 declared, 7251 measured) passed.

Why growth-only, not exact equality

The header asks a change that grows a surface to re-derive its row. Other commits shrink surfaces without touching the guard, and failing those would force a row edit nobody asked for and block unrelated prose trims. A shrunk surface stays allowed; its row only goes stale-high, which the thresholds still cover.

Rows behind --count on main

Checked every row against --count on main: one was behind. Root CLAUDE.md declared 1703 and measures 1717; re-derived to 1717. By the rule the thresholds stay 2000/2500, so no ceiling moved.

Main moved while this was open (its bot-review row went to 7251 in the same file); the merge keeps that row beside CLAUDE.md 1717, and the guard passes on the merged tree.

Tests

Fail-first: the new fixtures were added before the fix and run against the unfixed script, which failed 3 cases (warn-range, growth-past-declared, growth-names-command). With the fix all cases pass. New fixtures: growth past n fails, a row behind the measured count fails, a zero-padded n passes, a shrink below n passes. Because any count past the warn threshold is also growth past n, the warn tier no longer appears without an error; warn-range now expects the failure.

Bot review

cubic refused on quota ("reached its free monthly review limit", reviews resume 2 December 2026), so PR-Agent is the counted bot review. Its one finding (leading-zero handling in the threshold arithmetic) was declined with proof: instruction-budget.sh:111 already uses 10#$n, unchanged from main, and the leading-zero-count fixture passes.

Step records

Steps at convergence (run 000001)

# Step Kind Target Hosting Backend Session Head Start End Outcome Excerpt Output
1 polish skill /home/inkatze/.claude/plugins/cache/planwright/planwright/0.75.2/skills/polish/SKILL.md in-session in-session f342368 to f1c4ef1 2026-11-14T20:48:25Z 2026-11-14T20:59:49Z applied
2 panel-review skill /home/inkatze/.claude/skills/panel-review/SKILL.md in-session in-session f1c4ef1 to ad990d4 2026-11-14T20:59:49Z 2026-11-14T21:27:19Z applied

Ended on ad990d449217.

Steps at pre-implementation (run 000001)

# Step Kind Target Hosting Backend Session Head Start End Outcome Excerpt Output
none

Ended on ad990d449217.

Steps at pre-ci (run 000001)

Output
# Step Kind Target Hosting Backend Session Head Start End Outcome Excerpt
none

Ended on ad990d449217.

Steps at pre-pr (run 000001)

# Step Kind Target Hosting Backend Session Head Start End Outcome Excerpt Output
none

Ended on ad990d449217.

Steps at post-pr (run 000001)

# Step Kind Target Hosting Backend Session Head Start End Outcome Excerpt Output
1 bot-review skill /home/inkatze/.claude/skills/bot-review/SKILL.md in-session in-session 2243101 2026-11-14T22:16:33Z 2026-11-14T22:28:10Z passed cubic refused on quota ('reached its free monthly review limit', reviews resume 2 December 2026); PR-Agent counted as the bot review; its one finding rejected as a proven decline (10#​$n already at instruction-budget.sh:111), reply posted, no inline thread to resolve

Ended on 2243101ec8a0.


Summary by cubic

Makes instruction-budget.sh fail when a surface's measured word count exceeds its declared n, so a row left one word behind no longer passes. The error names the path, both numbers, and the runnable --count command to re-derive the row. Shrinking below n stays allowed, since only growth must re-derive the row.

Also corrects the root CLAUDE.md row from 1703 to 1717 and adds tests for growth past n, a count behind the declared row, a zero-padded n, and a shrink that stays within budget.

Written for commit 2243101. Summary will update on new commits.

View guided diff Turn on auto-fix

@inkatze
inkatze commented Nov 14, 2026
Copy link
Copy Markdown
Owner Author

@cubic-dev-ai review this PR

@cubic-dev-ai
cubic-dev-ai Bot commented Nov 14, 2026
Copy link
Copy Markdown

@cubic-dev-ai review this PR

@inkatze cubic can't start this review because your workspace has reached its free monthly review limit. cubic has reviewed 40,041 of the 40,000 allowed lines of code this month. Reviews resume on 2 December 2026 (in 19 days). Paid plans include much higher monthly review limits. Upgrade now to resume reviews.

To help optimise your usage, you can tune cubic to get the most out of your usage limits:

Learn more →

@inkatze
inkatze commented Nov 14, 2026
Copy link
Copy Markdown
Owner Author

/review

@github-actions
Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Inconsistent leading-zero handling

The new growth check correctly forces decimal interpretation with $((10#$n)), but the threshold validation directly above it uses raw $n in $((250 * ((n + 249) / 250) + 250)). A declared count with a leading zero (e.g. 01951) is parsed as octal by that validation, producing either an arithmetic error (if it contains digits 8-9) or incorrect thresholds. The leading-zero-count fixture therefore hits the threshold code before the growth check can handle it; the threshold arithmetic should also use $((10#$n)).

expected_e=$((expected_w + 500))
if [ "$w" != "$expected_w" ] || [ "$e" != "$expected_e" ]; then
  err "$path" "thresholds $w/$e do not match the rule for declared count $n (expected $expected_w/$expected_e)"
fi
if ! count="$(count_words "$path" 2>/dev/null)"; then
  err "$path" "surface is declared but cannot be read"
  continue
fi
# Growth past n means the row was not re-derived; shrinking needs no edit.
if [ "$count" -gt "$((10#$n))" ]; then
  err "$path" "$count words, declared n=$n: re-derive the row with: $0 --count $path"
fi

@github-actions
Copy link
Copy Markdown

PR-Agent run 43645495058.1 on 2243101: success

@inkatze
inkatze commented Nov 14, 2026
Copy link
Copy Markdown
Owner Author

Not an issue: the threshold arithmetic already forces base 10 with 10#$n (instruction-budget.sh:111, unchanged from main), and the leading-zero-count fixture exercises a zero-padded n end to end.

@inkatze
inkatze marked this pull request as ready for review November 14, 2026 22:32
@inkatze
inkatze merged commit 7a09a81 into main Nov 14, 2026
6 checks passed
@inkatze
inkatze deleted the planwright/flight/mc-dotfiles-ad-hoc-8728f719 branch November 14, 2026 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0