Repository navigation
feat(api): typed response structs, batch 2 — orgs+datasets (#1192) - #1201
Merged
Merged
Conversation
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]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
athvin
marked this pull request as ready for review
November 24, 2026 00:40
Contributor
|
The marketing preview was removed because this PR is closed or merged. |
athvin
temporarily deployed
to
marketing-preview
November 24, 2026 00:47 — with
GitHub Actions
Inactive
This was referenced Nov 24, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1192
Part of #864 (batch 2 of 10: orgs+datasets).
What
Why
Proof
Risk & rollback
Post-merge ledger
Closed by: agent · session
Claude Code:d1e3b2dc-3174-4091-9c30-c08fc4820306onMac· 2026-11-24T00:55:55Zmainis green with this change on it — the merge SHA, and the runthat proves it. A later head SHA with this commit as an ancestor counts;
a cancelled run with zero jobs does not: merge
807a1992; rust45299979369, frontend45299979425, infra45299979600, devcontainer45299979359all success.imagesbuilt, or correctly never ran because nothing that goes intoan image changed:
images45299979368success.deployconverged — proved by a line the running process emitted, notby the image digest and not by the workflow conclusion: deploy
45300319857namesDEPLOY_SHA 807a1992. devci/web-api-greenand prodapp/web-api-bluerun theer-apiimage ECR-tagged807a1992, and theirer-serveremitted"er-server listening"at 00:51:08Z (dev) and 00:50:52Z (prod).deploy,drift,kind's nightly leg) is green, or knowingly red for a reason that is notthis change: deploy, infra and devcontainer green on the merge SHA.
Donethrough the automation rather than byhand, and the issue closed: #864 batch 2: typed responses for orgs+datasets #1192 closed by this PR; parent Typed response structs across er-server handlers, by resource family (10 batches) #864 stays open for #864 batch 3: typed responses for reviews+merges #1193–#864 batch 10: typed responses for steward actions+assertions #1200.
(a skill, a reference, memory) — or nothing new was learned: the
api-contractskill (SKILL.md and schema-registration-decisions.md) now describes typed responses, the helper rule,ResponseDocand the key-order rule.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(withOrgResources);create_org→OrgProvisioned|OrgCreated;list_datasets→Vec<DatasetView>;get/update_dataset→DatasetView;create_dataset→DatasetProvisioning(202) |DatasetCreated(201).provision_org), accepts any registeredOwner::from(…), and readsJson::<Vec<T>>as bare.api-contractskill: typed responses and the key-order rule replace "responses remain envelope-level".Discoveries
Every response union was published as
{}, onmaintoo.prepare_utoipa_schemagave ananyOfnode atype: nullplaceholder, which utoipa read as an untyped object, dropping the variants.main's document contains zeroanyOf. 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_documentpins 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, soenvelopes.jsonis 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_envelopespasses:envelopes.jsonbyte-identical.$refsuccess schema: 8 → 15 of 119; operations whose schema changed vsmain: 21 (9 typed here, 2 of them asanyOfof two refs; 12 envelope unions restored).Files