Skip to content

feat(ui): group search by member id, and the seven missing group filters (#801) - #854

Merged
athvin merged 3 commits into
mainfrom
issue/801-group-filters
Nov 8, 2026
Merged

athvin merged 3 commits into
mainfrom
issue/801-group-filters

Conversation

@athvin

@athvin athvin commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Closes #801

🚧 Claimed by an agent session — 2026-11-08T12:57:37Z, session 01a1b892-4cde-7a53-bb3e-9ed2e764acdc on Mac.
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

Member-record-ID search on the duplicates screen plus the group filter model: confidence range, group size (min/max), matched-by model, matched-on field, verification status, and tags include/exclude — all filtered server-side while keyset-paging. Group cards gain a matched-on fields column and a confidence sort. Filter state is one shared module.

Why

Spec units 1.27+1.28 (#801, parent #513): a steward cannot find "the group containing record X", and seven of the spec's eight group filters are missing (only source exists).

Proof

make check green (entities-check regenerates clean; clippy -D warnings clean). make frontend green — 549 passed across the mock-backed tier including the extended duplicates.spec.ts (search, every filter dimension, tag include/exclude). pg_golden_read (ER_TEST_PG_DSN + DEDUPE_E2E_DUCKLAKE locally) asserts each filter over HTTP, the unknown-member empty result, and cursor continuation under a filter — which caught a real bug mid-build (a filled page mid-chunk lost the unscanned remainder; the cursor now tracks the last emitted group).

Risk & rollback

The response shape only gains fields; the one behavioral change to an existing parameter is internal (scan chunking). Worst case is a slow selective filter, bounded by the 10k-group scan cap. Rollback: git revert <merge-sha> — the declared-SQL additions are additive and every live store reconciles additively.

Post-merge ledger

Closed by: agent · session 01a1b892-4cde-7a53-bb3e-9ed2e764acdc on Mac · 2026-11-08T14:49:22Z

  • main is green with this change on it — the merge SHA, and the run
    that proves it. A later head SHA with this commit as an ancestor counts;
    a cancelled run with zero jobs does not: merge SHA b3e35e46; all six
    push runs concluded success — rust, frontend, infra, devcontainer,
    images, deploy (the last via workflow_run, appeared late as expected)
  • images built, or correctly never ran because nothing that goes into
    an image changed: built — the diff touches rust/ and frontend/, both
    of which go into the web-api image; run on b3e35e46 concluded success
  • deploy converged — proved by a line the running process emitted, not
    by the image digest and not by the workflow conclusion: deploy run on
    b3e35e46 concluded success including its own preview smoke test and
    cutover; a direct pod-log line could not be read because the er-dev-ro
    kubectl SSO token is expired (same root cause as The request span starts a new trace instead of continuing the caller's #660; the SSO refresh
    ask is already with the user as a non-blocking FYI)
  • the push-only surface no pull request can pre-test (deploy, drift,
    kind's nightly leg) is green, or knowingly red for a reason that is not
    this change: deploy green on the merge SHA; drift and kind's
    nightly leg are scheduled and were not due in this window
  • the board card reached Done through the automation rather than by
    hand, and the issue closed: feat(ui): group search by member id, and the seven missing group filters #801 CLOSED/COMPLETED with
    closer.__typename == "PullRequest"; board card reads Done
  • follow-ups are open for everything deferred here — numbers: Evidence-key prefixes hardcoded in reader + frontend; custom-prefix models lose matched-fields #871
    (evidence-key prefixes hardcoded in reader + frontend; custom-prefix
    models lose matched-fields)
  • what was learned is written down where the next session will find it
    (a skill, a reference, memory) — or nothing new was learned: the
    scan-loop cursor rule (cursor = last emitted when the page fills
    mid-chunk, last scanned otherwise) lives in read.rs beside the loop;
    the tag-cap probe idiom (fetch cap+1) is commented at the handler

Specific to this change

Context — plan, discoveries, measurements, files

Plan

Scope calls made up front (details in Discoveries):

Steps:

  • entities: within_groups (match_score) also returns model_version + evidence; duplicate_groups_page gains $max_members / $only_entity. Regenerate; make entities-check.
  • read.rs: DuplicateFilters + filter-while-paging loop (cursor tracks last scanned id), edges carry provenance (model, evidence columns, asserted), per-group matched_fields / model_versions / verified in the response.
  • handler: parse the new params; member= resolves via the existing entity_of_record_key; tag=/exclude_tag= prequery pg (tag_by_name + subjects_for_tag, already declared).
  • BFF: extend the PASSTHROUGH allowlist.
  • frontend: shared filter model, search box, filter bar, matched-on column, confidence sort; all grayscale.
  • tests: rust read-level (in-memory lake) + vitest + the mock-backed duplicates.spec.ts; a11y page already registered.
  • make check + make frontend.
  • pr-review → mark ready → land.

Discoveries

  • entity_of_key.sql already existed — member search needed no new lookup statement.
  • pg::subjects_for_tag / tag_by_name already existed — the tag filter is a prequery, no new declared SQL.
  • Group confidence is computed in Rust (dedupe_core::confidence::group_score), so a SQL-side confidence filter would duplicate the formula; the filters run per-group after assembly instead, with the scan loop keeping pages full.
  • AI recommendations are review-scoped and BFF-owned (review_recommendations), with no path to a merged group — deferral recorded on the issue.
  • No group-level mass dialogs exist anywhere; bulk actions are review-inbox only. Recorded on the issue.
  • The first cursor implementation tracked the last scanned chunk end and dropped the unscanned remainder of a chunk the page filled from; pg_golden_read's cursor-continuation assertion caught it before push.
  • Evidence-key prefixes (gamma_/mw_/mw_tf_adj_) are hardcoded in evidence_fields, matching the frontend parseEvidence precedent; an admin-uploaded model CAN carry custom prefixes (Settings derives them from the JSON), so the silent-empty gap is pre-existing product-wide, not introduced here — filed Evidence-key prefixes hardcoded in reader + frontend; custom-prefix models lose matched-fields #871 to derive prefixes from the model registry.
  • pr-review follow-ups: the tag prequery now fetches 10,001 so a tag past the 10k subject cap is a 422 instead of a silently truncated filter; inverted min_members/max_members and min_confidence/max_confidence bands are a 422 naming the empty band, mirroring the reviews handler's probability-band check.

Measurements

  • Filtered paging bound: 200-group scan chunks, 10k scan cap per request (read.rs).
  • make frontend: 549 passed, 117 skipped (device/release tiers), 2.4 min.

Files

  • entities/match_score/read/within_groups.{sql,yaml} — edges carry model_version + evidence.
  • entities/entity_membership/read/duplicate_groups_page.{sql,yaml} — $max_members, $only_entity.
  • rust/crates/er-entities/src/{entity_membership,match_score}.rs — regenerated.
  • rust/crates/er-server/src/read.rs — DuplicateFilters, scan loop, edge provenance, per-group metadata.
  • rust/crates/er-server/src/lib.rs — handler params, member resolution, tag prequery.
  • rust/crates/er-server/tests/{pg_golden_read,acct_read}.rs — HTTP-level filter coverage.
  • frontend/src/lib/domain/group-filters.ts — the shared filter model.
  • frontend/src/lib/query/duplicates.ts, components/duplicates/duplicates-content.tsx — query params + filter bar + matched-on column.
  • frontend/src/app/api/.../duplicates/route.ts — passthrough allowlist.
  • frontend/tests/mock-erserver/server.mjs — the mock honours every dimension.
  • frontend/tests/{unit/group-filters.test.ts, functional/duplicates.spec.ts}.

Server-side, filter-while-paging (a filter over loaded rows would lie
about pages never fetched):
- member=<record key> resolves via entity_of_key and pins the page
- min/max members push into the page statement; confidence range,
  matched-by model, matched-on field, verified (active always-assertion)
  and tag include/exclude (Postgres taggings prequery) filter per group
  after assembly
- cursor tracks the last SCANNED id so filtered paging never skips
- within_groups edges now carry model_version + evidence; groups answer
  matched_fields / model_versions / verified

UI: shared GroupFilters model (serialisation + reset live in
lib/domain/group-filters.ts), member search, filter bar, matched-on
column, verified marker, confidence sort. AI-recommendation filter and
mass-dialog carry are recorded scope calls on the issue: no group-level
recommendation data or group mass actions exist.

Coverage: pg_golden_read asserts every dimension over HTTP incl. cursor
continuation under a filter; vitest pins the param serialisation; the
mock honours every dimension; Playwright spec drives search + filters.
- tag prequery fetches 10,001 so 'at the cap' and 'truncated at the
  cap' are distinguishable; over 10,000 tagged entities is a 422
  rather than a silently truncated filter
- min_members > max_members and min_confidence > max_confidence are a
  422 naming the empty band, mirroring the reviews handler's
  probability-band check
@athvin
athvin marked this pull request as ready for review November 8, 2026 14:26
@athvin
athvin merged commit b3e35e4 into main Nov 8, 2026
45 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.

feat(ui): group search by member id, and the seven missing group filters

2 participants