Skip to content

feat(writeback): manual, batch and policy-driven merge review (#997) - #1323

Merged
athvin merged 1 commit into
mainfrom
feat/997-review
Nov 27, 2026
Merged

athvin merged 1 commit into
mainfrom
feat/997-review

Conversation

@athvin

@athvin athvin commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

Closes #997

Post-merge is part of this pull request. The ledger below records whether
the follow-up work actually happened. /land-pr closes it.

The /{org}/{ds}/writeback review surface (BFF routes, hooks, page, nav), batch decisions, weakest-link score evidence on previews, append-only auto-approval rules applied at publish time, and the apply outcome on the preview detail. connectors.md §4.3.4.

#997: review merge proposals manually, in batches and by policy — all three ending in the same guarded apply (#995) and undo (#996).

Proof

  • pg_merge_preview_dag (real DuckLake pipeline): the crm pair's group carries a score from the match run's edges, and a rule set before generation approved it as it was published, decided_by = policy:<rule>.
  • pg_merge_preview_api: batch reject — the valid item decided, a stale fingerprint refused, an unknown id 404, each reported separately; viewer 403; a bad decision 422; rules admin-only and range-checked.
  • group_score unit test: the weakest victim's strongest in-group edge; an edge leaving the group ignored; a victim with no edge → no score.
  • Playwright writeback.spec.ts (three device projects): viewer sees scores and "no evidence" with no actions; a steward batch-approves two and sees 2 decided, 0 refused; an admin opens an auto-approved, applied preview and requests its undo. Axe: writeback has no serious violations.
  • make check exit 0; full Postgres suite 160 passed. make frontend: vitest 1139 passed; Playwright 1106 passed, 1 failed — account.spec.ts "the new-source wizard maps onto the account canonical attributes" on mobile-chrome only (a wizard select not yet hydrated with its auto-mapped value). This diff touches neither the source wizard nor mobile navigation; CI's run is the arbiter.
  • Desktop baselines regenerated in mcr.microsoft.com/playwright:v1.63.0-jammy (update-baselines.sh): the eleven pages that show the rail. Three marketing baselines the =all rewrite also touched were reverted as render noise.

Risk & rollback

Auto-approval is opt-in per (connection, object) and never acts without score evidence; nothing writes to Salesforce until an admin applies. git revert <merge-sha>.

Post-merge ledger

Closed by: agent · session Claude Code:24d16c2e-fec6-49d8-9797-060338df4848 on brians-MacBook-Pro · 2026-11-27T08:34:05Z

  • 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: — 6798182, rust 45964417084 + frontend 45964417233 success
  • images built, or correctly never ran because nothing that goes into
    an image changed: — success, run 45964417300
  • deploy converged — proved by a line the running process emitted, not
    by the image digest and not by the workflow conclusion: — run 45964923860 success; the live process serves the new API (https://dupezero.com/api/openapi lists writeback/auto-approval), and the running er-web pod (web-api-blue, created 08:21Z) contains .next/server/app/(tenant)/[org]/[ds]/writeback/page.js and the merge-previews/decide BFF route
  • 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: — infra, devcontainer, marketing preview all success on 6798182
  • the board card reached Done through the automation rather than by
    hand, and the issue closed: — E9: Add manual, batch and policy-driven writeback review #997 CLOSED by feat(writeback): manual, batch and policy-driven merge review (#997) #1323 via automation
  • follow-ups are open for everything deferred here — numbers: — none; upserts (E9: Apply approved upserts through the writeback journal #998) are the next ticket and reuse this surface
  • what was learned is written down where the next session will find it
    (a skill, a reference, memory) — or nothing new was learned: — the local Playwright failure in account.spec (mobile-chrome) did not reproduce in CI, consistent with the known hydration race; unauthenticated probes cannot tell a real page from a missing one here (both 307/401), so the running pod's build is the evidence

Specific to this change

  • the deploy adds merge_previews.score and reconciles merge_auto_approvals — the new er-server serves (boot reconcile refuses to start on a failed apply), run 45964923860
  • the writeback page is in the deployed app — the running er-web build contains its page bundle (probing the URL unauthenticated only reaches the login redirect, identical for any path)
Context — plan, discoveries, measurements, files

Plan

Discoveries

  • Previews had no score at all, so "absent score evidence cannot auto-approve" had nothing to evaluate. The score is computed in the preview job from the lake's active edges, at the preview's own snapshot.
  • The mock-fabrication gate correctly caught seven response-struct renames (connection_id, policy_revision, at, …) as fields no entity declares; each is now explained with its source.

Measurements

Files

🤖 Generated with Claude Code

The tenant surface for Salesforce writeback, and the two review modes it
lacked.

- /{org}/{ds}/writeback: previews by state with master, victims, master field
  diffs, score, related-count availability, the apply outcome, the undo
  (conflicts, and that reparented records are not moved back) and history.
  Stewards approve/reject singly or in batches; admins apply and undo.
- POST …/merge-previews/decide: up to 100 items, each through exactly the
  single-item checks (fingerprint seen, proposal still validates, policy
  revision and connection live), each reporting its own status.
- Score evidence: a preview's score is weakest-link — for each victim, its
  strongest active match_scores edge to another member of the same group,
  then the minimum; NULL when any victim has none (a nullable column).
- Auto-approval: PUT/GET …/writeback/auto-approval, an append-only rule per
  (connection, object) with min_score and max_members, applied only as a
  preview is published and attributed to policy:<revision>. Changing a rule
  never rewrites a decision; a NULL score is never auto-approved.
- The preview detail carries the apply's status and detail.
- BFF routes, query hooks, mock-erserver routes, a functional spec, the axe
  gate entry, and the desktop baselines the new nav item moves.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

The marketing preview was removed because this PR is closed or merged.

@athvin
athvin merged commit 6798182 into main Nov 27, 2026
49 checks passed
@athvin
athvin temporarily deployed to marketing-preview November 27, 2026 08:16 — with GitHub Actions Inactive

This branch was previously deployed

1 inactive deployment
marketing-preview — 327d8f98 Deployed Nov 27, 2026 by athvin via remove closed PR previews #105
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.

E9: Add manual, batch and policy-driven writeback review

2 participants