Skip to content

feat(ui): editable review group dialog — N records, master, click-to-copy (#802) - #829

Merged
athvin merged 2 commits into
mainfrom
issue/802-review-group-dialog
Nov 8, 2026
Merged

athvin merged 2 commits into
mainfrom
issue/802-review-group-dialog

Conversation

@athvin

@athvin athvin commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Closes #802

🚧 Claimed by an agent session — 2026-11-08T01:00:41Z, codex session 01a1b861-d8a0-7400-8aae-17fdde0059ec 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

Makes the review merge editable: a group dialog (N records from both sides' entities, not just the pair) with a designated master, click-to-copy/revert per field, inline edit for text + date attributes, and master reassignment — persisted through a new POST /merges that stages the assertion star, the master protect and record-keyed field overrides in one bundle. Record-keyed overrides are a new lake store (golden_record_override) resolved through fresh membership at golden-assembly time, so copied values land on the entity the merge mints.

Why

Spec unit 2.8 (parent epic #516). The dialog displayed a pair comparison but could not edit one, and the pair shape hid the records a merge would actually combine.

Proof

make check + make check-e2e; new component + functional tests (3-record group merged from the dialog lands exactly as shown); make frontend. Base golden fixtures byte-identical (the new store is empty for every existing org).

Risk & rollback

New lake table and a new staging bundle — both inert until the dialog is used; existing override and resolve paths untouched. Rollback: git revert <merge-sha>; any staged record-keyed overrides are inert rows without the assemble reader.

Post-merge ledger

Closed by: agent · codex session 01a1b861-d8a0-7400-8aae-17fdde0059ec on brians-MacBook-Pro · 2026-11-08T06:23:45Z

  • main is green with this change on it — 0a4aac5 is main's tip;
    rust, frontend, infra, devcontainer, images, deploy ALL success on the
    merge SHA itself (no cancelled zero-job stand-ins):
  • images built — rust + frontend image inputs changed, run success
    on 0a4aac5, and deploy fired off it via workflow_run:
  • deploy converged — run 42453758748's smoke step logged
    er-api-preview /readyz -> 200 and er-web-preview /api/healthz -> 200
    ("the blue colour serves through its own Services") before cutover, then
    concluded success. A pod-level log line beyond the smoke probe was not
    observable from this session — no cluster credentials (kubectl: "the
    server has asked for the client to provide credentials"):
  • 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 success on 0a4aac5; drift's scheduled leg success on
    b4b0b0f (06:02Z today, predates this merge — next leg tonight); kind's
    nightly leg success on b586498 (04:40Z today):
  • the board card reached Done through the automation rather than by
    hand, and the issue closed: feat(ui): make the review comparison editable — group with a master, click-to-copy, inline edit #802 CLOSED, card Done — verified via
    gh issue view + item-list, not moved by hand:
  • follow-ups are open for everything deferred here — numbers:
    merge-plans never shows the surviving entity of an assertion/steward merge #838 (merge-plans blind to the assertion-merge survivor — P1),
    mobile review flow has no group-merge path #842 (mobile group-merge surface):
  • what was learned is written down where the next session will find it
    (a skill, a reference, memory) — or nothing new was learned: five entries
    added to Discoveries below — the merge-plans never shows the surviving entity of an assertion/steward merge #838 mechanism, the one-review-per-test
    fixture rule, P1's ten-member shape, the HEAD-relative drift gate, and
    the envelope/MCP regenerate command:

Specific to this change

Context — plan, discoveries, measurements, files

Plan

  1. New lake entity golden_record_override (entities/golden_record_override/): record-keyed steward field pins, latest-wins per (record_key, attribute), NULL = clear. create/set + delete/clear statements; registered in er-schema model.rs + regenerated registry golden.
  2. 11 record-keyed assemble UPDATEs (entities/golden_record/update/override_record_<attr>.sql): resolve record_key → entity_id through current entity_membership at golden-assembly time (latest created_at wins when several member rows name one attribute). Applied in run_golden AFTER the entity-keyed pass, so dialog choices win; an empty table is a byte-exact no-op (base fixtures unchanged).
  3. New staged action override_field_by_record in er-cli::apply_staged_action_labeled — mirrors override_field, writes the record-keyed store.
  4. POST /v1/orgs/{org}/datasets/{ds}/merges (steward): {records[2..=50], master, overrides[0..=11], review_id?, apply_now}. Stages, in one bundle: an always assertion star to the master, protect_record(master), each override keyed by the master's record_key, and resolve_review(match) when a review is named; apply_now enqueues apply_corrections like mass-update. Audit steward.merge_group.
  5. GET …/reviews/{review_id}/merge-group (viewer): composes existing reads server-side — review's pair → each side's entity (via entity_of_record_key) → union of member keys (entity_member_keys, rec_a's entity first) → records_by_key values, each item stamped with its entity_id; {items, total, snapshot}. 422 for entity-subject reviews (no pair).
  6. BFF routes: POST /api/orgs/[org]/datasets/[ds]/merges (steward) and GET …/reviews/[reviewId]/merge-group (viewer), zod-validated, requireDatasetAccess.
  7. Dialog primitive via pnpm dlx shadcn@latest add dialog (the house rule for a missing primitive), then merge-group-dialog.tsx: N record columns, master leftmost and marked by inversion + the word "master" (no hue); radio in each header reassigns the master; clicking a member's differing non-empty value stages a copy (weight + underline + sr-only "staged"), clicking again reverts; master cells inline-edit (text input, type=date for birth_date — the only typed kinds the attribute model carries); footer merges with the staged count in the label.
  8. DecisionPanel gains an "Edit & merge…" button (steward, pair reviews only) opening the dialog. Mobile SwipeCard keeps the fast path — noted as a follow-up candidate, not this PR.
  9. Draft-state reducer frontend/src/lib/domain/merge-draft.ts: pure stage/revert/reassign/clear logic — the unit-tested core, which also feeds the src/lib coverage floor.

Gates that prove it

  • make check (entities verify + lint + tests), make frontend (lint/types/unit + functional + axe), make check-e2e for the lake path.
  • New pg e2e pg_merge_group.rs (own binary; gated ER_TEST_PG_DSN + DEDUPE_E2E_DUCKLAKE=1): merge a 3-record group from one POST with a copied email → after apply_corrections, one entity holds all three records and its golden email is the copied value — "lands exactly as shown" at the lake level.
  • Functional Playwright: dialog on a 3-record review in mutable-dev (acme-dev is render-only), copy + inline-edit + reassign, assert the POSTed bundle matches what the dialog showed.
  • cli_e2e.rs fileless-table list gains golden_record_overrides.

Discoveries

  • The merge's entity id is minted at reconcile (random ULID), so entity-keyed overrides cannot target it — record-keyed staging resolved through fresh membership at assemble time is the whole design.
  • protect_record already forces master on the merge-plans read path; golden survivorship is per-field, so "master" alone never copies values — the overrides do that.
  • SourceRecord.entity_id was already declared in the frontend types but the server never sent it; the dedicated merge-group read sidesteps changing records_by_key.
  • No Dialog primitive was installed; added through the shadcn CLI per the design-system skill.
  • merge-plans is blind to the survivor of an assertion merge. merge_plans_sql's affected CTE keys on the entity_id an event names; reconcile_plan records merged only on the ABSORBED ids and member_added only for previously unclustered records, so the entity the steward just merged INTO earns no event and no plan row. Filed as merge-plans never shows the surviving entity of an assertion/steward merge #838; the pg e2e asserts the protect overlay at the lake instead, with pg_protect_master's organic merge covering the election read.
  • A mutating Playwright journey needs one fixture review PER TEST — merging resolves the review, so three tests over one review read "Inbox zero" by the third. merge-dev carries three same-shape copies for exactly this reason.
  • base_10's P1 persona carries a fourth record (crm:C009), so a three-persona merge mints a TEN-member entity, not nine.
  • The skills drift gate compares generated blocks against HEAD, so a regen must be COMMITTED before make check reports green locally — regen, commit, then gate.
  • New GET routes need cargo test -p er-server --test main response_envelopes -- --ignored regenerate (which also refreshes the MCP tools.json) or the BFF envelope contract test fails on the frontend side.

Measurements

  • make check green on the rebased head (14eaca6), incl. er-entity verify (50 entities / 255 statements current) and the full workspace test run.
  • make frontend green: 892 vitest unit/component (incl. 10 merge-draft + 7 grid), 546 Playwright functional passed across three device projects, axe serious/critical clean on the open dialog.
  • pg_merge_group e2e: 33s against local Postgres + DuckLake; asserts the staged bundle becomes the merged entity's golden record exactly as shown.
  • PR checks: all 15 required contexts green on 14eaca6, zero failed detect jobs.

Files

  • entities/golden_record_override/** (new), entities/golden_record/update/override_record_* (new), rust/crates/er-schema/src/model.rs + registry golden
  • rust/crates/er-cli/src/lib.rs (apply arm + assemble hook), rust/crates/er-server/src/lib.rs (two endpoints), rust/crates/er-server/src/read.rs (merge-group read)
  • frontend/src/components/review/merge-group-dialog.tsx, decision-panel.tsx, lib/query/merge-group.ts, lib/domain/merge-draft.ts, BFF routes, ui/dialog primitive
  • frontend/tests/mock-erserver/server.mjs (merge-group + merges routes, a 3-record review fixture in a mutable org), tests/functional/reviews.spec.ts
  • rust/crates/er-server/tests/pg_merge_group.rs (new binary), rust/crates/er-cli/tests/cli_e2e.rs (fileless list)

…cord-keyed field pins (#802)

Spec 2.8: the review decision panel gains an editable group merge. A new
record-keyed lake overlay (golden_record_override, latest-wins) carries the
dialog's per-field pins; POST /merges stages the assertion star + the master's
protect + the pins as one bundle; the dialog itself is a radix Dialog grid
with click-to-copy, inline edit and master reassignment over a pure draft
reducer.

Tested: merge-draft units, MergeGroupGrid component, a three-test Playwright
journey against a dedicated merge-dev fixture org, and a pg + DuckLake e2e
that drives the production bundle path and asserts the merged entity's golden
record carries exactly the pinned values.
@athvin
athvin force-pushed the issue/802-review-group-dialog branch from 75b6b70 to 14eaca6 Compare November 8, 2026 05:52
@athvin
athvin marked this pull request as ready for review November 8, 2026 05:52
@athvin
athvin merged commit 0a4aac5 into main Nov 8, 2026
47 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): make the review comparison editable — group with a master, click-to-copy, inline edit

2 participants