Skip to content

ci: panic budgets move from an inline ci.yml step to scripts/panic-budgets.tsv - #448

Merged
linyiru merged 3 commits into
masterfrom
ci/panic-budget-data
Oct 11, 2026
Merged

linyiru merged 3 commits into
masterfrom
ci/panic-budget-data

Conversation

@linyiru

@linyiru linyiru commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Item C (second part) of the agent-native plan.

The panic-budget step was 670 lines of bash plus budget history inline in ci.yml, so every budget bump edited the 1,700-line workflow (15 of the last 300 commits touched ci.yml) and there was no way to run the gate locally except through it.

  • scripts/panic-budgets.tsv: the 42 budgets with their history comments, moved verbatim (generated mechanically from the step body). Format <file>\t<budget>[\t<note>], # lines are history.
  • scripts/panic-budget.sh: the same counting logic and fail-closed sweep; the CI step is now bash scripts/panic-budget.sh. ci.yml shrinks by 669 lines.
  • New: a row naming a deleted file, or a row without a tab-separated numeric budget, is an ::error instead of a silent pass.
  • Docs (CLAUDE.md, CI_GATES.md, PANIC_AUDIT.md, CHANGELOG) point at the new location. Separate commit: CI_GATES.md records that the Windows check is now required (10 required checks, verified via the protection API).

Equivalence: on this tree the script's output is byte-identical to the old step's (75 lines, exit 0, diffed). Negative tests: an extra .unwrap() in commdrv.rs → 2 > 1 error, exit 1; a space instead of a tab → row error, exit 1. scripts/check.sh still resolves the Count panics step (--dry-run clean); shellcheck clean.

🤖 Generated with Claude Code

The panic-budget step was 670 lines of bash and budget history inline
in ci.yml, so every budget change edited the 1,700-line workflow and
collided with unrelated CI changes. The 42 budgets and their comments
move verbatim to scripts/panic-budgets.tsv (file, budget, note), the
counting logic to scripts/panic-budget.sh, and the step runs the
script. ci.yml shrinks by 669 lines.

Equivalence: the new script's output is byte-identical to the old
step's (75 lines, exit 0) on this tree. A new unwrap over budget, and
a row with a space instead of a tab, both fail with an ::error line.
A row naming a deleted file is now an error instead of a silent pass.
CLAUDE.md, CI_GATES.md and PANIC_AUDIT.md said the budgets lived in an
inline ci.yml step and that there was no local script. Name the data
file and scripts/panic-budget.sh instead, and change the lowering
procedure to edit the TSV row.
Its full name reached master with #446, so it was added to master's
required checks (10 in total, verified via the protection API).
Copilot AI balanced review requested due to automatic review settings October 11, 2026 04:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The extracted gate preserves the existing behavior while adding useful validation and consistent documentation.

0 open findings

What changed in this PR

Moves panic-budget enforcement from inline CI YAML into reusable scripts and documents the new source of truth.

Changes:

  • Adds TSV-backed panic budgets with validation and fail-closed enforcement.
  • Simplifies CI to invoke the standalone script.
  • Updates documentation, changelog, and required-check records.
File Description
scripts/​panic-budgets.tsv Stores per-file budgets and history.
scripts/​panic-budget.sh Implements validation and enforcement.
.github/​workflows/​ci.yml Replaces inline logic with the script.
docs/​PANIC_AUDIT.md Documents the new budget location.
docs/​CI_GATES.md Updates gate instructions and required checks.
CLAUDE.md Updates contributor guidance.
CHANGELOG.md Records the CI refactor.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@linyiru
linyiru merged commit 1a7542f into master Oct 11, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants