Skip to content

feat(api): type the 17 operations still publishing {} (#1213) - #1214

Merged
athvin merged 4 commits into
mainfrom
issue/1213-typed-empty-schemas
Nov 25, 2026
Merged

athvin merged 4 commits into
mainfrom
issue/1213-typed-empty-schemas

Conversation

@athvin

@athvin athvin commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Closes #1213
Closes #864

The last #864 batch: the 17 operations still publishing an empty {} success schema.

🚧 Claimed by an agent session — 2026-11-24T17:45:29Z, 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

This types the 17 operations that still published an unconstrained {} success schema. Every 2xx in the internal document now has a real schema or a recorded envelope shape: 98 typed, 20 envelope-level, 1 Arrow, 0 unconstrained (was 80 / 21 / 1 / 17). That meets #864's done-criterion, so this closes #864 too.

Covered: resolve, blocking-estimate, match-preview, models (compile, create, get, evaluation), profile, the two audit feeds, connections, recent imports, email, resources, and the internal attempt endpoints (work order, start, heartbeat, finish).

Why

OpenAPI is the customer integration contract (#857). resolve, models/*, profile and match-preview are on the documented workflow.

Proof

  • make check: 1,159 passed, 0 failed.
  • er-server --tests against Postgres: 393 passed.
  • Frontend tsc --noEmit is clean against the regenerated schema.d.ts.
  • Schema kinds counted with a script over openapi.json: 0 empty.
  • Mutation check: restoring get_ident in the write walk fails registered_response_types_become_component_references.

Risk & rollback

Bodies are value-equal to the old ones, with one deliberate exception. The internal attempt start, heartbeat and finish responses now serialize the task through TaskInstanceWire, so they no longer echo the attempt's token_hash. The runner never read those bodies (exec_task.rs checks the status only).

envelopes.json changes one internal line: the work order goes from bare to scalar. No BFF route reads it.

Rollback: git revert <merge-sha>.

Post-merge ledger

Closed by: agent · session Claude Code:d1e3b2dc-3174-4091-9c30-c08fc4820306 on Mac · 2026-11-25T07:13:10Z

Specific to this change

Context — plan, discoveries, measurements, files

Plan

  • er-cli: ResolveResult, ResolveCandidate, BlockingEstimate and its items derive ToSchema (new utoipa dependency, from the workspace) and are served directly.
  • Server views: MatchPreviewView/PreviewPairView; ModelSummary, ModelCompiled, ModelDetail, ModelEvaluation (LabelEvaluation, ConfusionMetrics, CurvePoint, EvaluationCounts); Profile (an untagged ProfileReport | ProfileNotYet); pg::AuditEntry; SalesforceConnectionItem; read::ImportReceipt; EmailAccepted; OrgResources::of; WorkOrder; AttemptRetried.
  • er-api-spec: the write-path walk accepts Json::<Name>(value).
  • The api-contract skill's turbofish rule is corrected.
  • Value-equality tests in response_shape_tests. The existing evaluation tests read the same values via to_value.

Discoveries

  • public_operations_are_a_complete_filtered_subset_of_internal derived operations against ApiDoc alone, while the document derives against ApiDoc plus ResponseDoc. attempt_finish is the first handler whose bodies span both, so the test reported a false mix. It now uses document_schemas().
  • A struct with #[serde(flatten)] can't be built at the Json(…) call, because the classifier refuses serde attributes there. It is bound to a variable and served by turbofish instead.
  • profile's 26-field column rows stay Value. They are the generated row with value-bearing fields redacted per role, and the reader deliberately avoids restating them.

Measurements

Files

rust/crates/er-api-spec/src/operations/{responses.rs,tests.rs}, rust/crates/er-cli/{Cargo.toml,src/lib.rs}, rust/crates/er-server/src/{lib.rs,read.rs,pg.rs,openapi.rs}, frontend/src/lib/api/{openapi.json,openapi.public.json,schema.d.ts,envelopes.json}, .claude/skills/api-contract/SKILL.md

Every 2xx in the internal document now carries a real schema or a
recorded envelope shape: 98 typed, 20 envelope-level, 1 Arrow stream, 0
unconstrained (from 80 / 21 / 1 / 17).

- resolve, blocking-estimate: er-cli's ResolveResult/BlockingEstimate
  (and their items) derive ToSchema and are served directly instead of
  through serde_json::to_value.
- match-preview: MatchPreviewView/PreviewPairView.
- models: ModelSummary (was model_summary's json!), ModelCompiled and
  ModelDetail (flattened summary), and the evaluation as LabelEvaluation/
  ConfusionMetrics/CurvePoint/EvaluationCounts under ModelEvaluation.
  The existing evaluation tests read the same values via to_value.
- profile: an untagged Profile of ProfileReport | ProfileNotYet, with
  typed findings and candidate keys. The 26-field column rows stay Value
  because they are redacted per role.
- audit feeds: pg::AuditEntry. connections: SalesforceConnectionItem.
  recent imports: read::ImportReceipt. email: EmailAccepted {}.
  resources: OrgResources::of.
- internal attempts: WorkOrder, and start/heartbeat/finish serialize the
  task through TaskInstanceWire, so these responses no longer echo the
  attempt's token_hash. The runner never read those bodies (exec_task.rs).

er-api-spec: the write-path response walk accepts a one-segment turbofish,
Json::<Name>(value) (a POST resolve/compile names its body that way).
Pinned in operations/tests.rs, and mutation-checked by restoring
get_ident.

The api-contract skill's turbofish rule is corrected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
bmoore813 and others added 2 commits November 24, 2026 10:07
…schema set (#1213)

public_operations_are_a_complete_filtered_subset_of_internal passed only
ApiDoc's entity schemas to er_api_spec::operations, while add_operations
derives against ApiDoc merged with ResponseDoc. attempt_finish is the
first handler whose bodies span both (TaskInstanceWire and
AttemptRetried), so against the narrower set its envelope looked
untyped and the walk reported a mix. document_schemas() is the set the
emitted document actually uses; registered_schemas() stays ApiDoc-only
for the two entity guards that need exactly that.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
GET /v1/internal/attempts/{attempt_id} returned Json(json!(order)),
which the envelope ledger reads as a bare value. It now returns
Json::<WorkOrder>(order), which reads as an unresolved scalar, the same
way a typed GET over a variable always has. The body is unchanged. The
route is internal, called only by the remote runner (exec_task.rs, which
reads it as untyped JSON), and no BFF route or mock fixture reads it:
the one frontend mention is bff-authz-gate.test.ts asserting the BFF
never calls it. Regenerated with the test's own --ignored regenerate.

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

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

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

@athvin
athvin merged commit 9b5ffc9 into main Nov 25, 2026
50 checks passed
@athvin
athvin temporarily deployed to marketing-preview November 25, 2026 06:57 — with GitHub Actions Inactive

This branch was previously deployed

1 inactive deployment
marketing-preview — ce8398d7 Deployed Nov 25, 2026 by athvin via remove closed PR previews #32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants