Repository navigation
feat(api): typed response structs, batch 3 — reviews+merges (#1193) - #1202
Merged
Merged
Conversation
…1193) The review queue, review detail and merge group, merge plans, the labelling queue and labels, and every staged-correction response now return Serialize + ToSchema structs, so 14 more operations publish a $ref success schema (15 -> 29). The lake read layer is typed first: ReviewItem, UncertainPair and MergePlan replace the rows_to_values + with_confidence hop. They are spelled out rather than flattened from the generated PageRow/ByIdRow, whose names repeat across entity modules, and each From destructures its row exhaustively, so a new column fails to compile instead of leaving the wire. The optional apply_job key becomes two structs (StagedBatch/StagedBatchApplied), because the envelope classifier refuses serde attributes. Value equality against the old json!/Value builds is pinned in response_shape_tests and read.rs typed_item_tests; envelopes.json is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ed lake items (#1193) Co-Authored-By: Claude Opus 5.5 <[email protected]>
athvin
marked this pull request as ready for review
November 24, 2026 02:14
Contributor
|
The marketing preview was removed because this PR is closed or merged. |
…ce (#1193) The /docs page renders openapi.public.json's component schemas, and this branch adds 18. The page grows, so the mobile sticky header lands at a different offset inside the stitched element screenshot of #overview. Regenerated in mcr.microsoft.com/playwright:v1.63.0-jammy for this spec only. Co-Authored-By: Claude Opus 5.5 <[email protected]>
athvin
temporarily deployed
to
marketing-preview
November 24, 2026 02:35 — with
GitHub Actions
Inactive
This was referenced Nov 24, 2026
Merged
This was referenced Nov 25, 2026
Merged
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 #1193
Part of #864 (batch 3 of 10: reviews+merges).
What
Batch 3 of #864: the reviews, merges and labels handlers return typed structs. They are registered on
ResponseDoc, so 14 more operations publish a$refsuccess schema (15 → 29 of 119). The lake read layer is typed first (ReviewItem,UncertainPair,MergePlan).Why
OpenAPI is the customer integration contract (#857). An envelope-level
{}schema is no contract.Proof
make check: 1,148 passed, 0 failed. The first run hit a pre-existing macOS temp-path race in er-cli, filed as #1203.er-server --testsagainst Postgres: 382 passed. Frontendtsc --noEmitis clean against the regeneratedschema.d.ts.envelopes.jsonis unchanged.Risk & rollback
Bodies are value-equal to the
json!builds they replace, but key order changes (serde_json sortsjson!keys; a struct keeps declaration order). Rollback:git revert <merge-sha>.Post-merge ledger
Closed by: agent · session
Claude Code:d1e3b2dc-3174-4091-9c30-c08fc4820306onMac· 2026-11-24T15:13:15Zmainis green with this change on it: merge3d7b8c36. Therustpush run 45313537854 andfrontendrun 45345043149 are both success.imagesbuilt: run 45313537833, success.deployconverged: run 45313963369 succeeded withDEPLOY_SHA: 3d7b8c36…for dev and prod. Process proof, read 2026-11-25 after SSO was renewed: the live colour in dev (ci/web-api-blue) and prod (app/web-api-green) runser-api@sha256:e935e7e5…. ECR tags that digest8bd3c294(feat(api): self-service API keys — admin minting with a role ceiling, list, show-once UI (#866) #1216's merge), which contains this merge (3d7b8c36) as an ancestor, and both pods logged"er-server listening","addr":"0.0.0.0:8000"at 08:11Z.driftandkindwere already failing on the previous main SHA03792063(schedule). The nightlyrustscale golden (50k)job failed in dedupe-core golden tests, which this diff does not touch; it was intermittent on03792063too and is filed as scale golden (50k) fails deterministically on main since 03792063..ad38be23 (likely the DuckDB 2.0.1 bump) #1206.api-contractskill (conditional keys, write-handler constructors, typed lake items) and in memorytyped-responses-864.Specific to this change
Context — plan, discoveries, measurements, files
Plan
Batch 3 of #864. Handlers:
reviews_list,review_detail,review_merge_group,resolve_review,bulk_resolve_reviews,merge_group,merge_plans,unmerge_entity,create_label,labels_list,labeling_next.read::reviews_list,review_getandmerge_plansreturnVec<Value>/Option<Value>built from generated rows (er_entities::review::read::{PageRow, ByIdRow}, which already deriveSerialize + ToSchema), andwith_confidenceinserts a computedconfidencekey only whenmatch_probabilityis non-null.Item structs with flatten— replaced, see Discoveries. Item structs:ReviewItem { #[serde(flatten)] row: PageRow, #[serde(skip_serializing_if = "Option::is_none")] confidence: Option<String> }(and theByIdRowtwin). Flatten is allowed here becausestruct_fieldsonly parses the immediate envelope struct, not its items. Open question to probe first: how utoipa 5 renders a flattened generated row. Every entity module names its rowsPageRow/ByIdRow, so a$refby bare name would collide; it may need#[schema(inline)]or a renamed registration.ReviewPage { items, snapshot, next_cursor, unscored_hidden },MergeGroupPage { items, total, snapshot },MergePlans { items },LabelList { labels }, then the POST bodies.envelopes.jsonunchanged, Postgres suite,make check.Discoveries
Fromdestructure of the generated row. A new statement column then fails to compile instead of silently leaving the wire, and no collidingPageRow/ByIdRowname needs registering.serdeattributes on a response struct. So the optionalapply_job(json!plusresp["apply_job"] = …) is two structs,StagedBatchandStagedBatchApplied, one per observable form, and the schema is ananyOf.Json::<Name>(variable)on a write handler. The write path'sget_identrejects a turbofish path, andclassify_envelopehas no turbofish-record form. The handlers therefore construct at the call site, and theapi-contractskill now says so.staged_response, the staged-batch shape inmass_update, andcreate_assertion, whoseapply_nowbody would otherwise have mixed typed and untyped bodies. The ticket's batch boundary is not the helper boundary.ReviewItem.resolved_atandUncertainPair.scored_atare documented as plain strings, notdate-time.ser_duckdb_timestampemits naive lake text, not RFC 3339.Measurements
$refsuccess schema: 15 → 29. Counted withjqoverfrontend/src/lib/api/openapi.jsonbefore and after.response_shape_tests(2) andread.rs::typed_item_tests(5).Files
rust/crates/er-server/src/{read.rs,lib.rs,openapi.rs},frontend/src/lib/api/{openapi.json,openapi.public.json,schema.d.ts},.claude/skills/api-contract/SKILL.md