Skip to content

feat(api): typed response structs, batch 2 — orgs+datasets (#1192) - #1201

Merged
athvin merged 4 commits into
mainfrom
issue/1192-typed-orgs-datasets
Nov 24, 2026
Merged

athvin merged 4 commits into
mainfrom
issue/1192-typed-orgs-datasets

Conversation

@athvin

@athvin athvin commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Closes #1192

Part of #864 (batch 2 of 10: orgs+datasets).

🚧 Claimed by an agent session — 2026-11-24T00:30:28Z, session Claude Code:d1e3b2dc-3174-4091-9c30-c08fc4820306 on Mac.
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

Why

Proof

Risk & rollback

Post-merge ledger

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

Specific to this change

Context — plan, discoveries, measurements, files

Plan

Batch 2 of #864 (orgs+datasets), on the mechanism from #1190.

  • list_orgs → Vec<OrgItem>; get_org → OrgView (with OrgResources); create_org → OrgProvisioned | OrgCreated; list_datasets → Vec<DatasetView>; get/update_dataset → DatasetView; create_dataset → DatasetProvisioning (202) | DatasetCreated (201).
  • Derivation follows local response helpers (provision_org), accepts any registered Owner::from(…), and reads Json::<Vec<T>> as bare.
  • api-contract skill: typed responses and the key-order rule replace "responses remain envelope-level".

Discoveries

Every response union was published as {}, on main too. prepare_utoipa_schema gave an anyOf node a type: null placeholder, which utoipa read as an untyped object, dropping the variants. main's document contains zero anyOf. Fixed. Twelve existing write operations (records/*, tags/*/apply, assertions, unmerge, attempts/*/finish) now publish the envelope unions the derivation already computed. response_unions_survive_into_the_document pins it. Mutation: restoring the placeholder fails that test.

Field order follows the ledger, not the old bytes. The ledger records a record's keys in the json! literal's source order, while the old bytes were sorted. Structs declare literal order, so envelopes.json is unchanged. Bodies are value-equal (see #864's comment).

Measurements

  • make check: exit 0, 1,141 passed, 0 failed.
  • ER_TEST_PG_DSN=… cargo test -p er-server --test main: 142 passed, 0 failed, 2 ignored.
  • response_envelopes passes: envelopes.json byte-identical.
  • Operations with a $ref success schema: 8 → 15 of 119; operations whose schema changed vs main: 21 (9 typed here, 2 of them as anyOf of two refs; 12 envelope unions restored).

Files

bmoore813 and others added 3 commits November 23, 2026 16:36
Batch 2 of #864. list_orgs, get_org, create_org (both its provisioning and
plain bodies), list_datasets, create_dataset (202 and 201), get_dataset and
update_dataset return Serialize + ToSchema structs registered on ResponseDoc.
Each declares its fields in the order of the json! literal it replaced, which
is the order envelopes.json records, so the ledger is unchanged.

The derivation now follows local response helpers (provision_org) the way the
envelope collector does, accepts any registered owner in Owner::from(..), and
reads Json::<Vec<T>>(..) as a bare value.

Fixes a pre-existing loss: prepare_utoipa_schema gave an anyOf node a
type: null placeholder, which utoipa read as an untyped object, so every
response union was published as {}. Twelve existing write operations now
publish the envelope unions the derivation already computed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

This branch was previously deployed

1 inactive deployment
marketing-preview — 1076863f Deployed Nov 24, 2026 by athvin via remove closed PR previews #23
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 2: typed responses for orgs+datasets

2 participants