Skip to content

fix(feedback): exclude ineligible receipts from usefulness rates - #4780

Merged
EffortlessSteven merged 3 commits into
mainfrom
fix/1619-feedback-rate-eligibility
Oct 2, 2026
Merged

EffortlessSteven merged 3 commits into
mainfrom
fix/1619-feedback-rate-eligibility

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

Repair a denominator defect found while working through #1619/#4585 after #4684 merged. The shared join currently counts every human-reviewed useful receipt toward reviewed_human_useful_rate, even when the receipt is unmatched, historical, mismatched, or its review was rejected. It also produces a number when no comparison subject was supplied. The document's own must_not_infer and RIPR-SPEC-0179 prohibit those results.

This candidate preserves raw counts and calculates the rate only from human-accepted receipts matched to an existing row and the explicitly supplied current result identity. Each receipt counts once across aggregate rows. No eligible denominator means null; accepted negative opinions stay in the denominator.

Swarm / Source Boundary

  • repair or follow-up for a same-repo swarm PR
  • ordinary product/spec/test work in ripr-swarm
  • No source publication, release membership, required-check, credential, workflow or provider change.

Source-of-truth Links

Proposal: existing #1619/#4585 contract; no new proposal.
Spec: docs/specs/RIPR-SPEC-0179-local-usefulness-feedback-receipts.md
ADR: unchanged.
Plan item: #1693 developer-value execution map.
Governing issue or accepted claim: #1619; residual correctness finding in merged #4684, not reopening all of closed #4585.
Acceptance delta: the displayed usefulness rate has an explicit eligible receipt denominator and cannot be fabricated from excluded or unvalidated feedback.
Implementation slice: .allow/spec-system/slices/feedback-usefulness-rate-eligibility.v1.toml

Candidate Relationships

Candidate branch: fix/1619-feedback-rate-eligibility
Exact base: 172b165
Candidate head: 9731968
Candidate tree: 2ec9285a5fa8ea3dfa3b0920953b51e07f30a1bd
Stack prerequisite: none; #4684 is already present in the base.
Replacement: none. All-state title searches found the merged local-feedback implementation and unrelated Python panel work, not another rate-eligibility candidate.

Production and evidence delta

  • Keep receipt, actor/review, judgment, historical, mismatched and unmatched counts unchanged.
  • Require reviewed_accepted plus a human review actor, an actual row match, and an exact supplied comparison identity before a receipt enters the rate.
  • Count once per receipt even when it joins both aggregate and language rows.
  • Expose rate_comparison_provided and the eligible useful/total and excluded human-reviewed counts.
  • Keep the existing reference-classification behavior. No comparison is not labelled stale; it is insufficient evidence for this rate.
  • The present CLI supplies no live comparison, so it exports counts and a null rate rather than making an implicit currentness claim. This change adds no flag or analyzer execution.
  • Add four regression tests, extend the existing human/agent control, and update the governing spec.

Acceptance matrix

Case Required result
Reviewed useful receipt, no comparison Raw count retained; null rate
Current reviewed useful receipt, absent or unrelated row Unmatched retained; null rate
Historical attempt or mismatched snapshot Counts retained; excluded from rate
Rejected review, nonhuman review or unreviewed opinion Counts retained; excluded from rate
One current useful + one current incorrect opinion, three excluded useful opinions, two aggregate rows Raw 5, eligible 2, useful 1, rate 0.5
Only one eligible negative opinion Rate 0.0, not null
Rendered export / policy files JSON agrees with the shared join; objective counts and policy bytes unchanged

Proof

Local environment: no Cargo/rustc/gh and no runtime outbound DNS. Source and existing test/contract paths were inspected through GitHub. No local compile, rustfmt, worktree-doctor, check-fast, precommit or Rust test execution is claimed. The behavioral pre-repair red dimension is NOT_ESTABLISHED; source inspection shows why the new expected results differ from the old implementation.

Hosted proof required on this exact candidate:

cargo fmt --all -- --check
cargo test -p ripr --lib feedback
cargo test -p ripr --lib usefulness_rate
cargo xtask precommit

Require nonzero intended test counts. Existing hosted routing owns the required Rust/Clippy/policy matrix; no extra always-on workflow is added. This PR remains draft/REVIEW_INCOMPLETE until actual proof and exact-head substantive review are reconciled.

Review scope and residuals

Inspected semantic owner app/feedback.rs, callers in cli/commands/feedback.rs, domain ResultIdentity/ReviewStatus/reference classification and RIPR-SPEC-0179. The new cohort is bounded to an explicitly supplied identity; this is not general population usefulness or current analyzer correctness. Reviewer identity and the supplied comparison's provenance remain caller responsibilities. The correction neither invents a new source of current truth nor authenticates review actors.

