Skip to content

feat(ci): add soft budget warnings to xtask ci plan#3767

Draft
EffortlessSteven wants to merge 1 commit intoclaude/improve-bitnet-ci-AkGLc-L-policy-budgetfrom
claude/improve-bitnet-ci-AkGLc-O-budget-warnings
Draft

feat(ci): add soft budget warnings to xtask ci plan#3767
EffortlessSteven wants to merge 1 commit intoclaude/improve-bitnet-ci-AkGLc-L-policy-budgetfrom
claude/improve-bitnet-ci-AkGLc-O-budget-warnings

Conversation

@EffortlessSteven
Copy link
Copy Markdown
Member

Summary

Builds on PR L (BudgetPolicy + load_budget_policy). The planner now computes a Vec<BudgetWarning> and emits GitHub workflow commands (::warning::, ::error::, ::notice::) so PR Plan annotates the run when estimated LEM exceeds the configured thresholds.

This is PR O in the multi-PR CI roadmap. Stacked on PR L (#3761) → K (#3758); will retarget main as the stack lands.

Tiering

Configurable via policy/ci-budget.toml. Default thresholds:

Estimated LEM Level Notes
≤ 25 (preferred_default_lem) none normal
26–35 (default_limit_lem) notice "above preferred default"
36–75 (elevated_limit_lem) warning "review touched-area mapping"
76–125 (hard_limit_lem) warning "is high; review lane breadth"
> 125 error references the override labels

The error level is downgraded to warning when the PR carries the full-ci or ci-budget-override label.

Informational only

PR O does not block merges:

  • run() still returns Ok(()) regardless of warning level.
  • The PR Plan workflow already has continue-on-error: true — even ::error:: does not fail the job.
  • Hard enforcement (failing the status check) is a deliberate future change, gated on observed actuals from PR N (ci-actuals.yml).

Schema additions to ci-plan.json

"warnings": [
  { "level": "warning", "message": "Estimated CI spend 56 LEM is high (> 75); review whether this PR genuinely needs this lane breadth." }
]

Step summary now includes a "Budget warnings" section with icons (ℹ️ / ⚠️ / 🚨).

Tests (5 new, 19 total passing)

Test Asserts
warnings_empty_for_pennies_band empty PR → no warnings
warnings_notice_above_preferred_default Cargo.lock-only PR crosses 35 → warning tier
warnings_error_at_hard_ceiling_without_override full-ci + kernel diff crosses 125 with override → warning
warnings_emit_error_when_over_ceiling_without_label stricter policy fixture; error tier without override
ci_budget_override_label_downgrades_error_to_warning ci-budget-override label downgrades the error
cargo test --locked --no-default-features -p xtask --bin xtask ci_plan
# test result: ok. 19 passed; 0 failed

Out of scope

  • PR P: ripr advisory → soft-gate promotion (consumes lane.stage taxonomy from PR K).
  • Hard budget enforcement (status check) — future PR after a few weeks of actuals.
  • Aggregating actuals across runs into a durable dashboard.

https://claude.ai/code/session_01S2yTnEYJcA3G2CyZn9bY4v


Generated by Claude Code

Builds on PR L (BudgetPolicy + load_budget_policy). The planner now
computes a Vec<BudgetWarning> and emits GitHub workflow commands
(::warning::, ::error::, ::notice::) so PR Plan annotates the run when
estimated LEM exceeds the configured thresholds.

Tiering (configurable via policy/ci-budget.toml):
  - estimated > preferred_default_lem  → notice
  - estimated > default_limit_lem      → warning
  - estimated > elevated_limit_lem     → warning (stronger language)
  - estimated > hard_limit_lem         → error
                                          (downgraded to warning when
                                           full-ci or ci-budget-override
                                           label is present)

This PR is INFORMATIONAL ONLY:
  - run() still returns Ok(()) regardless of warning level.
  - PR Plan workflow has continue-on-error: true — even ::error:: does
    not fail the job.
  - Hard enforcement (failing the status check) is a deliberate future
    change, gated on observed actuals from PR N (ci-actuals.yml).

Schema additions to ci-plan.json:
  - "warnings": [{ "level": "notice"|"warning"|"error", "message": "..." }]

Step summary now includes a "Budget warnings" section with icons
(ℹ️ / ⚠️ / 🚨).

Tests added (5 new, 19 total passing):
  - warnings_empty_for_pennies_band
  - warnings_notice_above_preferred_default (turned into a warning
    when 35 LEM threshold is crossed by Cargo.lock-only PRs)
  - warnings_error_at_hard_ceiling_without_override
  - warnings_emit_error_when_over_ceiling_without_label (using a
    stricter policy fixture to verify error-tier without needing
    a 125+ LEM real diff)
  - ci_budget_override_label_downgrades_error_to_warning

Stacked on PR L (#3761) → K (#3758). Will rebase to main as the
stack lands.
@gemini-code-assist
Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1c925037-fbfd-492c-8d0e-2586b45a5337

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/improve-bitnet-ci-AkGLc-O-budget-warnings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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