You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Validate catalog and detail responses against the shared contract outside tests #1207
`catalogItemSchema` and `datasetDetailSchema` in `shared/contract/dataset.ts` carry cross-field invariants via `superRefine` (for example `zarr_index_url` only when `zarr_status` is ready, and `zarr_verified_at` requiring a verify status), and `test/contract-schemas.test.ts` plus `backend/test/catalog-has-zarr.test.ts` exercise them thoroughly. But no route ever parses a live response with these schemas, so a production regression in a derive path (for instance a future write that sets `zarr_index_url` directly instead of deriving it) would ship data the contract calls invalid and only surface when a consumer's own parse throws.
Raised by the type-design review of #1206. It is a pre-existing architectural gap, not something the epic introduced, so it is filed rather than fixed there.
Proposed work
A response-validation hook for `GET /datasets` and `GET /datasets/:id` that parses with the shared schemas when `ENVIRONMENT` is `development` or `test` and logs (never fails) a violation in production.
A sampled production mode (for example one in N responses) if the parse cost matters at catalog page sizes.
A test proving a deliberately invalid row is caught by the hook in the dev environment.
Additional data point from the #1206 fix pass: the detail route serves SELECT d.*, so id arrives numeric while datasetDetailSchema declares a string. The new callback-to-detail round-trip test in the backend suite has to stringify id before parsing and names this issue in a comment. A response-validation hook would have caught it.
Activity
neuromechanist commentedon Sep 3, 2026
Additional data point from the #1206 fix pass: the detail route serves
SELECT d.*, soidarrives numeric whiledatasetDetailSchemadeclares a string. The new callback-to-detail round-trip test in the backend suite has to stringifyidbefore parsing and names this issue in a comment. A response-validation hook would have caught it.Fix detail-route contract false positives
Catalog: generic error details, contract check (#1224)
neuromechanist commentedon Sep 3, 2026
Fixed in #1224 (dev commit 082a1bd); ships with the next dev to main release.