Concurrency of receipt creation, filesystem confinement, explicit export-path resolution and richer row identities are separate existing implementation risks, not silently bundled into this rate patch.

Support-tier and policy impact

Support-tier impact: none. Public JSON gains additive denominator fields and a more conservative nullable rate. Recording, visibility, suppressions, baselines, gates, static movement, command execution, LSP/MCP and telemetry are unchanged.
Policy impact: one implementation slice and clarification of the existing spec. No new dependency, process/network surface, non-Rust program or workflow.

Rollback

Revert this three-file change. Existing feedback receipt bytes and raw-count fields are unchanged. Do not delete retained receipts or change policy to compensate.

CI Economics

Reuse the existing routed PR checks and focused feedback tests. No full-workspace rerun or new hosted lane solely for the new tests. No savings claim, release qualification or support promotion follows from a green unit test.

stackable = false

Preserve raw feedback counts while excluding unreviewed, rejected,
unmatched, historical and mismatched receipts from the rate. Require
an explicit comparison subject and count each receipt once across
aggregate rows. Add production-join regression controls and document
null rates when the eligible denominator is absent.

Refs #1619, #4585. Local Rust proof unavailable; hosted proof required.
@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 Sep 29, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 96efa1de-d81a-4821-92ad-ff7e6c217764

📥 Commits

Reviewing files that changed from the base of the PR and between 006eaf8 and 3133c87.

📒 Files selected for processing (4)
  • .allow/spec-system/slices/feedback-usefulness-rate-eligibility.v1.toml
  • crates/ripr/src/app/feedback.rs
  • docs/OUTPUT_SCHEMA.md
  • docs/specs/RIPR-SPEC-0179-local-usefulness-feedback-receipts.md
 _______________________________________________________________
< Your null checks are like seatbelts: installed, but not worn. >
 ---------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

Copy link
Copy Markdown
Member Author

@cursor Complete the native Rust proof/repair pass on this existing candidate only. This is an implementation handoff, not a new competing PR. Start from PR head 97319681b9e9f989c90422faa5e869a6c4ba6e64 on fix/1619-feedback-rate-eligibility; follow current AGENTS/build-candidate/review-pr/finish-pr guidance. I will not edit this branch concurrently while this handoff is active.

Claim: keep raw feedback counts intact; calculate the current-result usefulness rate only from reviewed_accepted human reviews that match an existing row and the explicit comparison identity. Count each receipt once across rows. Missing comparison/match or zero eligible receipts means null. Keep accepted negative opinions in the denominator. Domain binding classification and receipt bytes stay unchanged; no new CLI flags, automatic analysis, policy effect, workflow, dependency or release action.

Write boundary: the three files already in this PR and narrowly necessary matching public-contract/test references. Do not widen into receipt concurrency, path confinement, richer row identities, other issues, or main-branch repair. Preserve the original feedback tests; first run rustfmt on the changed Rust file and commit its formatting in this branch.

Run actual focused Rust proof with nonzero subjects: cargo test -p ripr --lib feedback, the four usefulness_rate tests, and relevant current precommit/check-fast checks. Establish an honest red control by testing the new behavioral assertions against the old rate logic in an owned temporary state, then restore the intended candidate before committing. A compilation/setup error is not the intended red. Check that the existing CLI/output tests do not expect an unsupported numeric rate without a comparison.

Review the safety of the new numerator/denominator arithmetic, rejected/nonhuman reviews, stale and historical identities, no row, repeated aggregate rows, preserved raw negatives, and serialized JSON parity. Fix substantive problems within this claim in the same branch. Record exact head, actual commands/counts, inherited failures and omitted proof. Do not invent local or hosted passes. No merge/auto-merge: hand back the tested current head and review findings here for integration.

@cursor

cursor Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

I finished the native proof/repair pass on existing PR #4780. Current head is 3133c87ccd96e52acaab5922df76a697c6726b09 (tree ca2277881242ff9bc3c8cebf81d0d024e96210e1) on fix/1619-feedback-rate-eligibility. No merge.

I rustfmt’d crates/ripr/src/app/feedback.rs first, then established an honest red by restoring the old “all human-reviewed receipts” rate against the new assertions: 4 tests ran; 3 failed on behavior (no comparison, historical, eligible 5 vs 2); the negative 0.0 case still passed under old logic. After restoring the candidate, cargo test -p ripr --lib feedback was 36/36, usefulness_rate 4/4, cargo check -p ripr --all-targets passed, check-fast passed (4 files, 10 gates, fixture-contracts skipped), and precommit passed. CLI export still asserts a null rate because it passes live_identity: None. I also corrected the stale public join contract in docs/OUTPUT_SCHEMA.md.

Source review found no blocking arithmetic, eligibility, JSON-parity, or CLI-claim defects. Disposition is REVIEW_INCOMPLETE: hosted Rust-only feature lane / ub-review were still in progress, bot review is quota-limited, and I did not arm merge. Full record is on the PR as a COMMENT on this SHA.

