Repository navigation
Phase 3: shared wire-contract foundation (#898) - #938
Merged
neuromechanist merged 2 commits intoJul 6, 2026
Merged
neuromechanist merged 2 commits into
neuromechanist merged 2 commits into
Conversation
Epic #896 Phase 3 (#898). Foundation only; drift FIXES land in #899. - shared/contract/ (zero-dep-beyond-zod, extraction-ready for @nemar/contract): version.ts (canonical toVersionTag/versionTagSchema), user.ts (the {user, token} /users/me envelope), dataset.ts (catalog/detail/search + neuroschema- conformant dataset schema; NEUROSCHEMA_VERSION single source). - data-router.ts single-sources toVersionTag + NEUROSCHEMA_VERSION from the contract (re-exports toVersionTag so routes/data.ts is unaffected). - CLI request<T> gains an optional Zod schema param: validates the response and fails loud on drift instead of silently casting (the getCurrentUser class). - neuroschema conformance ENFORCED: vendored self-contained v0.3.0 bundle (build-vendor.mjs, 20 schemas) + ajv 2020-12 conformance test. - CI contract test (contract-live, TEST_API_URL-gated) validates live catalog/ detail/search/users-me against the Zod schemas; data-plane metadata against the neuroschema bundle (warn-only until #899 fixes drift). - Tests: contract-schemas (10), contract-neuroschema (5). ajv added as devdep.
- CRITICAL: searchHitSchema keyed on dataset_id, but /datasets/search aliases d.dataset_id AS id and has no latest_version -> would have failed integration-dev CI on any non-empty search. Rewrote to the real SearchResult shape (id required, nullable raw columns, score/snippet). Added fixture tests. - catalogItemSchema.id made optional (?mine=true branch omits the alias). - datasetDetailSchema overrides file_size/modalities/tasks/authors/license to nullable (detail query is raw d.*, no COALESCE, unlike the list query). - data-plane neuroschema live check is now fully warn-only (recording_modality can be [] pre-classification); #899 flips to hard-fail after the drift fix.
Contributor
Author
Review (sonnet) — findings addressed in b697a7a
|
neuromechanist
merged commit Jul 6, 2026
c37b543
into
feature/issue-896-epic-arch-hardening
1 check passed
This was referenced Sep 3, 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.
Summary
The flagship of #896: a single, enforced source of truth for the wire shapes the CLI, website, data plane, and third parties (EEGDash) exchange. Foundation only — the known drift fixes (getCurrentUser, file_size, latest_version, /datasets/:id parity) land in #899.
shared/contract/— zero-dependency-beyond-zod, no imports fromsrc//backend/, so it lifts verbatim into a standalone@nemar/contractpackage later (937 tracks that).version.ts(canonicaltoVersionTag/versionTagSchema— kills thelatest/latest_version+vv1.0.0split),user.ts(the{user, token}/users/meenvelope),dataset.ts(catalog/detail/search + a neuroschema-v0.3.0-conformant dataset schema;NEUROSCHEMA_VERSIONsingle-sourced).data-router.tssingle-sourcestoVersionTag+NEUROSCHEMA_VERSIONfrom the contract (re-exportstoVersionTagsoroutes/data.tsis untouched).request<T>gains an optional Zodschemaparam: validates the response and throws on drift instead of silently casting to a malformedT.build-vendor.mjs, 20 transitive schemas) + an ajv 2020-12 conformance test.contract-live, TEST_API_URL-gated): live catalog/detail/search/users-me validated against the Zod schemas; data-plane metadata against the neuroschema bundle (warn-only until Phase 4: Fix known contract drift — file_size (#895), getCurrentUser, /datasets/:id parity (#864) #899 fixes drift).Test plan
contract-schemas(10) +contract-neuroschema(5) pass;contract-liveskips without TEST_API_URL.tsc(root + backend) + Biome clean. Schemas are.passthrough()+ coercing, so they validate today's responses (green) while documenting the canonical shape.Part of epic #896. Foundation for #899.