Documentation

Docs / Reference

ADR 0027 — Orval generated clients

Status: Accepted (developer review, 2026-10-19) Date: 2026-10-19

Context

The pinned React application imports generated Orval exports that are absent from its checkout. T012e's source inventory proves 27 request intents against 19 scanned OpenAPI operations. Names alone cannot establish these links.

Options considered

Decision

Read scanned Orval defineConfig projects through the shared TypeScript resolver and bounded evaluator. Require a local major-8 package declaration, supported scanned OpenAPI input, tags-split/react-query/fetch output, approved settings and a uniquely emitted mutator when configured. Scanned generated source takes precedence. Rebuild models and invocation proofs every link pass.

Run OpenAPI declaration extraction before client recognition, preserving its matching behavior. Count proven direct calls, generated hooks and query-options calls passed directly to proven TanStack scheduling APIs. Exclude URL/key functions and literal queryFn overrides. Wrong-file exports remain unmatched. Emit source client_call nodes and inferred calls_operation edges at 0.9. These edges are inferred because generated output is predicted from config and spec rather than scanned, and may be stale. The invocation's source span and hash establish provenance; generated file locations are predictions, never invented source declarations.

The B2 URL-object subset admits module-level or function-local single-identifier const bindings initialized by unshadowed new URL(input[, base]). Absolute http(s) input supplies its own origin and path; absolute-path input takes its origin from a literal base or leaves the host unknown. Other input stays dynamic. Unconditional top-level protocol/host/hostname/port assignments in the binding's own block, after its declaration and before the use, preserve the path. Only host assignment clears an unknown base host; hostname or port alone cannot. A host still unknown from the base makes the use dynamic. Serialization uses .toString() or .href, directly or through one local const. Literal dot segments, backslashes, whitespace, non-ASCII and invalid percent escapes, other prior references, escapes, other writes and conditional/loop assignments make the use dynamic. If any authority component was assigned, retain the path with origin null and origin_resolution unresolved. Such paths use only the exact tier at 0.7, never suffix matching. Unassigned literal origins retain the existing rules.

Prove mutator transport only when its first URL and second options parameters are plain identifiers and never reassigned. Require exactly one recognized global fetch site, excluding nested functions, reached through top-level statements consisting only of const declarations and the URL assignments above. Bind the URL parameter to the predicted generated URL, preserving dynamic parameter names and truncating query strings. Fetch init must be the options parameter itself or an object whose only spread is that parameter, first, with no own method key; this preserves the operation verb. Without a mutator, apply the existing global-fetch rules to the predicted URL. Proven paths use the unchanged client matcher. calls_route evidence includes the application call and mutator fetch spans; the inner fetch receives status wrapper when at least one Orval node uses it. Unproven transport retains the dynamic B1 path and calls_operation only. Wrong-file mismatch nodes have wrapper null and make no transport claim.

New-expression syntax for QueryClient proof, per-use URL-object guards and compact mutator transport prefixes survive replay under extractors-17. Existing clients, contracts, persistence and dependencies remain unchanged. One stat per configured output directory distinguishes absent output from excluded output. Existing ignore-source bytes supply diagnostic provenance; no generated files are read outside the scanned inventory.

Consequences

Metadata/spec edits relink unchanged callers. Ignored output diagnostics name the responsible rule source and retain the existing negation remedy; nonexistent directories have no ignore remedy. B1 alone retains dynamic paths while making the declared operation available.

Known gaps

Barrels and require do not establish predicted generated exports. Nonliteral options and spread options are not inspected for queryFn overrides. Only the explicit task subset of Orval configuration and version ranges is modeled. No general type checker, runtime execution or arbitrary transport inference is provided. Unknown base hosts, unsupported URL writes, escapes and dataflow outside the bounded subset remain dynamic.

Review notes (developer, 2026-10-19)

Report a problem with this pageSource: docs/adr/0027-orval-generated-clients.md