Open in Web Open in Cursor 

cursoragent and others added 2 commits September 29, 2026 04:52
Apply rustfmt to the eligibility controls so hosted fmt --check binds to
this candidate. Behavior is unchanged.

Co-authored-by: Steven Zimmerman, CPA <EffortlessSteven@users.noreply.github.com>
Correct the public join contract so reviewed_human_useful_rate is numeric
only when the eligible current-result cohort is nonempty, not whenever any
human-reviewed receipt exists.

Co-authored-by: Steven Zimmerman, CPA <EffortlessSteven@users.noreply.github.com>

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

review-pr record (native proof handoff)

reviewed_head_sha: 3133c87ccd96e52acaab5922df76a697c6726b09
integration_basis: recorded exact base 172b165bc2b375d8df7ac0b49585ef35ff368f42 (= git merge-base origin/main HEAD). origin/main has later unrelated commits; behind-only, not restacked.
claim_boundary: raw feedback counts stay intact; reviewed_human_useful_rate is computed only from reviewed_accepted human reviews that match an existing route-quality row and an explicit comparison identity; each receipt counts once; missing comparison/match or zero eligible receipts means null; accepted negatives stay in the denominator. No new CLI flags, analysis, policy, workflow, dependency, or release action.

changed_surfaces_and_semantic_owners_inspected:

  • owner crates/ripr/src/app/feedback.rs::build_join (rate eligibility, once-per-receipt increment, nullable rate, additive denominator fields)
  • consumers cli/commands/feedback.rs (live_identity: None on record and export) and output/feedback.rs (join passthrough render)
  • domain ReviewStatus::is_reviewed / ReviewedAccepted / classify_reference (absent live identity remains Current, not used as rate eligibility)
  • public contracts docs/specs/RIPR-SPEC-0179-local-usefulness-feedback-receipts.md, docs/OUTPUT_SCHEMA.md
  • slice .allow/spec-system/slices/feedback-usefulness-rate-eligibility.v1.toml

blocking_findings: none on this source/oracle pass

non_blocking_suggestions:

  • usefulness_rate_keeps_a_current_negative_opinion_in_the_denominator agrees with the pre-repair rate (0.0) when the lone receipt is already human-reviewed; it discriminates 0.0 vs null, not old vs new eligibility. The comparison/exclusion/mixed tests are the red controls.
  • rate_excluded_reviewed_human_total is a usize subtract that is safe because eligible receipts are a subset of is_reviewed_human; a named helper/debug_assert would make that invariant local rather than implied.
  • Rate remains f64 (0.5 and 0.0 are exact here). Non-dyadic fractions would be binary floats.

refuted_or_stale_findings:

  • worktree doctor "behind origin/main by 1 commit" is hygiene, not a restack demand (AGENTS.md behind-only rule).
  • CodeRabbit/Gemini quota messages are missing review, not findings against this head.

proof_and_ci_observed:

  • Honest red (owned temp old-rate logic, tests compiled and ran): 4 usefulness_rate tests; 3 failed on assertions (no comparison, historical, eligible total 5 vs 2); 1 passed (negative 0.0). Restored candidate hash af7e6946d7f39e0d9c7844db4396c933532382eccab6bb1a6b5f97249e683c78.
  • cargo test -p ripr --lib feedback: 36 passed, 0 failed, 6447 filtered out.
  • cargo test -p ripr --lib usefulness_rate: 4 passed, 0 failed, 6479 filtered out.
  • CLI export test still asserts a null rate; CLI supplies live_identity: None.
  • cargo check -p ripr --all-targets: pass.
  • cargo xtask check-fast: pass, selector 4 files, ran 10, skipped check-fixture-contracts (no fixtures).
  • cargo xtask precommit: pass (policy/docs/contracts; does not replace the focused tests).
  • Hosted on this SHA: source-of-truth, spec-maintenance-digest, pr-plan, dependency-review, cargo-deny, GitGuardian success; Rust-only feature lane and ub-review in_progress; several lanes skipped-by-policy.

proof_or_review_missing:

  • Hosted required Rust/Clippy matrix on this exact head is not complete (Rust-only feature lane in_progress).
  • External bot review is quota-limited/skipped, not a clean review.
  • No merge-gate aggregator result observed yet.

residual_assumptions_and_non_claims:

  • This rate is not population usefulness, analyzer correctness, or reviewer authentication. Comparison provenance remains a caller duty.
  • Public CLI still cannot emit a numeric rate; that is intended, not a missing flag.
  • Receipt concurrency, path confinement, and richer row identities remain out of scope.

disposition: REVIEW_INCOMPLETE

Source and local oracle look ready. Do not merge or auto-merge until hosted exact-head required checks finish and a published-head review re-binds this SHA.

