Skip to content

fix(output): keep the highest-priority findings under the check-JSON byte budget and name what was dropped (#10093) - #10094

Merged
EffortlessSteven merged 3 commits into
mainfrom
fix/check-findings-budget-priority-10093
Oct 24, 2026
Merged

EffortlessSteven merged 3 commits into
mainfrom
fix/check-findings-budget-priority-10093

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Governing issue or accepted claim: #10093
Acceptance delta (one sentence): When the check-JSON findings-array byte budget engages it keeps the highest-priority findings instead of a file-order prefix, and the limited_findings_bound message names what was dropped per class and file.

Before

  • The budget cut in sort_findings order, so the last files lost findings first (indexmap ddb0316: 61 of 68 rendered; the 7 hidden were all the changed map.rs:967 weakly_exposed finding).
  • The limitation message said only rendered R of T findings ....

After

  • Under an engaged budget, findings render in a deterministic priority order: candidate-current before base-side/unresolved, then reachable_unrevealed, weakly_exposed, no_static_path, unknown classes, exposed last, then a recommended next step, then sort order as tiebreak. The kept set is emitted in the unchanged sort order.
  • finding_alignment is computed over exactly the kept findings.
  • Message adds the keep-priority rule and omitted N: by class ...; by file ... (5 files named, rest counted, base-side/unresolved count when present), still naming RIPR_CHECK_FINDINGS_BYTES and =0.
  • A budget that does not engage, and =0 (streamed with no sort or buffering), are byte-identical to before. No schema field added, no default change.

How

  • New output/json/findings_priority.rs (priority key, order, omitted summary); report.rs renders per-finding payloads in priority order until the budget is exceeded, then emits the kept set in index order.
  • Tests: late-file weakly_exposed beats earlier exposed/unknown, base-side demoted, kept set in sort order, roomy budget keeps all, ties keep sort order, next-step tiebreak (with a control), and a CLI smoke check that the retained finding has the strongest class. Existing budget tests that encoded "first in file order is kept" were updated deliberately.
  • Spec 0122, OUTPUT_SCHEMA.md, CONFIGURATION.md, traceability and a changelog.d fragment updated; stale "prefix" wording in consumers replaced (comments only).

Verified

  • cargo test -p ripr --lib output::json (103 passed), cli_smoke budget tests, cargo xtask goldens check, cargo xtask precommit exit 0.
  • Independent exact-head review plus a delta review: no blocking findings; mutation checks on class order, currentness, next-step tiebreak and re-sort were killed by tests; review nits and Gemini suggestions applied. The last push (cbc39e2) changed only a doc example and a comment.

Not verified

  • Not re-run against the indexmap repro; within one class and currentness the sort order still decides, so ties can still hide a late finding (noted in the changelog fragment).
  • Human output is not bounded by this byte budget (own 20-finding window naming RIPR_CHECK_FINDINGS_BYTES=0), so no human change.
  • Hosted CI on this head.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AUS4vFoCEv5DiNwucKqSbC

…byte budget and name what was dropped (#10093)

When RIPR_CHECK_FINDINGS_BYTES engages, findings render in a deterministic
priority order (candidate-current first, then reachable_unrevealed,
weakly_exposed, no_static_path, unknown classes, exposed last, recommended
next step, sort order as tiebreak) and the kept set is emitted in the
unchanged sort order. The limited_findings_bound message now names dropped
counts per class and file. An unengaged budget is byte-identical.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AUS4vFoCEv5DiNwucKqSbC
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 30 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 158 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: 72a86aca-9421-49c1-b7a6-97567e40eff6
Commits

Reviewing files that changed from the base of the PR and between 0e80f82 and cbc39e2.

Files selected for processing: 13
  • .ripr/traceability.toml
  • changelog.d/10093-check-findings-budget-priority.md
  • crates/ripr/src/agent/artifact.rs
  • crates/ripr/src/cli/commands/review_comments.rs
  • crates/ripr/src/output/gap_decision_ledger.rs
  • crates/ripr/src/output/gate.rs
  • crates/ripr/src/output/json/findings_priority.rs
  • crates/ripr/src/output/json/mod.rs
  • crates/ripr/src/output/json/report.rs
  • crates/ripr/tests/cli_smoke/findings_byte_budget.rs
  • docs/CONFIGURATION.md
  • docs/OUTPUT_SCHEMA.md
  • docs/specs/RIPR-SPEC-0122-bounded-human-check-output.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request refactors the ripr check --format json findings-array byte budget to prioritize keeping the most actionable findings (such as candidate-current and stronger gap classes) rather than cutting them off in file order. It also enhances the limited_findings_bound message to report the counts of omitted findings by class and file. The review feedback suggests two valuable performance optimizations: implementing a fast path to bypass priority sorting and allocations when no budget is set, and using &Path keys in the omitted summary map to avoid redundant string allocations for every omitted finding.

Comment thread crates/ripr/src/output/json/report.rs Resolved

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Decision

  • Needs reviewer attention before upstream: findings remain.

Confirmed findings

  • The budgeted array calculation includes a separator for the first retained finding and excludes it for the last, so the accounted byte count differs from the documented payloads-plus-separators definition by one byte.
  • The unbounded JSON path now sorts findings and allocates every rendered payload before emitting it.

Verification questions

  • Confirm the CLI smoke test proves deterministic budgeted output and that the retained finding belongs to the analyzed set, but does not assert the specific retained identity against the priority ordering.
  • Confirm the implementation’s budget accounting includes each payload plus a two-byte separator for every finding after the first, while tests exercise exact lead-payload and lead-plus-one boundaries but do not independently assert total emitted array-byte semantics for a multi-finding case.

Refuted

  • The byte-budget limitation may omit the names of dropped files or classes.; refuted because: The omitted summary computes counts for every omitted finding and formats class counts plus up to five files, with a remainder count.
  • The budget accounting could omit the separator or admit an oversized first payload.; refuted because: Each payload is counted, later payloads add the two-byte separator, and the prior contract intentionally renders at least one finding even when it exceeds the budget.

Evidence gaps

  • Cargo-test evidence was still scheduled late while the ripr sensor failed with exit code 2, so the changed Rust behavior lacks a recorded passing automated proof in the packet.
  • Model proof intent was rejected by deterministic validation.
  • The ripr proof sensor failed without a supplied diagnostic, so its result cannot establish whether the changed Rust behavior passes the repository's own checks.

Test the next-step tiebreak, name it in the limitation message and changelog,
stream directly with no priority sort or buffering when the budget is off, key
the omitted-file map by path, assert the retained finding's class in the CLI
test, and replace stale prefix wording with bounded subset.

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

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Confirmed findings

  • The documented budget is defined as emitted array bytes, but the new accounting does not clearly equal emitted bytes for multi-finding retained sets; a boundary regression could allow output over budget.
  • The code and comments explicitly allow the first over-budget finding to render, so the effective bound can exceed RIPR_CHECK_FINDINGS_BYTES by one payload plus separator. This is a contract clarification or implementation decision, not a demonstrated regression.

Verification questions

  • Confirm the budgeted renderer retains the first finding whose cumulative payload-plus-separator size exceeds the budget, then reports it as rendered.
  • Confirm the smoke test proves determinism and class-rank priority, but it does not assert the exact retained identity for every possible tie or currentness case.
  • Confirm budget accounting in the bounded route includes a separator before each later finding, while the documented budget is payload bytes plus separators.
  • Confirm the CLI smoke test proves determinism, membership, and strongest-class retention, but it does not independently validate exact emitted array-byte accounting for a multi-finding result.
  • Confirm the implementation's configured-budget accounting charges each payload plus a two-byte separator before later findings; existing boundary coverage uses the lead payload and lead-plus-one but does not isolate the complete multi-finding separator sum.
  • Confirm the CLI smoke test proves repeat-run determinism and retention of an analyzed strongest-class finding, but does not independently prove exact total array-byte semantics for multiple findings.
  • Confirm the budget accumulator includes a separator before every retained finding except the first, but the emitted array places separators after findings except the last.

Refuted

  • The new helper duplicates finding-ranking behavior across rendering and tests.; refuted because: Priority ordering and omitted-summary construction are centralized in findings_priority.rs; report.rs handles serialization and emits the selected indices in original order.
  • The omitted disclosure may omit class or file counts.; refuted because: The new summary builds per-class and per-file maps, and focused tests assert class/file counts plus the bounded-file remainder.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 24, 2026 22:02
@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!

@EffortlessSteven
EffortlessSteven merged commit 4d45876 into main Oct 24, 2026
51 checks passed
@EffortlessSteven
EffortlessSteven deleted the fix/check-findings-budget-priority-10093 branch October 24, 2026 22:59
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.

2 participants