Skip to content

feat(api): lineage export — every source record to its entity (#1231) - #1242

Merged
athvin merged 2 commits into
mainfrom
issue/1231-lineage-export
Nov 25, 2026
Merged

athvin merged 2 commits into
mainfrom
issue/1231-lineage-export

Conversation

@athvin

@athvin athvin commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Closes #1231

🚧 Claimed by an agent session — 2026-11-25T19:25:20Z, session Claude Code:d1e3b2dc-3174-4091-9c30-c08fc4820306 on Mac.
The claim is this open draft PR: closing it releases the claim.

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

What

A third export kind, lineage: one row per source record, giving record_key, source_system, source_record_id, and the entity_id it resolved to, at the export's pinned snapshot. As CSV (RFC 4180 quoting, because a customer's source id is arbitrary text) or JSONL.

  • A new declared statement, entity_membership/read/lineage_page, is a keyset page on record_key at a snapshot. It plans and passes the E0xx rules. er.statement's bound moves to 281.
  • The join is documented on the request's kind field: lineage entity_id = golden id, at the same snapshot.

Why

#1231, part of #521. Golden records and duplicate groups name entities, and a customer's systems hold their own keys. Lineage is the bridge, with no Salesforce in the path.

Proof

make check: 1,190 passed, 0 failed. er-server + er-cli --tests against Postgres with DEDUPE_E2E_DUCKLAKE=1: 498 passed. make frontend: 963 passed, 1 failed (triage.spec.ts:53, the mobile-safari swipe spec). This PR changes no file under frontend/, so that is not this diff; the required Playwright tier is the judge.

export_write.rs gains case 6, over the file-ingested account fixture (CSV deliveries, no Salesforce), with a page size of 2 so the keyset crosses pages:

  • the lineage CSV header;
  • every source record exactly once: the seven (source_system, source_record_id) pairs equal the fixture files' ids;
  • the lineage's entities are exactly the golden export's four;
  • JSONL gives the same seven.
Mutation Caught by
the keyset resumes from the page's first key, not its last (overlapping pages) export_write: more than seven rows
(csv_field unit) quoting only when a comma, a quote or a line break needs it

Risk & rollback

Additive: one declared read and one export kind. Rollback: git revert <merge-sha>.

Post-merge ledger

Closed by: agent · session Claude Code:d1e3b2dc-3174-4091-9c30-c08fc4820306 on Mac · 2026-11-25T20:01:10Z

Specific to this change

Context — plan, discoveries, measurements, files

Plan

Discoveries

Measurements

Files

…d to (#1231)

A declared keyset read (entity_membership/read/lineage_page) and a third
export kind, CSV (RFC 4180 quoting) or JSONL. export_write.rs proves the
customer's join on a file-ingested dataset: every source record exactly
once, and the lineage's entities are exactly the golden export's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@athvin
athvin marked this pull request as ready for review November 25, 2026 19:49
@athvin
athvin merged commit e5486f1 into main Nov 25, 2026
46 checks passed
@athvin
athvin temporarily deployed to marketing-preview November 25, 2026 19:50 — with GitHub Actions Inactive

This branch was previously deployed

1 inactive deployment
marketing-preview — 6a42eb34 Deployed Nov 25, 2026 by athvin via remove closed PR previews #57
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.

E11.4 — Lineage: join results to the customer's own source keys

2 participants