@EffortlessSteven
EffortlessSteven marked this pull request as ready for review October 2, 2026 06:48
@EffortlessSteven
EffortlessSteven merged commit 2cdda4d into main Oct 2, 2026
25 of 29 checks passed
@EffortlessSteven
EffortlessSteven deleted the fix/1619-feedback-rate-eligibility branch October 2, 2026 06:49

@devin-ai-integration devin-ai-integration 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.

Devin Review found 2 potential issues.

Devin Review

Comment on lines +337 to +342
if matched
&& receipt.review_status == crate::domain::ReviewStatus::ReviewedAccepted
&& receipt.review_actor_kind == Some(ActorKind::Human)
&& live_identity.is_some_and(|live| {
classify_reference(&receipt.identity, Some(live)) == ReferenceState::Current
})

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.

🔍 Sampled identities limit rate coverage

The route-quality producer keeps only three sample identities per row. Feedback for another attempt in that row cannot enter the new rate through the existing sample-based match. The rate therefore describes matched samples, not every attempt represented by the objective counts.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +209 to +212
- `crates/ripr/src/app/feedback.rs::tests::usefulness_rate_requires_a_comparison_and_a_matching_row`
- `crates/ripr/src/app/feedback.rs::tests::usefulness_rate_excludes_each_ineligible_review_without_losing_counts`
- `crates/ripr/src/app/feedback.rs::tests::usefulness_rate_counts_eligible_receipts_once_across_aggregate_rows`
- `crates/ripr/src/app/feedback.rs::tests::usefulness_rate_keeps_a_current_negative_opinion_in_the_denominator`

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.

🔍 Rate tests absent from traceability map

The spec lists four new rate tests, but the RIPR-SPEC-0179 traceability entry omits them. That leaves the new behavior outside the authored spec-to-test mapping.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@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

  • Even when every eligibility precondition holds, the rate is bounded to the route-quality producer's three-sample identity window; the corrected JSON can still describe a strict subset of attempts. Spec text does not call this out, and the slice does not list it as a return condition.

Verification questions

  • Confirm the unreviewed fixture in usefulness_rate_excludes_each_ineligible_review_without_losing_counts sets actor_kind=Human (default from payload) but review_status is None, so reviewed_human_total==0. The new eligible denominator assertion (0) is consistent only because the gate requires ReviewedAccepted; this is correct but the test name and acceptance matrix do not explicitly cover an unreviewed-but-otherwise-eligible receipt under a valid comparison. Minor coverage gap, not a defect.
  • Confirm usefulness_rate_keeps_a_current_negative_opinion_in_the_denominator only exercises the path where the row matches by gap; it does not cover negative receipt that is current by classify_reference but unmatched to a row. Current null-rate path is still covered by the comparison/matching test.
  • Confirm sample-canonical-gap matching can undercount attempts: route-quality row stores only 3 sample gap ids, so eligible attempts on other gap ids in the same row are excluded from rate numerator/denominator.
  • Confirm rIPR-SPEC-0179 traceability entry omits the four new rate tests; spec-to-test mapping is now incomplete for this generation.
  • Confirm traceability gap (4 new rate tests absent from .ripr/traceability.toml) is a spec-coverage concern, not an active-view concern; demote to sibling-paths/spec lane.
  • Confirm traceability map (.ripr/traceability.toml) was not updated to list the four new tests, so authored spec-to-test mapping drifts from spec 0179 generation 2. Devin flagged this; still open in the diff.

Refuted

  • Rate accumulation should be extracted into a dedicated app::rate module to keep build_join small and to centralize eligibility policy.; refuted because: Eligibility is intrinsically tied to the per-receipt match result of build_join; extracting it would either duplicate the row-match work or introduce a new seam that the slice's forbidden_seams list explicitly excludes. Keeping two usize accumulators next to the existing matched/unmatched vectors preserves the smallest complete fix and the once-per-receipt invariant.
  • Tests cannot distinguish old from new rate behavior because the comparison path is always None in the live CLI.; refuted because: False premise: the new tests call build_join directly with both Some(live) and None, and a fifth path asserts the null rate. The null-vs-number flip on the human/agent control is itself a discriminator.
  • Box::from-style allocation failure could cause rate_* counters to silently undercount when growing row_feedback runs out of memory; refuted because: Eligibility counters are stack usize; no Box::new/Vec::with_capacity on the new code path. The seeded thread and diff do not raise this; per calibration it stays a refuted false-premise.

Evidence gaps

  • Model proof intent was rejected by deterministic validation.

Parked follow-ups

  • Devin-ai sampled-identities concern does not reopen in this diff (sample_canonical_gap_ids unchanged).

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.

feat(feedback): add local result-bound usefulness receipts before editor or protocol integration

2 participants