Skip to content

fix(xtask): count SARIF folded results in token-cost findings - #13309

Merged
EffortlessSteven merged 2 commits into
mainfrom
fix/token-cost-sarif-folded-count
Nov 5, 2026
Merged

EffortlessSteven merged 2 commits into
mainfrom
fix/token-cost-sarif-folded-count

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

Swarm / Source Boundary

This PR targets EffortlessMetrics/ripr-swarm, the normal development trunk for
trusted same-repo ripr work. Confirm the change belongs here:

  • ordinary feature, analyzer, editor, docs, spec, fixture, badge,
    dependency, or repo-ops development for ripr-swarm
  • repair or follow-up for a same-repo swarm PR
  • swarm-only CI, runner, routing, source-of-truth, or agent-operating
    surface
  • other swarm-scoped work:

Source-of-truth Links

Proposal: none
Spec: none; definition updated in the token_cost.rs module header
ADR: none
Plan item: token-efficiency measurement lane (follow-up to #13261)
Governing issue or accepted claim: No single issue; accepted claim is the session goal's token-efficient feedback predicate. The discrepancy was recorded as an observation in #13261 and root-caused here to the disclosed SARIF fold (#11219, fold_same_line_results in crates/ripr/src/output/sarif.rs), verified live: the kept result's folded_results names probe:src_lib.rs:return_value:e21dcccc and run properties carry folded_same_line_results.
Acceptance delta (one sentence): SARIF rows in cargo xtask token-cost count findings (results + folded), so bytes-per-finding compares across formats.

Candidate Relationships

Candidate branch (GitHub PR head is authoritative after publication): fix/token-cost-sarif-folded-count
Stack parent or prerequisite PR (if any): none (builds on merged #13261)
Proposed replacement of PR (if any; not yet accepted): none. Title search found only #13261.
Acceptance retained from a replaced candidate (if any): none
Accepted winner and losing candidate disposition (when decided): n/a

Scope

  • xtask/src/reports/token_cost.rs only: findings_count sarif arm counts folded results; module-header definition updated; one test case added.

Scope Classification

This PR is scoped by:

  • One production behavior
  • One public contract
  • One architectural seam
  • Docs/spec/test-only evidence package
  • Other: xtask measurement correction (no product-binary change)

Production delta:

  • None in the ripr product binary. xtask-only.

Evidence/support delta:

  • Test case: sarif with 1 result + 2 folded counts 3. Live rerun: weak_error_oracle sarif row now 2 findings, 6260 bytes/finding (was 1, 12521).

Single acceptance criterion:

  • cargo xtask token-cost reports sarif findings including folded results, and the unit tests pass.

Non-goals:

  • No change to SARIF folding, output bytes, or any product format.
  • No baseline or threshold enforcement.

Support-tier Impact

  • none
  • updates docs/status/SUPPORT_TIERS.md
  • changes a README, release, docs, CLI, JSON, editor, CI, or package claim

Claim/proof notes:

  • Advisory measurement correction only.

Policy Impact

  • none
  • doc artifacts
  • CI lane
  • package boundary
  • lint / Clippy
  • no-panic
  • file policy
  • generated artifact
  • dependency
  • process/network

Ledger or exception notes:

  • n/a

Proof

cargo test -p xtask --bin xtask token_cost   # red first (expected 3, got 1), then 2 passed
cargo xtask token-cost                       # pass, 10 rows; sarif weak_error_oracle = 2 findings
cargo fmt -p xtask                           # applied

Result, failures, or skipped proof:

  • Red observed: findings_count_reads_each_machine_format failed at the folded case before the fix (exit 101).

Claim Boundary

What may be claimed after this PR? What must not be claimed yet?

  • May claim: scoreboard finding counts are comparable across machine formats.
  • Must not claim: token efficiency at repository scale; fixtures remain tiny.

Rollback

How can this PR be reverted safely?

  • Revert the single commit; only the advisory count changes.

Spec-Test-Code Traceability

  • Spec: module-header definition in xtask/src/reports/token_cost.rs
  • Tests: reports::token_cost::tests::findings_count_reads_each_machine_format (folded case)
  • Code: xtask/src/reports/token_cost.rs
  • Golden outputs: none
  • Metrics: target/ripr/reports/token-cost.{json,md}
  • ADR/learning: none

Static Language Check

  • Static output avoids killed, survived, untested, proven, and adequate.

@coderabbitai

coderabbitai Bot commented Nov 5, 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 12 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 153 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: 37f30ab4-94fb-475a-b073-265ccf6009bd
Commits

Reviewing files that changed from the base of the PR and between f66a8ad and 7941a0a.

Files selected for processing: 2

  • changelog.d/13309-token-cost-sarif-folded-count.md
  • xtask/src/reports/token_cost.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@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 updates the findings_count calculation for SARIF reports in xtask/src/reports/token_cost.rs to include folded results in the total count, preventing undercounting compared to JSON formats. It also updates the documentation and adds a corresponding unit test. There are no review comments, so I have no feedback to provide.

@EffortlessSteven EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

SOURCE_REVIEW_READY

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review November 5, 2026 11:10
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

ripr static exposure check

Commit 7941a0adeea2 · run · advisory, static evidence only (not a mutation run).

#ripr agent static-advisory base=f66a8ada9e32312644602afe8255d31f498e5f9d findings=10 gaps=0 static_unknown=10
stop=ripr cannot tell from reading the code whether tests would notice; nothing more is fixable from the test side
limits=static_unknown:10

Took 10s.

@EffortlessSteven
EffortlessSteven merged commit 5ed4b97 into main Nov 5, 2026
69 of 70 checks passed
@EffortlessSteven
EffortlessSteven deleted the fix/token-cost-sarif-folded-count branch November 5, 2026 12:27
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