Skip to content

feat(writeback): materialize Salesforce merge previews from resolution results (#993) - #1310

Merged
athvin merged 1 commit into
mainfrom
feat/993-materialize-previews
Nov 27, 2026
Merged

athvin merged 1 commit into
mainfrom
feat/993-materialize-previews

Conversation

@athvin

@athvin athvin commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

Closes #993

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

The merge_preview job (pod materialize_previews → control publish_previews), er_golden::scoped_masters_sql with plan vectors, five snapshot-pinned lake statements, the merge_preview_watermarks checkpoint, the generate route, work-order injection, and the as-built contract in connectors.md §4.3.

#993: materialize merge previews from resolution results and persist them for approval — the half #1305 left. Together with #1296 and #1305 this completes #993's acceptance except the items listed as v1 limits.

Proof

  • pg_merge_preview_dag (DuckLake + executor harness): a provenanced crm in-source duplicate pair yields exactly one 2-member Contact preview; the matching uploaded webforms row never joins; no-policy generate is a no-op; regeneration changes nothing; the checkpoint advances. It first failed on a real bug in my generate key (it ignored policy revisions) — fixed.
  • er-sql-check: scoped election plans for 5 policies × protect.
  • Full cargo test -p er-server --test main against Postgres: 157 passed. make check: exit 0.

Risk & rollback

Opt-in: nothing runs without a writeback policy and a generate call; no external writes. git revert <merge-sha>.

Post-merge ledger

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

  • 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: — fa61df4, rust 45946303779 + frontend 45946303698 success
  • images built, or correctly never ran because nothing that goes into
    an image changed: — success, run 45946303689
  • deploy converged — proved by a line the running process emitted, not
    by the image digest and not by the workflow conclusion: — run 45946702312 success; the live process serves the new route: https://dupezero.com/api/openapi lists /merge-previews/generate, which only the new image has
  • 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, infra, devcontainer, marketing preview all success on fa61df4; drift/kind are scheduled, not merge-triggered
  • the board card reached Done through the automation rather than by
    hand, and the issue closed: — E9: Materialize merge previews and persist approval #993 CLOSED by feat(writeback): materialize Salesforce merge previews from resolution results (#993) #1310 via automation
  • follow-ups are open for everything deferred here — numbers: — Merge previews for account datasets #1309
  • what was learned is written down where the next session will find it
    (a skill, a reference, memory) — or nothing new was learned: — memory stale-tree-commit-reverts-main: the first push of this PR squashed with reset --soft origin/main onto a newer main and reverted ~3k lines of marketing work; caught by a webkit baseline failure, rebuilt by git merge-tree before merge

Specific to this change

  • account datasets — deferred — Merge previews for account datasets #1309
  • the deploy's schema-migrate creates merge_preview_watermarks — the new pod serves (boot reconcile refuses to start on a failed apply, and the old image lacks the route), run 45946702312
Context — plan, discoveries, measurements, files

Plan

Discoveries

  • Two tasks rather than four: the pod receives the dataset's provenance map in its work order (the resolver already injects Postgres state for extract), so the separate provenance control step was unnecessary.
  • The executor runs control tasks one at a time on its own client, so the publish batch and the checkpoint share one BEGIN/COMMIT.
  • Checkpoint is (snapshot_end, run id) without an entity resume: a job stops at a run boundary once 200 groups are built, always finishing at least one run.

Measurements

Files

🤖 Generated with Claude Code

@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.

…n results (#993)

The second half of #993: a `merge_preview` job turns a dataset's results
into reviewable writeback proposals, one per (entity, connection, object)
group, stored through #1305's persistence and approved through its API.

- POST …/merge-previews/generate (steward) queues the job; the key covers
  the checkpoint and the active policy revisions, so the same inputs give
  the same job.
- materialize_previews (pod, read-only, one pinned snapshot): reads
  succeeded runs after a (snapshot_end, run id) checkpoint, the entities
  their events touched, members, their latest raw rows and golden values.
  A member is eligible only on evidence — not deleted, its row's run has
  #1296 provenance for its own source, the source is not delivered by two
  connections, and a policy covers the (connection, object). Uploads never
  join. Masters come from er_golden::scoped_masters_sql: the export's
  policy vocabulary restricted to the eligible members per group
  (plan-vector tested for every policy × protect).
- publish_previews (control, one transaction): re-validates each
  proposal through MergeProposal::build against the pod's fingerprint,
  publishes idempotently, supersedes stale planned previews, then advances
  the checkpoint by compare-and-set.
- The Postgres context the pod cannot reach (policies, provenance,
  ambiguous sources, checkpoint) rides in its work order.
- writeback policy mapping keys must be golden record columns.

v1 limits: person datasets (#1309); related-record counts unavailable.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@athvin
athvin force-pushed the feat/993-materialize-previews branch from 51f52a7 to 6c5d6d8 Compare November 27, 2026 05:22
@athvin
athvin merged commit fa61df4 into main Nov 27, 2026
42 checks passed
@athvin
athvin temporarily deployed to marketing-preview November 27, 2026 05:31 — with GitHub Actions Inactive
athvin pushed a commit that referenced this pull request Nov 27, 2026
…sion

#1286 was one commit whose parent was a fresh main but whose tree came from
an old worktree. It undid seven merged pull requests, and every gate was
green: the squash was CLEAN and the old code was self-consistent. #1310
nearly did the same that day. The diff reads as a feature that also deletes
things. What gives it away is that each file's new content is a version
main already had and moved past.

`stale tree guard` (stale-tree-guard.yml) walks each changed file's history
on main and names the commits a return would undo. A file brought back
with the content it had before main deleted it is the same finding.
Deletions alone are not findings. It is graded on main's own history:
- three or more source files returning fails;
- fewer warn (#1302 deliberately took back two lines of #877);
- screenshot baselines are reported and never counted (#1298's CTA
  baseline landed on old bytes).

Replayed against #1286's commit and main's last 40 merges, each on its true
parent:
- #1286 fails, on 33 source files;
- so does #1300, the restore, its mirror image, a revert that would
  carry `revert-ok`;
- three merges warn;
- the other 35 are silent.

The self-test runs first in the job. It covers the #1286 shape, a partial
revert, a baseline on old bytes, a genuine change, both exemptions (a
`Revert…` title and the `revert-ok` label) and a shallow clone, which is
refused rather than passed. The check is not required yet, by the order the
ci-and-supply-chain skill gives.

Closes #1307

Co-Authored-By: Claude Opus 5.5 <[email protected]>
athvin added a commit that referenced this pull request Nov 27, 2026
…sion (#1315)

* wip: claim #1307 — flag a pull request whose files revert to an older main version

* feat(ci): flag a pull request whose files return to an older main version

#1286 was one commit whose parent was a fresh main but whose tree came from
an old worktree. It undid seven merged pull requests, and every gate was
green: the squash was CLEAN and the old code was self-consistent. #1310
nearly did the same that day. The diff reads as a feature that also deletes
things. What gives it away is that each file's new content is a version
main already had and moved past.

`stale tree guard` (stale-tree-guard.yml) walks each changed file's history
on main and names the commits a return would undo. A file brought back
with the content it had before main deleted it is the same finding.
Deletions alone are not findings. It is graded on main's own history:
- three or more source files returning fails;
- fewer warn (#1302 deliberately took back two lines of #877);
- screenshot baselines are reported and never counted (#1298's CTA
  baseline landed on old bytes).

Replayed against #1286's commit and main's last 40 merges, each on its true
parent:
- #1286 fails, on 33 source files;
- so does #1300, the restore, its mirror image, a revert that would
  carry `revert-ok`;
- three merges warn;
- the other 35 are silent.

The self-test runs first in the job. It covers the #1286 shape, a partial
revert, a baseline on old bytes, a genuine change, both exemptions (a
`Revert…` title and the `revert-ok` label) and a shallow clone, which is
refused rather than passed. The check is not required yet, by the order the
ci-and-supply-chain skill gives.

Closes #1307

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

---------

Co-authored-by: bmoore813 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

This branch was previously deployed

1 inactive deployment
marketing-preview — 6c5d6d85 Deployed Nov 27, 2026 by athvin via remove closed PR previews #95
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: Materialize merge previews and persist approval

2 participants