Skip to content

fix(blocking): the largest-block figure was n^2, and the UI called it "pairs" - #442

Merged
athvin merged 1 commit into
bm/profile-p5-read-apifrom
bm/profile-p6-blocking-pairs-honest
Nov 5, 2026
Merged

athvin merged 1 commit into
bm/profile-p5-read-apifrom
bm/profile-p6-blocking-pairs-honest

Conversation

@athvin

@athvin athvin commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Stacked on #426 so the diff is only this fix; GitHub retargets to main when that merges.

The bug

GET /blocking-estimate reported count_l * count_r for every block. That is right for link_only — two disjoint sides, every ordered pair scored — and wrong for a dedupe, which compares one table with itself under uid_l < uid_r and therefore scores C(n, 2). base_10 is dedupe_only, so every block came back at roughly twice its real size: 4095 against 253 for fake_1000's largest surname.

It was not buried in a payload. run-cost.tsx rendered it as "N pairs" in the same panel as the rule's genuine marginal count:

Adds            1,526 pairs
Largest blocks  Jones — 4,095 pairs     ← contributes 253

Two figures, one view, inconsistent by 16×.

The fix

LargestBlock::scored_pairs(link_type) returns what a run actually scores: the raw product for link_only, C(n, 2) for dedupe and link_and_dedupe (which scores within sources as well as across them, so the same filter applies and the block is one population rather than two).

block_count keeps its name, meaning and golden. It was never wrong — it was being asked the wrong question.

Every rule is broken down now, not just the first

n_largest is per rule, which is what makes the list comparable across rules instead of a view of whichever happened to be first. The e2e assertion that encoded the old per-estimate meaning is updated rather than loosened.

A rule carrying a filter condition has no breakdown at all, and that now reaches the wire as has_block_breakdown. Without it, "cannot be enumerated" and "examined, none found" are indistinguishable — and the second reads as reassurance about a rule nobody measured. The UI shows "not countable" and says in prose that it is a limitation of the estimate, not a clean bill of health.

rows ships beside pairs because pairs are quadratic in rows. That is the entire mechanism by which one shared value dominates a run, and showing only the derived figure hides it. The panel now explains that too.

The invariant that catches it — which did not exist before

A block cannot hold more pairs than the rule it belongs to generates, and a dedupe block's pairs are exactly C(rows, 2).

Verified by injection: restoring b.block_count fails with a dedupe block's pairs are C(rows, 2); got 4 for 2 rows.

The mock was mirroring the bad number

largest_blocks in the Playwright mock sent rows * rows too, so mock and server agreed on a value neither should have produced — the mock-asserts-the-frontend's-belief class again, caught here only because the fix forced me to look at it. It now sends C(rows, 2) with rows and match_key, and mock-fabrication + wire-contract pass against the corrected shape.

Verification

  • the_blocking_estimate_matches_what_a_run_actually_scores green, with the new reconciliation assertions, and observed failing on the injected old behaviour.
  • cargo clippy -p dedupe-core -p er-cli --all-targets -- -D warnings clean.
  • tsc --noEmit clean (0 errors); wire-contract + mock-fabrication pass. I typechecked by symlinking the main checkout's node_modules — gitignored, and this branch touches no frontend deps — rather than ship unverified TS from a worktree with no install.
  • Builds clean against current main's async control tasks and OTLP spans.

Found while writing PR A's dedupe_block_pairs, deferred then because it is a response-shape change, and fixed here.

🤖 Generated with Claude Code

