Skip to content

feat(api): classify local typed response envelopes (#863) - #1073

Merged
athvin merged 3 commits into
mainfrom
issue/863-typed-envelopes
Nov 9, 2026
Merged

athvin merged 3 commits into
mainfrom
issue/863-typed-envelopes

Conversation

@athvin

@athvin athvin commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Closes #863

🚧 Claimed by an agent session — 2026-11-09T22:55:32Z, session Codex:01a1be1b-0c92-7703-a4c2-25cb2c999baa on Mac-46.
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

Teach the shared success-envelope classifier to resolve local typed response constructors while retaining the existing JSON forms and committed ledger.

Why

Converting Json(json!({"jobs": jobs})) to Json(JobsResponse { jobs }) currently downgrades the ledger from wrapped to scalar. The classifier must retain the envelope before #864 converts handlers.

Proof

The two new classifier/adapter fixtures first failed on Scalar versus wrapped/jobs. All 16 library tests now pass; focused clippy passes with warnings denied. All five contract artifacts are byte-identical to base. Full make check passed on c51e0dd. Rebase onto CI-only main50de124e left rust/, entities/, frontend/ and Makefile byte-identical; all affected CI-speed, skills, bridge, script/workflow, PR-contract and static-credential gates passed on the refreshed tree. Fresh CI passed on85081931, including the real-service integration jobs; exact-head preflight confirmed every required context and all four detect jobs.

Risk & rollback

Source-derivation tooling only; no handler or runtime payload change. Supported constructors are plain local named structs; unsupported serialization attributes fail explicitly. Revert the merge commit to undo it.

Post-merge ledger

Closed by: Codex · session Codex:01a1be1b-0c92-7703-a4c2-25cb2c999baa on Mac-46 · 2026-11-09T23:52:56.257147+00:00 (one blocked item)

  • main is green with this change on it — deferred — Stabilize marketing audit and volume interaction tests #1074 owns the pre-existing frontend failure; this is not a claim that all main checks passed. Merge 9c16f988528effee9c8a9cb0c1927cea217009d5 has successful Rust 42719890932 (attempt2), infra42719891075 and devcontainer42719890947. The Rust job's first attempt stopped before testing at the 40GiB disk threshold; one failed-job retry passed unchanged. Frontend42719890729 repeats base50de's mobile Safari slider failure in unchanged marketing code. The 30-minute watch ended23:52:09Z with no additional failures.
  • images — 42719890770 succeeded for the exact merge SHA.
  • deploy — blocked — 42720333784 explicitly deployed9c16f988 to dev/prod, succeeded, and returned /readyz200. A process-emitted startup line for this image remains unverified: this session has no available AWS execution/log-query tool, and guarded CLI access was rejected. Earlier peer log evidence predates this SHA. Workflow readiness is not substituted for process proof.
  • the push-only surface no pull request can pre-test — images/deploy above succeeded; latest drift42637742835 and kind42575735163 succeeded. Frontend's known red is tracked by Stabilize marketing audit and volume interaction tests #1074, outside this source-classifier diff.
  • the board card — Envelope classifier learns typed response structs (blocker for the typed-response conversion) #863 closed2026-11-09T23:22:11Z and reads Done through automation; parent#857's T6 is ticked.
  • follow-ups — Stabilize marketing audit and volume interaction tests #1074 owns the unrelated marketing instability. Typed response structs across er-server handlers, by resource family (10 batches) #864 owns typed response payloads; this classifier change resolves keys only. No additional parser-completeness work is implied.
  • what was learned is written down — the API-contract skill records bounded local-constructor support, fail-closed unsupported local layouts and the unresolved-value/payload limits.
Context — plan, discoveries, measurements, files

Plan

  1. Add failing-first typed wrapper and record twins to the_classifier_reads_each_form, and an adapter fixture covering both the GET ledger and OpenAPI GET/write derivation.
  2. Inject enclosing source into classify_envelope; reuse struct_fields for local declarations, preserve declared serialization order, and reject unsupported local serialization representations instead of silently publishing wrong keys. Keep legacy unknown Json(value), JSON literal, page helper and Arrow behavior.
  3. Run focused classifier/adapter tests, then make check; require the real envelopes.json, MCP manifest and both OpenAPI snapshots to remain byte-identical. No handler conversion, entity change or generated artifact edit belongs here.
  4. Refresh from main and review: instrumentation, tier and reuse each found no candidates against BASE50de124e / HEAD85081931, with separate pure-derivation and adapter passes. No SQL changes; no verifier needed.
  5. Land on exact-head checks.
  6. Complete the post-merge ledger. feat(api): split internal and tenant-public OpenAPI contracts (#861) #1064 is complete; docs(api): reconcile the completed JSON-wire schema backlog (#862) #1070 watch continues.

Discoveries

Post-merge: Rust run 42719890932 failed before tests because a runner retained only 36 GiB after cleanup (40 GiB required); failed-job retry 1/2 completed successfully at attempt 2. Frontend run 42719890729 repeats the pre-existing mobile Safari slider failure tracked by peer-owned #1074. The unchanged frontend path failed on base50de as well. Deploy 42720333784 explicitly deployed merge9c16f988 in dev/prod; both completed and /readyz returned200. A process-emitted startup log for this image is still unverified; workflow readiness is not substituted for it.

Main baseline: frontend run42717888912 at50de124e failed the unchanged mobile-Safari volume interaction after a peer rerun. Peer-owned #1074 tracks that marketing test; it is outside this diff. Do not attribute it to the classifier or silently describe latest main as all green.

A quoted closing parenthesis reproduced a scalar misclassification. The typed constructor path now uses Rust token groups; the regression failed before that fix and passes after it.

The existing field parser ignores serialization attributes. The typed path rejects those rather than claiming Rust names are serialized keys. Write-response collection now propagates classifier failures even when another branch has a readable JSON response. Unknown variables and external constructors retain their prior scalar classification; empty named objects retain the empty JSON literal classification.

Measurements

Files

  • rust/crates/er-api-spec/src/envelopes.rs
  • rust/crates/er-api-spec/src/operations/responses.rs and adapter fixtures
  • API-contract skill notes if the supported source boundary needs recording

@athvin
athvin force-pushed the issue/863-typed-envelopes branch from c51e0dd to 8508193 Compare November 9, 2026 23:17
@athvin
athvin marked this pull request as ready for review November 9, 2026 23:18
@athvin
athvin merged commit 9c16f98 into main Nov 9, 2026
42 checks passed
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.

Envelope classifier learns typed response structs (blocker for the typed-response conversion)

2 participants