Repository navigation
feat(match): one 1-100 confidence projection, identical in UI, export and API (#797) - #827
Merged
Merged
Conversation
4 tasks
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.
3 tasks
athvin
marked this pull request as ready for review
November 8, 2026 02:27
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #797
What
One owner of the 1–100 confidence projection (
dedupe_core::confidence), shipped by every API surface that today exposesmatch_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 checkgreen;make frontendgreen (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-9ed2e764acdconMac· 2026-11-08T04:31:13Zmainis green with this change on it — merge SHAb586498a7fe6427aed8beac2df63157ff268de3f; push runs on it: rust 42445843080, frontend 42445843054, infra 42445842978, images 42445843055, devcontainer 42445843007, deploy 42446145783 — all success.imagesbuilt — run 42445843055 success; digests resolved in deploy:er-api→sha256:ae5d027a…,er-web→sha256:52fd1332….deployconverged — proved by process-emitted lines, not the workflow conclusion:2026-11-08T04:18:09Z INFO er-server listening addr=0.0.0.0:8000and Next.js✓ Readyfrom podweb-api-green-6f444df8c5-7np5x(nsci), booted at 04:18Z on the image deploy 42446145783 resolved fromb586498a. Read from/er/dev/containersvia Logs Insights.deploysuccess on the merge SHA (above).driftlast scheduled run 2026-11-07T06:01Z success;kindnightly 2026-11-07T06:44Z success — both green, both pre-merge, neither exercises an app-code diff.Agentic Maintenancewas intermittently red before this merge (failure 2026-11-08T00:50Z vs success 2026-11-07) — scheduled, predates the merge SHA, knowingly not this change.Donethrough the automation rather than by hand — verified withgh project item-list 2 --owner athvin: item for feat(match): one 1-100 confidence projection, identical in UI, export and API #797 has statusDone; the issue closedCOMPLETEDon merge.record_key), perf(read): within_groups scans the full active match_scores per request — measure before it matters #833 (within_groupsfull-match_scores-scan performance observation), skill: document AT (VERSION => n) alias restriction + stewardless-lake table gating in ducklake-lakehouse #836 (write theAT (VERSION => n)no-trailing-alias + stewardless-lake gating lessons intoducklake-lakehouse)./er/dev/containersis INFREQUENT_ACCESS, sofilter-log-events/get-log-eventsreject it — use Logs Insightsstart-query.Specific to this change
Context — plan, discoveries, measurements, files
Plan
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; plusgroup()— per-member attachment = strongest within-group edge (activealways-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.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, returningentity_idper edge.er-server— shipconfidence(floored integer) besidematch_probabilityon review page items, match-scores rows, match-preview samples, resolve candidates;/duplicatesgroups gaingroup_confidence,master_record_key,member_confidences; merge-plans JSON + CSV gaingroup_confidence(same aggregation, so the export shows the UI's number).ReviewRow/MatchScoreRow/DuplicateGrouptypes gain the new fields; decision panel, score-band browser, review inbox and duplicates render the shipped integer;probabilityLabelkeeps only the "no score" case.pg_golden_read.rs(duplicates groups, review band at 0.80 excluding a 0.796 pair whose confidence reads 79),merge_plans_csvunit test for the new column, frontend component tests rendering the shipped values./duplicates?record_key=…) ignoresrecord_keyand returns group-shaped items whilewidget-view.tsxexpects{record_key, match_probability}— it renders "— / no score" for every item today (pre-existing, out of scope here).Discoveries
Thresholds::full_agreement_bits("auto_merge: 20means '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 uses0.95/0.60; the engine comparesmatch_probability >= review_low. No threshold-semantics change in this PR.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 ownmaster_keyfor survivorship.match_scoresedge (assertion-sourced edges are never persisted there, S4.4); they count as confidence 100 per S4.4's "assertion-sourced edges (score 1.0)".confidenceis the AI adjudication proposal's confidence (lib/adjudicate/propose.ts), a different domain — untouched.merge-plans?format=csv— that is the export surface this ticket wires, not E11's future one.Files
rust/crates/dedupe-core/src/confidence.rs(new) +src/lib.rsexportentities/match_score/read/within_groups.{sql,yaml}(new) + generated artifacts viaer-entity genrust/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'
scoredCTE 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 (thedup_group_stats.sqlprecedent), existence-gated fetch.Measurements