Skip to content

feat(api): derive OpenAPI operations and bearer security (#860) - #1063

Merged
athvin merged 3 commits into
mainfrom
issue/860-openapi-paths
Nov 9, 2026
Merged

athvin merged 3 commits into
mainfrom
issue/860-openapi-paths

Conversation

@athvin

@athvin athvin commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Closes #860

🚧 Claimed by an agent session — 2026-11-09T20:44:25Z, 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

Generate source-derived OpenAPI operations, request bodies, response envelopes and bearer authorization requirements; regenerate the document and TypeScript paths.

Why

The existing document contains component schemas but no callable operations. #860 connects the shared derivation to the contract generator.

Proof

The new route-floor test was observed failing against the original empty paths. The implementation emits 93 paths/109 operations; 11 pure-library fixtures and all 13 OpenAPI assertions pass, including agreement with all six committed envelope classes. TypeScript generation succeeds. A deliberate empty-operation mutation made four library fixtures and all four new server contract gates fail; restoring the implementation returned the suites to green. make frontend passed (922 unit/component tests, production build, 662 browser passes/133 expected skips). The first CI run passed every test/integration job and the frontend/supply-chain gates; its only failure was a semicolon Clippy rule, now fixed locally. Full make check passed with that fix (exit 0). The final working tree was committed as 2b364344 and refreshed against unchanged main 8453c27d; six independent house review passes found no candidates (library and server/artifact passes, each for instrumentation, execution tier and reuse). No candidate required verification. All 15 live required contexts were success/skipped on final head 2b364344, with successful detection jobs in all four gated workflows. Preflight confirmed CLEAN/non-draft, unchanged main and no merge-bus race before squash merge.

Risk & rollback

Derivation intentionally supports the source shapes exercised by this router and fails on unsupported inputs. Responses remain at envelope granularity, with typed payloads and query parameters owned by later epic tickets. No handler behavior or component schema changes; revert this commit and its generated artifacts to restore the previous schema-only document.

Post-merge ledger

Closed by: Codex · session 01a1be1b-0c92-7703-a4c2-25cb2c999baa on Mac-46 · 2026-11-09T22:03:57Z

Specific to this change

  • Local make check and make frontend passed; six independent house-review passes found no candidates. Exact-head CI passed before merge, with all four detect jobs successful. Negative operation-derivation probes were observed failing and restored; details remain in Context.
Context — plan, discoveries, measurements, files

Plan

  1. Audit every routed non-internal method against handler documentation and success construction. Extend the pure derivation only where needed for shared response helpers, optional JSON and multipart inputs; reject unsupported source shapes instead of silently omitting an operation.
  2. Build utoipa paths/operations from the shared router walk, using actual handler source for summaries, roles, parameters and input schemas. Preserve generated entity-wire references; describe responses at envelope granularity and the detail error contract. Public health routes remain unauthenticated.
  3. Register the HTTP bearer scheme and derive per-operation role requirements. OpenAPI 3.1 explicitly permits role names for non-OAuth security requirements; keep the actual operator-token versus tenant-key distinction in the scheme description.
  4. Add coverage/floor and class fixtures, helper/unsupported-input cases and generated-TypeScript checks. Observe new gates failing before implementing/regenerating, then run focused checks, make check, pnpm gen:api and the applicable frontend gate.
  5. Update the API-contract skill, independently review the diff, refresh from main, and land through exact-head CI and the post-merge ledger.

Discoveries

A webhook-deletion doc comment was attached to the unrelated TagIn struct; it has been moved to its actual handler. Request derivation preserves serde defaults, nullable options and deny_unknown_fields, resolves the mail module from caller-supplied source, and rejects unsupported extractors/types. Numeric model-version path parameters come from the Path tuple signature. Write envelopes follow returned expressions and local response helpers, so an unrelated Json local cannot become the response contract.

The current router exposes 109 non-internal method/path operations across more than 80 paths. Several write handlers delegate their final response to shared local helpers, the upload takes Multipart, and clear-task accepts an optional JSON body. The current GET envelope ledger intentionally cannot distinguish the payload type of bare values; this change must retain that honest granularity. Query parameters and typed response expansion remain owned by later epic children.

Security-role reference: https://spec.openapis.org/oas/v3.1.0.html#security-requirement-object (section 4.8.30.1).

Review

Reviewed BASE 8453c27debfd5b1b1a44ff86503662673d6de23a → HEAD 2b364344d0268675e67f8f60c8a368907d3d7f2b in six fresh-context, read-only passes. All reported no candidates. The library and server/artifact passes checked instrumentation consumers, execution placement, and shared-helper invariants. They declined generic parser bug hunting, gate-owned lint/test matters and the explicitly deferred typed-response/query expansion. No SQL changes required a SQL pass. No review comments were posted.

Measurements

Files

@athvin
athvin marked this pull request as ready for review November 9, 2026 21:23
@athvin
athvin merged commit a367529 into main Nov 9, 2026
45 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.

Emit OpenAPI paths from the handler derivation + bearer securityScheme

2 participants