Skip to content

feat(match): one 1-100 confidence projection, identical in UI, export and API (#797) - #827

Merged
athvin merged 7 commits into
mainfrom
issue/797-confidence-projection
Nov 8, 2026
Merged

athvin merged 7 commits into
mainfrom
issue/797-confidence-projection

Conversation

@athvin

@athvin athvin commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Closes #797

🚧 Claimed by an agent session — 2026-11-08T00:42:18Z, session 01a1b892-4cde-7a53-bb3e-9ed2e764acdc on brians-MacBook-Pro.
The claim is this open draft PR: closing it releases the ticket.

Post-merge is part of this pull request. The ledger below records whether
the follow-up work actually happened. /land-pr closes it.

What

One owner of the 1–100 confidence projection (dedupe_core::confidence), shipped by every API surface that today exposes match_probability — reviews, match-scores, match-preview, resolve, duplicates groups, and the merge-plans CSV export — plus a group score per duplicate group (average of member scores, master included). The frontend renders the shipped integer and stops projecting locally.

Why

Today each surface projects its own way (.toFixed(1) in the widget and decision panel, .toFixed(0) in the badge), groups carry no score at all, and nothing guarantees the UI, the API and the export agree. The issue also asserted the config thresholds are on a bit scale — they are not, see Discoveries; DesignDoc S4.3 states normatively that all config thresholds are probabilities.

Proof

make check green; make frontend green (lint + types + unit with coverage + the mock-backed Playwright tier: 543 passed, including the updated reviews/duplicates score assertions against the mock shipping the same integers). Boundary tests pin the projection (threshold 80 excludes 79.6), the group score (a master-excluded average is rejected), and each surface renders the shipped value.

Risk & rollback

Additive JSON fields and display-only frontend changes; no score, threshold or schema semantics change. Roll back with git revert <merge-sha>.

Why

Proof

Risk & rollback

Post-merge ledger

Closed by: agent · session 01a1b892-4cde-7a53-bb3e-9ed2e764acdc on Mac · 2026-11-08T04:31:13Z

Specific to this change

Context — plan, discoveries, measurements, files

Plan

  1. dedupe-core/src/confidence.rs — the single projection: from_probability, from_match_weight, floor-display rule (displays N iff raw ∈ [N, N+1)), meets() comparing on raw; plus group() — per-member attachment = strongest within-group edge (active always-assertions count as 1.0), master = strongest-attached (tie → lowest record key), group = arithmetic mean over all members, master included. Boundary tests: 0.796 → displays 79, fails threshold 80; 0.80 → 80, passes; master-excluded average rejected.
  2. entities/match_score/read/within_groups.sql + .yaml — active edges plus active always-assertions (as 1.0) among members of the entities in a page's id range, returning entity_id per edge.
  3. er-server — ship confidence (floored integer) beside match_probability on review page items, match-scores rows, match-preview samples, resolve candidates; /duplicates groups gain group_confidence, master_record_key, member_confidences; merge-plans JSON + CSV gain group_confidence (same aggregation, so the export shows the UI's number).
  4. Frontend — ReviewRow/MatchScoreRow/DuplicateGroup types gain the new fields; decision panel, score-band browser, review inbox and duplicates render the shipped integer; probabilityLabel keeps only the "no score" case.
  5. Tests — Rust unit (projection + group semantics), e2e assertions in pg_golden_read.rs (duplicates groups, review band at 0.80 excluding a 0.796 pair whose confidence reads 79), merge_plans_csv unit test for the new column, frontend component tests rendering the shipped values.
  6. File a follow-up ticket — filed fix(widget): the widget's upstream call ignores record_key — every item renders '— / no score' #832: the widget's upstream call (/duplicates?record_key=…) ignores record_key and returns group-shaped items while widget-view.tsx expects {record_key, match_probability} — it renders "— / no score" for every item today (pre-existing, out of scope here).

Discoveries

  • The issue's bit-scale premise is wrong. It cites the doc comment inside Thresholds::full_agreement_bits ("auto_merge: 20 means 'most of the evidence' at a 22-bit scale") — a hypothetical illustrating why the bits field sits beside the thresholds. DesignDoc S4.3 is normative: "All config thresholds are probabilities"; every committed config uses 0.95/0.60; the engine compares match_probability >= review_low. No threshold-semantics change in this PR.
  • No master concept exists in golden data. Masters exist only in merge-plans, elected per-request by policy. A policy-dependent group score would differ between surfaces — the exact defect this ticket exists to kill — so the group score's master is data-derived (strongest attachment), deterministic, and policy-free; merge-plans keeps its own master_key for survivorship.
  • Assertion-held members: a member can sit in a group with no match_scores edge (assertion-sourced edges are never persisted there, S4.4); they count as confidence 100 per S4.4's "assertion-sourced edges (score 1.0)".
  • The recommendation badge's confidence is the AI adjudication proposal's confidence (lib/adjudicate/propose.ts), a different domain — untouched.
  • Export exists: the pre-merge report downloads merge-plans?format=csv — that is the export surface this ticket wires, not E11's future one.
  • Widget is broken upstream (see plan item 6) — filed as a follow-up rather than fixed here.

Files

  • rust/crates/dedupe-core/src/confidence.rs (new) + src/lib.rs export

  • entities/match_score/read/within_groups.{sql,yaml} (new) + generated artifacts via er-entity gen

  • rust/crates/er-server/src/read.rs (duplicates, match-scores, merge-plans + CSV)

  • rust/crates/er-server/src/lib.rs (review page, match-preview, resolve JSON)

  • rust/crates/er-cli/src/lib.rs (ResolveCandidate confidence, if serialized there)

  • frontend/src/lib/query/{reviews,duplicates}.ts, components/review/decision-panel.tsx, components/duplicates/{score-band-browser,duplicates-content}.tsx, components/review/review-inbox.tsx

  • /pr-review ran clean. Four fresh-context reviewers (instrumentation, tier, declared-sql, reuse), zero findings — each reported its checked scope, none was a bare pass. One declined observation: within_groups' scored CTE reads the full active match_scores per request — a performance question, not a tier defect — filed as perf(read): within_groups scans the full active match_scores per request — measure before it matters #833.

  • The e2e tier caught what the analyser could not. The first within_groups shape unioned both arms and aliased AT (VERSION => n) scans directly; er-entity verify planned it, but DuckDB rejects the alias and a stewardless lake has no assertions table at all. Split per table, pinned scans in CTEs (the dup_group_stats.sql precedent), existence-gated fetch.

Measurements

A single owner (dedupe_core::confidence) maps a match weight or
probability to the 1-100 scale: display is the floor of the raw value
(displays N iff raw in [N, N+1)), thresholds compare on raw — so
threshold 80 excludes 79.6 and the display agrees. Group confidence is
the master-included average of member attachments; the master is the
strongest-attached member (tie: lower record key), deterministic and
free of any survivorship policy so every surface shows the same number.

er-server ships the floored integer beside match_probability on review
pages, match-scores, match-preview and resolve, and group_confidence /
master_record_key / member_confidences on duplicates and the merge-plans
JSON + CSV export. The frontend renders the shipped value verbatim and
drops its per-surface projections; the mock er-server ships the same
integers so the functional tier tests the real contract.
…its table exists

The unioned statement failed two ways the e2e tier caught: a lake no
steward has touched has no assertions table at all (503 on the plan),
and AT (VERSION => n) takes no trailing table alias in this DuckDB.
match_score.read.within_groups and assertion.read.within_groups are now
separate statements with the pinned scans in CTEs; edges_by_entity
probes lake_table_exists for each arm, the same reason merge_plans
probes record_overlay.
…ering

The review list now renders the shipped 1-100 integer ("62%", floor
projection) instead of the previous "62.0%" decimal; the pixel change
is the label text on score chips and nothing else. Regenerated in the
pinned Playwright container via scripts/frontend-dev/update-baselines.sh.
The new-dataset baseline was also rewritten by the run but reverted:
12 one-level antialiasing bytes on a page with no score content is
container noise, not a deliberate change.
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(match): one 1-100 confidence projection, identical in UI, export and API

2 participants