Skip to content

feat(xtask): token-cost scoreboard for check output formats - #13261

Merged
EffortlessSteven merged 3 commits into
mainfrom
feat/token-cost-scoreboard
Nov 5, 2026
Merged

EffortlessSteven merged 3 commits into
mainfrom
feat/token-cost-scoreboard

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

  • Adds cargo xtask token-cost: an advisory scoreboard that renders the dogfood fixtures (boundary_gap, weak_error_oracle) through the real ripr check binary in json, json-compact, sarif, human, and human-full formats, and records exact stdout bytes, finding/result counts, and bytes-per-finding per (fixture, format) row to target/ripr/reports/token-cost.{json,md}.
  • Output token cost was previously visible only after the fact inside agent context windows. This makes per-format cost a reviewable measurement. It never gates.

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 (advisory repo-ops measurement, modeled on bench-agent-surfaces)
Spec: none new; grain and definitions are documented in the module header of xtask/src/reports/token_cost.rs
ADR: none
Plan item: token-efficiency measurement lane (scoreboards/evals improvement)
Governing issue or accepted claim: No single issue; accepted claim is the session goal of measuring and providing token-efficient feedback. Related but distinct: #12902 cohort token accounting (per-agent A/B), which this does not duplicate — this measures per-format output bytes.
Acceptance delta (one sentence): A reviewer can run one command and see exact bytes and bytes-per-finding for every ripr check output format on the dogfood fixtures.

Candidate Relationships

Candidate branch (GitHub PR head is authoritative after publication): feat/token-cost-scoreboard
Stack parent or prerequisite PR (if any): none
Proposed replacement of PR (if any; not yet accepted): none. Searched all-state PRs for token-cost before publishing; nearest work (#13051, #13071, #13228, #13259) is cohort A/B token accounting, a different claim.
Acceptance retained from a replaced candidate (if any): none
Accepted winner and losing candidate disposition (when decided): n/a

Scope

  • New cargo xtask token-cost command (command enum, parser, help list, command catalog, dispatch).
  • Two additive FixtureCheckFormat variants (JsonCompact, Sarif) so the fixture runner can request the existing CLI --format json-compact / --format sarif producers. Existing consumers (goldens, dogfood) use only Json/Human/HumanFull and are unchanged; the exhaustive match is updated in place.
  • Unit tests for bytes-per-finding denominator rules and per-format finding counting.

Scope Classification

This PR is scoped by:

  • One production behavior
  • One public contract
  • One architectural seam
  • Docs/spec/test-only evidence package
  • Other: repo-ops measurement command

Production delta:

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

Evidence/support delta:

  • New measured scoreboard report plus unit tests; changelog fragment.

Single acceptance criterion:

  • cargo xtask token-cost exits 0 and writes 10 rows (2 fixtures x 5 formats) with measured bytes, and the unit tests pass.

Non-goals:

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 only; no support or output claim changes.

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 token_cost        # 2 passed
cargo clippy -p xtask --all-targets   # exit 0 (one pre-existing dead-code warning in untouched dx_scoreboard tests)
cargo fmt -p xtask                    # applied
cargo xtask token-cost                # token-cost: pass (wrote 10 rows)
cargo xtask check-command-catalog     # FAILS identically on clean main (duplicate check-fast; owned by #13246)

Result, failures, or skipped proof:

Measured at candidate head (Windows, dev profile):

fixture format bytes findings bytes/finding
boundary_gap json 9740 1 9740
boundary_gap json-compact 8033 1 8033
boundary_gap sarif 13825 1 13825
boundary_gap human 3479 null null
boundary_gap human-full 3515 null null
weak_error_oracle json 12911 2 6456
weak_error_oracle json-compact 11039 2 5520
weak_error_oracle sarif 12521 1 12521
weak_error_oracle human 3723 null null
weak_error_oracle human-full 4416 null null

Observation recorded, not claimed as a defect: on weak_error_oracle, SARIF renders 1 result where JSON renders 2 findings. The scoreboard exposes the discrepancy; reconciling it is separate work.

Claim Boundary

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

  • May claim: per-format output cost on the two dogfood fixtures is now measured by one command with a stable grain and disclosed null denominators for human formats.
  • Must not claim: token efficiency at repository scale (fixtures are tiny), or that any format is "efficient" in absolute terms; no baseline or threshold exists yet.

Rollback

How can this PR be reverted safely?

  • Revert the single commit; the command, catalog entry, and fixture-format variants are additive and have no other consumers.

Spec-Test-Code Traceability

  • Spec: module-header definitions in xtask/src/reports/token_cost.rs (grain, byte definition, denominator rules)
  • Tests: reports::token_cost::tests (2 unit tests)
  • Code: xtask/src/reports/token_cost.rs, wiring in xtask/src/command.rs, xtask/src/dispatch.rs, xtask/src/reports/mod.rs, xtask/src/reports/fixtures.rs
  • Golden outputs: none (report is generated, not golden)
  • Metrics: target/ripr/reports/token-cost.{json,md} (schema token-cost-v1)
  • ADR/learning: none

Static Language Check

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

@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

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: 9fb65b7c-7922-4c36-9913-b5c0b36397ec
Commits

Reviewing files that changed from the base of the PR and between bbd845e and df28f75.

Files selected for processing: 6

  • changelog.d/13261-token-cost-scoreboard.md
  • xtask/src/command.rs
  • xtask/src/dispatch.rs
  • xtask/src/reports/fixtures.rs
  • xtask/src/reports/mod.rs
  • xtask/src/reports/token_cost.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@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 head=133882bd7b91b14ec8318f2a1bd8dc9dcc764130 scope: xtask-only additive token-cost scoreboard; reviewed diff (command/catalog/dispatch wiring, additive FixtureCheckFormat variants with exhaustive match updated, producer formats json-compact/sarif verified in crates/ripr/src/output/format.rs, null denominators disclosed for human formats). Proof: cargo test -p xtask token_cost 2 passed; clippy exit 0; live run wrote 10 measured rows. Inherited check-command-catalog failure reproduces on clean main and is owned by #13246. No findings.

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review November 5, 2026 05:39
@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!

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

ripr static exposure check

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

#ripr agent static-advisory base=bbd845eea88c7fa707651bb27bd7e9e972015659 findings=116 gaps=23 infection_unknown=4 propagation_unknown=16 static_unknown=61 weakly_exposed=35
weakly_exposed|xtask/src/command.rs:1548|command_entry(|missing=No strong discriminator was detected|test=t1|id=probe:xtask_src_command.rs:return_value:105aa7d8
weakly_exposed|xtask/src/command.rs:1549|"token-cost",|missing=No strong discriminator was detected|test=t1|id=probe:xtask_src_command.rs:return_value:b2415cd7
weakly_exposed|xtask/src/command.rs:1550|"report_only",|missing=No strong discriminator was detected|test=t1|id=probe:xtask_src_command.rs:return_value:3a509fa2
weakly_exposed|xtask/src/command.rs:1551|"target/ripr/reports/token-cost.{json,md}",|missing=No strong discriminator was detected|test=t1|id=probe:xtask_src_command.rs:return_value:0106e47a
weakly_exposed|xtask/src/command.rs:1554|"Measures exact stdout bytes, finding/result counts, and bytes-per-finding of `r…|missing=No strong discriminator was detected|test=t1|id=probe:xtask_src_command.rs:return_value:058fad43
weakly_exposed|xtask/src/dispatch.rs:123|XtaskCommand::TokenCost =>|missing=No strong discriminator was detected|test=t2|id=probe:xtask_src_dispatch.rs:match_arm:8348b99b
weakly_exposed|xtask/src/reports/token_cost.rs:51|match format|missing=No strong discriminator was detected|test=t3|id=probe:xtask_src_reports_token_cost.rs:match_arm:627b1603
t1=xtask/src/tests.rs:30756 command_catalog_check_accepts_current_catalog unknown miss=assertion_not_credited
t2=xtask/src/windows_advisory_run.rs:904 a_failing_log_file_withholds_the_status_so_the_summarizer_refuses exact_value `assert_eq!(outcome.status, 0);` miss=observation_unconfirmed
t3=xtask/src/reports/token_cost.rs:190 findings_count_reads_each_machine_format exact_value `assert_eq!(findings_count("human", "anything"), None);` miss=observation_unconfirmed
+16 more gaps not shown; `--format json` lists all
limits=infection_unknown:4,propagation_unknown:16,static_unknown:61,weakly_exposed:12
next=ripr explain --root /home/runner/work/ripr-swarm/ripr-swarm/head --base bbd845eea88c7fa707651bb27bd7e9e972015659 --committed --mode draft probe:xtask_src_command.rs:return_value:105aa7d8

Took 29s.

@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 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 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

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