@athvin
athvin force-pushed the bm/profile-p6-blocking-pairs-honest branch from 9279779 to 53a07b9 Compare November 3, 2026 05:01
@athvin
athvin force-pushed the bm/profile-p5-read-api branch from e0dba23 to d009c8e Compare November 3, 2026 05:04
@athvin
athvin force-pushed the bm/profile-p6-blocking-pairs-honest branch from 53a07b9 to 5fc3b9c Compare November 3, 2026 05:04
@athvin
athvin force-pushed the bm/profile-p5-read-api branch from d009c8e to 634a940 Compare November 3, 2026 07:04
@athvin
athvin force-pushed the bm/profile-p6-blocking-pairs-honest branch from 5fc3b9c to cca440e Compare November 3, 2026 07:04
@athvin
athvin force-pushed the bm/profile-p5-read-api branch from 634a940 to 08701a7 Compare November 3, 2026 07:23
@athvin
athvin force-pushed the bm/profile-p6-blocking-pairs-honest branch from cca440e to 1668755 Compare November 3, 2026 07:23
@athvin
athvin force-pushed the bm/profile-p5-read-api branch from 08701a7 to a8a1496 Compare November 5, 2026 00:18
@athvin
athvin force-pushed the bm/profile-p6-blocking-pairs-honest branch from 1668755 to fe0c9c5 Compare November 5, 2026 00:18
@athvin
athvin force-pushed the bm/profile-p5-read-api branch from a8a1496 to 5a3fc94 Compare November 5, 2026 01:18
@athvin
athvin force-pushed the bm/profile-p6-blocking-pairs-honest branch from fe0c9c5 to d9ba7c9 Compare November 5, 2026 01:18
@athvin
athvin force-pushed the bm/profile-p5-read-api branch from 5a3fc94 to c742876 Compare November 5, 2026 01:56
@athvin
athvin force-pushed the bm/profile-p6-blocking-pairs-honest branch from d9ba7c9 to 5674356 Compare November 5, 2026 01:56
… "pairs"

`GET /blocking-estimate` reported `count_l * count_r` for every block. That is
right for `link_only`, where two disjoint sides mean every ordered pair is
scored, and WRONG for a dedupe, which compares one table with itself under
`uid_l < uid_r` and therefore scores `C(n, 2)`. base_10 is `dedupe_only`, so
every block came back roughly twice its real size — 4095 against 253 for
fake_1000's largest surname.

The number was not buried. `run-cost.tsx` rendered it as "N pairs" in the same
panel as the rule's genuine marginal count, so a user comparing the two saw
"Adds 1,526 pairs" beside "Jones — 4,095 pairs" when Jones contributes 253.
Two figures, one panel, inconsistent by 16x.

`LargestBlock::scored_pairs(link_type)` now returns what the run actually
scores: the raw product for `link_only`, `C(n, 2)` for dedupe and
`link_and_dedupe` (which scores within sources as well as across them, so the
same filter applies and the block is one population rather than two).
`block_count` keeps its name and meaning and stays pinned by the golden — it is
not wrong, it was being asked the wrong question.

**Every rule is broken down now, not just the first.** `n_largest` is PER RULE,
which is what makes the list comparable across rules instead of a view of
whichever happened to be first; the e2e assertion that encoded the old
per-estimate meaning is updated rather than loosened. A rule carrying a filter
has no breakdown at all, and that now reaches the wire as
`has_block_breakdown` — without it, "cannot be enumerated" and "examined, none
found" are indistinguishable, and the second reads as reassurance about a rule
nobody measured. The UI renders it as "not countable" and says so in prose.

`rows` ships beside `pairs` because pairs are QUADRATIC in rows, which is the
whole reason one shared value can dominate a run; showing only the derived
figure hides the mechanism. The panel now says that too.

**The invariant that catches it, which did not exist before:** a block cannot
hold more pairs than the rule it belongs to generates, and a dedupe block's
pairs are exactly `C(rows, 2)`. Verified by injection — restoring
`b.block_count` fails with "a dedupe block's pairs are C(rows, 2); got 4 for 2
rows".

The Playwright mock mirrored the server's bad number, so both agreed on a value
neither should have produced — the mock-asserts-the-frontend's-belief class
again. It now sends `C(rows, 2)` with `rows` and `match_key`, and
`mock-fabrication` plus `wire-contract` pass against the corrected shape.

Found while writing PR A's `dedupe_block_pairs`, deferred then because it is a
response-shape change, and fixed here.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@athvin
athvin force-pushed the bm/profile-p5-read-api branch from c742876 to 8165b83 Compare November 5, 2026 02:26
@athvin
athvin force-pushed the bm/profile-p6-blocking-pairs-honest branch from 5674356 to e95b978 Compare November 5, 2026 02:26
@athvin
athvin merged commit 8006e08 into bm/profile-p5-read-api Nov 5, 2026
39 checks passed
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.

2 participants