Skip to content

feat(api): typed response structs, batch 4 — golden records+lineage (#1194) - #1205

Merged
athvin merged 4 commits into
mainfrom
issue/1194-typed-golden-lineage
Nov 24, 2026
Merged

athvin merged 4 commits into
mainfrom
issue/1194-typed-golden-lineage

Conversation

@athvin

@athvin athvin commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Closes #1194

Part of #864 (batch 4 of 10: golden records+lineage).

🚧 Claimed by an agent session — 2026-11-24T02:36:06Z, session Claude Code:d1e3b2dc-3174-4091-9c30-c08fc4820306 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

Batch 4 of #864 converts the golden-record detail, records-by-key, every per-record steward action (including unmatch), the JSON and CSV deliveries, and the entity links to typed structs. 16 more operations now publish a $ref success schema (29 → 45 of 119). The golden list stays an Arrow stream.

Why

OpenAPI is the customer integration contract (#857), and golden-record detail is the core result read.

Proof

  • make check: 1,152 passed, 0 failed.
  • er-server --tests against Postgres: 386 passed.
  • Frontend tsc --noEmit is clean against the regenerated schema.d.ts.
  • envelopes.json is unchanged.
  • The /docs mobile baseline was regenerated in the pinned image and came out byte-identical.

Risk & rollback

Bodies are value-equal to the old ones; only key order changes. One response changes in an impossible case: create_entity_link with an empty RETURNING is now a 500 naming that case, where it used to be a 201 with a null body. Rollback: git revert <merge-sha>.

Post-merge ledger

Closed by: agent · session Claude Code:d1e3b2dc-3174-4091-9c30-c08fc4820306 on Mac · 2026-11-24T16:07:59Z

Specific to this change

Context — plan, discoveries, measurements, files

Plan

  • Type read::entity_detail. PersonGolden and AccountGolden sit behind an untagged GoldenRow, which publishes as a oneOf. Alongside them: LineageItem (both lineage rows), EntityMember (the row plus protected/verified) and EntityEventItem. Each is spelled out through item_from_row!, an exhaustive destructure.
  • Envelopes: GoldenDetail, RecordsByKey, StagedRecords/StagedRecordsApplied, UnmatchStaged/UnmatchApplied, DeliveryAccepted, EntityLinkList, EntityLinkDeleted, and EntityLinkWire for create.
  • Value-equality tests: read.rs::typed_detail_tests (3), plus one more in response_shape_tests.

Discoveries

  • The lake by_id and by_entity rows are projections, not the entities. GoldenRecordWire carries assembled_at, created_at and updated_at, which the row lacks, so the registered entity wires cannot describe the detail. The items are spelled out.
  • dags/tasks.rs's write-back also reads entity_detail. It serializes the same typed parts, so its plan JSON is unchanged.
  • The envelopes field parser rejects a pub(crate) struct, so response structs stay private.
  • openapi::tests::upload_optional_body_and_delegated_write_are_described pinned the inline delivery_id property. It now follows the $ref.
  • RecordsByKey.items stays Value: its keys are the dataset entity type's standardized columns.

Measurements

Files

rust/crates/er-server/src/{read.rs,lib.rs,openapi.rs,dags/tasks.rs}, rust/crates/er-server/tests/acct_read.rs, frontend/src/lib/api/{openapi.json,openapi.public.json,schema.d.ts}

bmoore813 and others added 3 commits November 24, 2026 07:21
… entity links (#1194)

The golden-record detail, records-by-key, every per-record steward action
(suppress/protect/delete/verify and their retractions, unmatch), the
JSON and CSV deliveries, and the entity-link endpoints now return
Serialize + ToSchema structs: 16 more operations publish a $ref success
schema (29 -> 45). The golden list stays an Arrow stream.

entity_detail is typed first. PersonGolden/AccountGolden behind an
untagged GoldenRow (a oneOf), LineageItem, EntityMember (row + the
protected/verified flags) and EntityEventItem are spelled out with
exhaustive destructuring From impls (item_from_row!). The write-back
task serializes the same typed parts, so its plan JSON is unchanged.
RecordsByKey.items stays Value: its keys are the dataset entity type's
standardized columns.

create_entity_link used to serialize rows.first(), so an empty RETURNING
would have been a 201 with a null body. It is now a 500 naming the
impossible case.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
acct_read asserted on the Value entity_detail used to return. It now
serializes the GoldenDetail the endpoint serves and keeps the same
assertions. (The /docs mobile overview baseline was regenerated in the
pinned image for this branch and came out byte-identical, so it is
unchanged here.)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ef (#1194)

The test pinned the inline envelope ('properties.delivery_id') that the
untyped json! produced. Typing the delivery deliberately replaced it with
a reference, so the assertion follows the reference.

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

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

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

@athvin
athvin merged commit e38f286 into main Nov 24, 2026
46 checks passed
@athvin
athvin temporarily deployed to marketing-preview November 24, 2026 15:45 — with GitHub Actions Inactive

This branch was previously deployed

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

#864 batch 4: typed responses for golden records+lineage

2 participants