Skip to content

feat(reviewer-eval): mine-telemetry — fail→fix golds + waived decoys from the collector db - #303

Merged
norvalbv merged 2 commits into
mainfrom
bench/mine-telemetry
Aug 2, 2026
Merged

feat(reviewer-eval): mine-telemetry — fail→fix golds + waived decoys from the collector db#303
norvalbv merged 2 commits into
mainfrom
bench/mine-telemetry

Conversation

@norvalbv

@norvalbv norvalbv commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Capture point 1 of the corpus-growth charter, plus the historical override-valve decoy slice — completing the capture trio (#295 archive, #302 waive, this). The loop now mints labeled candidates entirely from your own telemetry, no CodeRabbit involved.

Read-side design: SELECTs ~/.claude-usage/usage.db + reads the #295 diff archive; the collector is untouched (deviation from the addendum's 'collector correlates' phrasing, recorded in the docstring — read-side correlation adds zero write paths).

  • fail→fix: per-(repo,branch) chronological chains; per-lens correlation when lens data exists (one fix can't mint two golds); same-diff overrides route to decoys; fixed-by-absence on clean ships; disposition allowlist ('blocking' or pre-era null) — waived and dropped_out_of_charter lenses can never become golds.
  • waived decoys: override-valve lenses with rationale (null until feat(review): guard-review waive — decoy-minting waives with rationale capture #302's rationale capture starts flowing).
  • Evidence honesty: failReason-only rows (pre-2026-07-27 history) flagged + counted; repo allowlist defaults to devkit (frink diffs are private — mining them is an explicit --repo + adapt-stage decision).
  • Shared plumbing in mine-common.mts (jscpd: zero clones between miners now).

Live dry-run (devkit scope): 44 candidates — ~40 correctness fail→fix (9 with full archived diff bytes), commit-guard pair, 1 waived decoy; idempotent re-runs.

Gate provenance: five distinct findings absorbed across four review rounds (per-lens stamping blocker, phantom 'overridden' disposition literal, 3 verbatim clones, whitespace-array reason shadow) — all fixed, none waived. One follow-up the opus escalation surfaced: the clone gate is currently vacuous (clone-detector.mjs scan reports 0 repo-wide while raw jscpd finds real clones) — filed for separate investigation.

48 unit tests; 490/490 suite green; tsc/biome clean.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added a telemetry mining workflow that identifies failure-to-fix patterns and waived review outcomes.
    • Supports repository filtering, archived diff evidence, telemetry links, failure reasons, and bounded payload handling.
    • Produces consolidated candidate data plus histogram and drop summaries.
  • Bug Fixes
    • Improved handling of missing or invalid telemetry, archives, databases, and malformed candidate data without crashing.
    • Preserves deterministic ordering and safely merges existing candidates.
  • Tests
    • Added comprehensive coverage for correlation, grouping, fallback behavior, boundary conditions, and empty inputs.

…from the collector db

Capture point 1 of the corpus-growth charter, plus the historical override-valve
decoy slice. Read-side design: the miner SELECTs ~/.claude-usage/usage.db
(USAGE_DB override) and reads the #295 diff archive — the collector itself is
untouched (deviation from the addendum's 'collector correlates' phrasing,
recorded in the module docstring; read-side correlation adds zero write paths).

- fail→fix: per-(repo,branch) chronological chains (ISO-aware ordering, ship-id
  tiebreak); PER-LENS correlation when lens data exists, reviewer-level fallback
  only on lens-data absence; same-diff overrides route to the decoy path;
  fixed-by-absence recognized on clean ships. Candidate lenses are an ALLOWLIST
  on disposition ('blocking' or pre-disposition null). Merge keys carry the
  candidate kind. pickFailReason falls through to the reviewer reason when
  issues_json filters to nothing (whitespace-only arrays shadowed it via ??).
- Evidence honesty: failReason-only rows flagged + counted; repo allowlist
  defaults to devkit (frink diffs are private — explicit flag + adapt stage).
- Shared miner plumbing extracted to mine-common.mts (jscpd: zero clones).
- Atomic merge-by-key output to raw/candidates-telemetry.jsonl (gitignored);
  fail-open on missing db/sqlite3/archive; bypasses propose.mts by design.

Live dry-run (devkit scope): 44 candidates incl. 9 with archived bytes;
idempotent re-runs. 48 unit tests; 490/490 suite green; tsc/biome clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@norvalbv, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 13 minutes

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

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f7608417-f527-4efe-9d77-1157c394d05e

📥 Commits

Reviewing files that changed from the base of the PR and between 6ae4629 and 7ddfd4d.

📒 Files selected for processing (4)
  • gate-engine/review/__tests__/mine-telemetry.test.mts
  • gate-engine/review/eval/reviewers/mine-common.mts
  • gate-engine/review/eval/reviewers/mine-telemetry-lib.mts
  • gate-engine/review/eval/reviewers/mine-telemetry.mts
📝 Walkthrough

Walkthrough

Added shared miner utilities, a telemetry correlation library, and a bench-only telemetry mining CLI. The CLI correlates review outcomes with later fixes, builds candidate rows, merges output atomically, and reports mining statistics. Vitest coverage validates the helper behavior.

Changes

Telemetry mining

Layer / File(s) Summary
Shared miner utilities
gate-engine/review/eval/reviewers/mine-common.mts, gate-engine/review/eval/reviewers/mine-bots.mts
Shared helpers now load candidates, parse repository arguments, detect SQLite, and execute JSON queries. mine-bots.mts uses these helpers.
Telemetry correlation library
gate-engine/review/eval/reviewers/mine-telemetry-lib.mts
Added ship grouping, reviewer and lens fail-to-fix correlation, diff payload handling, candidate construction and merging, URL and failure-reason helpers, and histogram generation.
Telemetry mining CLI
gate-engine/review/eval/reviewers/mine-telemetry.mts
Added telemetry loading, repository filtering, archived-diff handling, candidate generation, atomic JSONL persistence, pruning, and stderr summaries.
Telemetry helper validation
gate-engine/review/__tests__/mine-telemetry.test.mts
Added coverage for sorting, grouping, correlation, diff handling, candidate shaping, merging, URL and reason selection, and histograms.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant MineTelemetry
  participant SQLite
  participant DiffArchive
  participant CandidatesFile
  MineTelemetry->>SQLite: Read telemetry rows
  MineTelemetry->>DiffArchive: Load archived diffs
  MineTelemetry->>MineTelemetry: Build fail-fix and waived candidates
  MineTelemetry->>CandidatesFile: Merge and atomically write candidates
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the telemetry miner and its two primary outputs: fail-to-fix gold candidates and waived decoys.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bench/mine-telemetry

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.

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@gate-engine/review/eval/reviewers/mine-common.mts`:
- Around line 32-35: Update collectRepoArgs to reject --repo when its next
argument is missing or starts with "--", raising the established usage error
instead of adding it to repoArgs. Preserve accepting non-flag repository values
and ensure mine-bots does not interpret an incomplete --repo pair as an explicit
scope.
- Around line 51-58: Update sqliteJson to enforce read-only database access for
every caller-supplied SQL statement, preferably by opening sqlite3 in enforced
read-only mode or rejecting non-SELECT statements before execution. Preserve
existing JSON result behavior and add a test verifying that an INSERT, UPDATE,
or DDL operation is refused.

In `@gate-engine/review/eval/reviewers/mine-telemetry.mts`:
- Around line 262-272: Update the candidate-row fallback around failLenses and
lensesByShipReviewer so [null] is used only when no lens breakdown exists for
the ship/reviewer; when breakdown entries exist but none are blocking failed
lenses, return no candidate rows instead of creating a reviewer-level candidate.
Preserve the existing blocking-fail filtering and per-lens rows.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 13303e51-d2cf-4f1d-84f1-35c467ab060d

📥 Commits

Reviewing files that changed from the base of the PR and between 157e784 and 6ae4629.

📒 Files selected for processing (5)
  • gate-engine/review/__tests__/mine-telemetry.test.mts
  • gate-engine/review/eval/reviewers/mine-bots.mts
  • gate-engine/review/eval/reviewers/mine-common.mts
  • gate-engine/review/eval/reviewers/mine-telemetry-lib.mts
  • gate-engine/review/eval/reviewers/mine-telemetry.mts

Comment thread gate-engine/review/eval/reviewers/mine-common.mts Outdated
Comment thread gate-engine/review/eval/reviewers/mine-common.mts
Comment thread gate-engine/review/eval/reviewers/mine-telemetry.mts Outdated
norvalbv added a commit that referenced this pull request Aug 2, 2026
…d module-suffixed extensions (#305)

The post-filter kept only .ts/.tsx/.js/.jsx, but devkit's own scanRoots (cli,
gate-engine) are pure .mts — jscpd tokenizes mts/cts as typescript and mjs/cjs
as javascript and reported the clones, then CODE_EXT discarded every one.
`guard-clone scan` returned 0 repo-wide while raw jscpd found real clones
(verified during #303's gates): a silently dead gate.

With the fix the same scan reports 62 cross-file clones (min-tokens 50),
dominated by the review/eval vs review/eval/conventions bench+matcher family.
Regression tests: .mts and .mjs clone fixtures must block (exit 1).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Three findings, all valid.

- selectFailLensRows (new, in the lib so it is testable): an empty blocking
  filter used to fall through to `[null]`, the "no lens breakdown recorded"
  branch. A fail whose only failing lenses were waived or dropped_out_of_charter
  therefore minted a reviewer-level gold from exactly the lenses the allowlist
  had just excluded — contradicting the rule the comment above it states. Now
  three distinct cases, and the skip is COUNTED in the drop histogram
  (fail-fix:all-failing-lenses-non-blocking) rather than vanishing silently,
  which is the same evidence-honesty bar as the rest of the funnel.

- collectRepoArgs: `--repo --dev` stored "--dev" as the repository. Both callers
  treat any non-empty result as an explicit scope replacing their defaults, so
  that silently narrowed the sweep to a repo that cannot exist and reported a
  clean run. A missing or flag-shaped value is now a usage error.

- sqliteJson: the docstring claimed read-only but nothing enforced it. Now opens
  the collector db with sqlite3 `-readonly`, so the boundary is held by the
  engine — a write raises "attempt to write a readonly database" instead of
  mutating the user's telemetry. The miners are strictly read-side.

Tests: 47 -> 61 in mine-telemetry.test.mts, covering all three cases of the lens
rule, both malformed --repo shapes, and a refused INSERT/DDL that leaves the db
intact. Full gate-engine/review suite 503/503.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@norvalbv
norvalbv merged commit 6e9949c into main Aug 2, 2026
1 of 2 checks passed
norvalbv added a commit that referenced this pull request Aug 2, 2026
…clone-gate ruling (#310)

benchmarks-grow-from-telemetry gains its convergence record before the release
that ships it: capture loop closed end-to-end (#295/#302/#303/#309, first 8
pure-telemetry rows, corpus 128), label-trust precondition met (#304: κ 0.735
post-triage, 4.2% noise floor; cleanlab floor still pending bench pred_probs),
and the Target's c-CRAB/CR-Bench known-answer path recorded as falsified
(#307) with the replacement candidates awaiting ratification.

New axis clone-gate-non-import-code ([VALIDATED]): clones are measured over
non-import code, excluded at the jscpd tokenizer — with the six-hole failure
of post-hoc fragment classification recorded as the rejected road so a future
simplifier can't silently re-vacuous the gate (#305/#308).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant