Skip to content

feat(review): merge arbitrary records the matcher never grouped (#804) - #872

Merged
athvin merged 3 commits into
mainfrom
issue/804-merge-arbitrary
Nov 8, 2026
Merged

athvin merged 3 commits into
mainfrom
issue/804-merge-arbitrary

Conversation

@athvin

@athvin athvin commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Closes #804

🚧 Claimed by an agent session — 2026-11-08T14:20:42Z, 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

The records browser gains a steward/admin multi-select with a "Merge selected"
action opening a ManualMergeDialog: the selected entities with their member
counts, a radio picking the survivor (master = the survivor's first member),
then POST /merges with the union of member keys, apply_now: true and no
review_id. Server-side, merge_group now derives the merge's origin from the
bundle itself — review_id present → review, absent → manual — recorded in
the assertion note ("manual merge (no detected group)") and the
steward.merge_group audit detail's "origin".

Why

Spec 2.10 / #804: records the matcher never grouped had no group-selection
merge path with a master choice (#802's dialog covers pairwise entity ad-hoc
merge), and nothing distinguished a manual merge from a detected one in the
ledger. Overrides stay post-merge deliberately — the GroupMergeEditor on the
merged entity already covers them.

Proof

  • make check — green, including pg_merge_group::merge_group_bundle_and_manual_merge_equality
    run locally with ER_TEST_PG_DSN + DEDUPE_E2E_DUCKLAKE=1 (two identical
    lakes; manual merge of the never-grouped crm:C005 + billing:B006 pair equals
    the detected-path golden, origin asserted in the assertion notes and audit).
  • make frontend — green: 558 passed / 0 failed; new unit tests for
    manualMergePayload, and a Playwright journey (viewer sees no selection,
    two-record merge asserts the POST body, axe scan on the open dialog).

Risk & rollback

Low: additive UI gated to steward/admin, and the server change is a derived
marker on an endpoint that already accepted arbitrary keys. Roll back with
git revert <merge-sha>.

Post-merge ledger

Closed by: unclosed

  • 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:
  • images built, or correctly never ran because nothing that goes into
    an image changed:
  • deploy converged — proved by a line the running process emitted, not
    by the image digest and not by the workflow conclusion:
  • 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:
  • the board card reached Done through the automation rather than by
    hand, and the issue closed:
  • follow-ups are open for everything deferred here — numbers:
  • what was learned is written down where the next session will find it
    (a skill, a reference, memory) — or nothing new was learned:

Specific to this change

Context — plan, discoveries, measurements, files

Plan

  • Server — manual origin. merge_group derives origin from
    review_id presence; assertion notes distinguish "manual merge (no
    detected group)" vs "review merge dialog"; audit detail gains
    "origin". No client-supplied flag to spoof.
  • Server — the equality test. pg_merge_group.rs second phase: the
    never-grouped pair merged with no review_id equals the detected-path
    golden, with the origin marker asserted. Restructured into sequential
    phases after pg_serial rejected two #[tokio::test]s in one file.
  • Frontend — arbitrary selection. Steward/admin multi-select +
    ManualMergeDialog (survivor radio, master = survivor's first member,
    union of member keys, apply_now: true, no review_id).
  • Tests, frontend. Unit tests for the payload assembly; Playwright
    journey asserting the POST body; axe scan on the open dialog.
  • Gates: make check, make frontend, pg+e2e run locally with both envs.

Discoveries

  • The ticket's "no entry point" predates feat(ui): make the review comparison editable — group with a master, click-to-copy, inline edit #802: MergeRecordsDialog already
    merges two ENTITIES ad hoc. What was genuinely absent: GROUP selection with
    a master choice, and any manual-origin marker in the audit trail.
  • POST /merges already accepted arbitrary record keys and an optional
    review_id; the server gap was only the origin marker.
  • Two harness traps found by the gates: pg_serial keys one Postgres database
    per test FILE (extra tests become sequential phases with their own org
    names), and the mock erserver's POST /merges bumps the org's stagedCount
    — so a mutating journey cannot run on acme-dev, whose "3 decisions queued"
    banner reviews.spec.ts asserts verbatim. The journey runs on merge-dev, which
    gained the two golden entities it selects.
  • The axe bar has a known trap (documented in a11y.spec.ts): axe samples the
    dialog mid animate-lift-in and reports colour-contrast violations against
    markup compliant once the animation completes; the spec scans under
    reducedMotion: "reduce".

Files

  • rust/crates/er-server/src/lib.rs — origin derivation in merge_group.
  • rust/crates/er-server/tests/pg_merge_group.rs — the two-phase e2e.
  • frontend/src/lib/domain/manual-merge.ts — pure payload assembly.
  • frontend/src/components/records/manual-merge-dialog.tsx — the dialog.
  • frontend/src/components/records/records-browser.tsx — selection UI.
  • frontend/src/lib/query/merge-group.ts, keys.ts — optional overrides,
    apply_now, golden/entity invalidation on success.
  • frontend/tests/unit/manual-merge.test.ts,
    frontend/tests/functional/records.spec.ts,
    frontend/tests/mock-erserver/server.mjs — tests and fixtures.

Steward/admin multi-select on the records screen opens a manual merge
dialog that unions the selected entities' members, lets the steward pick
the surviving entity (its first member becomes master), and POSTs
/merges with apply_now and no review_id. er-server derives the merge
origin from review_id presence and records it in the assertion note and
the steward.merge_group audit detail; no client-supplied flag.

Closes #804
…ev pristine

pg_serial allows one tokio::test per file: merge_group's two tests become
sequential phases sharing the file's one database, the manual phase keyed
on initech/globex since the first phase owns acme. The manual-merge
Playwright journey moves to merge-dev — its POST bumps the org's
stagedCount, and acme-dev's banner count is asserted verbatim by the
reviews spec. merge-dev gains the two golden entities the journey
selects. Drops a lint-flagged unneeded type assertion in the unit test.
@athvin
athvin force-pushed the issue/804-merge-arbitrary branch from 16f74a0 to 37422da Compare November 8, 2026 15:39
@athvin
athvin marked this pull request as ready for review November 8, 2026 15:40
@athvin
athvin merged commit dab0767 into main Nov 8, 2026
48 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(review): merge arbitrary records the matcher never grouped

2 participants