Repository navigation
feat(api): typed query parameters (#865) - #1215
Merged
Merged
Conversation
All 27 Query<HashMap<String, String>> extractors are now one named
Deserialize struct per handler, and er-api-spec derives their fields as
documented in: query parameters (each field's /// doc is the
description; required only when neither Option nor serde(default)).
The internal document now lists 86 query parameters (75 public),
including cursors, limits and every filter. Before this, it listed none,
not even for the two structs that were already typed.
Behaviour is preserved by construction. Every new field is
Option<String>, and each params.get("k") became params.k.as_ref(), the
same Option<&String> type, so the handlers' lenient parsing is
untouched and a key missing from its struct fails to compile rather than
reading None. The two closures that took key names (duplicates, reviews)
now take values. audit_feed takes AuditIndexQuery, which the global feed
projects to (it has org; the org feed does not). golden_records_page
takes GoldenRecordsListQuery.
One stated change: a repeated key (?tag=a&tag=b), which the bag resolved
to the last value, is now a 400. No BFF route sends one to a converted
handler (repeated key= goes to /records, which reads the raw query;
repeated review_id is BFF-local).
A Query<HashMap…> now fails generation, so the untyped bag cannot return.
Tests: er-api-spec covers derivation and the refusal; query_param_tests
covers missing/unknown/empty/non-numeric for all 27 structs and pins the
duplicate-key change. The api-contract skill is updated.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
12 tasks done
Contributor
|
The marketing preview was removed because this PR is closed or merged. |
athvin
marked this pull request as ready for review
November 25, 2026 07:18
athvin
temporarily deployed
to
marketing-preview
November 25, 2026 07:23 — with
GitHub Actions
Inactive
This was referenced Nov 25, 2026
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 #865
What
All 27
Query<HashMap<String, String>>extractors become one named struct per handler, ander-api-specderives their fields as documentedin: queryparameters. The internal document now lists 86 query parameters (75 public): cursors, limits and every filter. It listed none before, not even the two structs that were already typed. AQuery<HashMap…>now fails generation.Why
#857 / #1013: an API with undocumented cursors and filters is not an integration contract.
Proof
make check: 1,164 passed, 0 failed.er-server --testsagainst Postgres: 396 passed.tsc --noEmitis clean against the regeneratedschema.d.ts.cursor,limit,max_probability,min_probability,reason,statuscursor,include_retracted,limitRisk & rollback
Behaviour is preserved by construction, with one stated exception: a repeated key (
?tag=a&tag=b), which the bag resolved to the last value, is now a 400. No BFF route sends one to a converted handler. Rollback:git revert <merge-sha>.Post-merge ledger
Closed by: agent · session
Claude Code:d1e3b2dc-3174-4091-9c30-c08fc4820306onMac· 2026-11-25T07:54:09Zmainis green with this change on it: merged948bdeb. The push runsrust45567704989 andfrontend45567705064, plusinfra,devcontainerandmarketing preview, all succeeded.imagesbuilt: run 45567705213, success.deployconverged: run 45568097512 succeeded withDEPLOY_SHA: d948bdeb…. 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 (d948bdeb) as an ancestor, and both pods logged"er-server listening","addr":"0.0.0.0:8000"at 08:11Z.driftandkindwere already red on schedule before feat(api): typed response structs, batch 3 — reviews+merges (#1193) #1202. The nightly golden-50k flake is scale golden (50k) fails deterministically on main since 03792063..ad38be23 (likely the DuckDB 2.0.1 bump) #1206.api-contractskill (the query-struct rule, why fields stayOption<String>, and the duplicate-key change).Specific to this change
Context — plan, discoveries, measurements, files
Plan
er-api-spec:Parametergains location, required and description.parameters()readsQuery<Struct>throughstruct_fields, which now captures///docs.Query<HashMap>is an error.openapi.rsrenders query parameters (ParameterIn::Query, required from the field, description from the doc).Option<String>.params.get("k")becomesparams.k.as_ref()(the sameOption<&String>), or.as_deref()where it was mapped to&str.query_param_testsfor missing, unknown, empty, non-numeric and duplicate keys across all 27.api-contractskill is updated.Discoveries
Option<String>on purpose. Typinglimitasi64would turn?limit=abc's silent fallback into a 400, which violates "no type changes". The doc text gives each parameter's real format instead.None. Two closures took key names (duplicates,reviews) and now take values.audit_feedbut differ byorg. The global feed projects toAuditIndexQuery, so the org feed doesn't document a parameter it ignores.key=goes to/records, which reads the raw query and is unconverted. Repeatedreview_id=is answered BFF-locally.Measurements
Files
rust/crates/er-api-spec/src/{manifest.rs,operations.rs,operations/requests.rs,operations/tests.rs},rust/crates/er-server/src/{lib.rs,openapi.rs},frontend/src/lib/api/{openapi.json,openapi.public.json,schema.d.ts},.claude/skills/api-contract/SKILL.md