Skip to content

feat(writeback): merge previews for account datasets (#1309) - #1329

Merged
athvin merged 1 commit into
mainfrom
feat/1309-account-merge-previews
Nov 27, 2026
Merged

athvin merged 1 commit into
mainfrom
feat/1309-account-merge-previews

Conversation

@athvin

@athvin athvin commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

Closes #1309

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

What

An account dataset with an Account writeback policy now produces merge previews.

  • er-golden: acct_scoped_masters_sql runs the scoped election over acct_int_std_records and acct_golden_lineage, and most_complete counts ACCT_SURVIVABLE_COLUMNS. It shares one builder with the person election, whose SQL is byte-identical before and after (diffed over every policy × protect).
  • entities: acct_golden_record/read/by_ids.
  • preview_job: the election, the golden values and the mappable columns follow the config's entity type, for previews and for upserts.
  • Policy APIs: writeback and upsert policies validate field_mapping keys against the golden columns of the policy's object, so an Account policy maps company_name, domain and so on.
  • materialize_previews: it no longer returns NoOp for a non-person config, and VERSION goes to 2.

Why

The follow-up from #993. Before this, an account dataset's job settled as a no-op: the task refused non-person configs, and the materializer elected over person relations only.

Proof

  • New pg_merge_preview_acct_dag: an operator-created entity_type: account dataset with its config published. A crm Account extract carrying an in-source duplicate (c1/c9) is provenanced, and a vendors upload is not. Generating yields exactly one Account preview: members c1 and c9, golden_fields with company_name and domain, a master that is a group member, and score 0.9985. The vendors rows are excluded as no_provenance. With the task's old guard in place, the same test saw items: []. An Account policy mapping given_name is refused with 422.
  • er-sql-check: the_account_scoped_master_generator_plans_for_every_policy_and_topology (5 policies × protect), next to the unchanged person vectors.
  • make check: exit 0.
  • DEDUPE_E2E_DUCKLAKE=1 DEDUPE_E2E_EXTENSIONS=1 ER_TEST_PG_DSN=… cargo test -p er-server -p er-golden -p er-sql-check: 163 + 293 + 68 + 16 passed, 0 failed. That includes the person pg_merge_preview_dag and pg_merge_preview_api.

Risk & rollback

Person datasets run the same SQL as before. A previously accepted policy whose field_mapping named a person column on an Account object is now refused on its next PUT; such a policy could never have produced a preview. Rollback is git revert <merge-sha>.

Post-merge ledger

Closed by: agent · session Claude Code:871c2645-29b1-4996-bd69-8809abfc82fe on brians-MacBook-Pro · 2026-11-27T20:29:02Z

  • 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: 0899cf9: rust 46061573253, frontend 46061573274, images 46061573221, infra 46061573252, devcontainer 46061573204, all success.
  • images built, or correctly never ran because nothing that goes into
    an image changed: built, run 46061573221 success.
  • deploy converged — proved by a line the running process emitted, not
    by the image digest and not by the workflow conclusion: converged: deploy 46062031509 at 0899cf9, success, with the smoke test against the new colour logging readyz/healthz 200.
  • 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. drift is red on The er-alerts SNS email subscription has never been confirmed — 19 armed alarms reach nobody #1107's unconfirmed SNS subscriber and the nightly scale golden on scale golden (50k) fails deterministically on main since 03792063..ad38be23 (likely the DuckDB 2.0.1 bump) #1206, neither this change.
  • the board card reached Done through the automation rather than by
    hand, and the issue closed: Merge previews for account datasets #1309 closed by the merge.
  • follow-ups are open for everything deferred here — numbers: none.
  • what was learned is written down where the next session will find it
    (a skill, a reference, memory) — or nothing new was learned: an entity statement added under entities/ also moves er-span's er.statement cardinality bound and the generated skill references (make skills-check after committing the new files, since the drift check reads tracked files).

Specific to this change

🤖 Generated with Claude Code

The merge-preview job settled as a no-op on an account dataset: the task
returned early, and the materializer elected over int_std_records and read
person golden records. Now:

- er-golden: acct_scoped_masters_sql, the scoped election over
  acct_int_std_records and acct_golden_lineage (most_complete counts the
  account survivable columns), sharing one builder with the person election,
  whose SQL is byte-identical. Plan vectors for every policy x protect.
- entities: acct_golden_record/read/by_ids.
- preview_job: the election, the golden values and the mappable columns
  follow the config's entity type, for previews and upserts alike.
- The writeback and upsert policy APIs validate field_mapping keys against
  the golden columns of the policy's object (Account -> account columns).
- materialize_previews no longer refuses account datasets (VERSION 2).
- pg_merge_preview_acct_dag: an account dataset with a provenanced Account
  extract produces exactly the in-source pair's preview, from account goldens.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@athvin
athvin merged commit 0899cf9 into main Nov 27, 2026
44 checks passed
@athvin
athvin temporarily deployed to marketing-preview November 27, 2026 20:08 — with GitHub Actions Inactive

This branch was previously deployed

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

Merge previews for account datasets

2 participants