The data contract, shared by the backend and the frontend (D-18).
schemas/object-card.schema.json: ObjectCard and the types it uses:Tag,ObjectType, the tagged values (rendering doc R3.1, R3.2)schemas/render-params.schema.json: RenderParams (R3.4),VisibleMode(D-23) andHapticProfile(R8.8). It refers to the card schema for the shared typesschemas/area-*.schema.json: the six Area search replies of A17.8 (issue #92, shape choices in Q-208); see Area search belowschemas/track-path.schema.json: the Track path replyGET /v1/objects/{id}/path(A19.5, A19.13; issue #74); see Track below
They are JSON Schema draft-07, the draft that both generators and both validators handle fully. schemas/ is the single source: never edit the generated code. After changing a schema, run one command per side and commit the result:
cd frontend && npm run contract:gen # writes src/contract/generated.ts
cd backend && uv run python -m scripts.generate_contract # writes app/contract/npm run contract:gen at the repo root does both, and npm run contract:check there compares both. CI runs npm run contract:check in frontend/ and uv run python -m scripts.generate_contract --check in backend/, and fails if the committed files differ.
Schema rules:
- Every contract object has
additionalProperties: false, so an unknown field fails validation. - JSON Schema has no generics, so the tagged value is written out once per payload (
TVNumber,TVString,TVRgb,TVVec3,TVPair). A backend test fails if their bodies stop matching. - The rules "
derivedneeds aformula" and "model_dependentneeds anassumption" areif/thenin the schema. They matchassertTagged(). The generated types cannot express them, so validate with a real validator (jsonschema,ajv), not only the Pydantic models. - Do not put a
descriptionnext to a$ref: draft-07 ignores it, andjson-schema-to-typescriptthen emits a duplicate type. - Give every definition a unique
title: both generators name types by title. A nullable field isanyOf: [{...}, {"type": "null"}], not a type array (ajv strict mode). UseminItemsonly where a tuple type is wanted (json-schema-to-typescriptturns it into one).
Everything in fixtures/ is synthetic, with one labelled exception below. The values are round placeholders, not results for any real object. Tests enforce the markers: a fixture: id, a name starting "Synthetic fixture", and a source starting "synthetic fixture" on every tagged value. A measured tag here only exercises the code path. Seeds are labelled fixture seeds (1–14) with generator_version fixture-0, not a hash, because the hash is not specified (Q-35).
fixtures/cards/<ObjectType>.jsonandfixtures/params/<ObjectType>.json: one ObjectCard and one RenderParams perObjectType(D-04).fixtures/textures/{id}/{generator_version}/{seed}/{albedo.webp,height.png,normal.png,height.bin}: the maps the textured params fixtures (asteroid_procedural,brown_dwarf,brown_dwarf_binary) point at, baked by the real backend baker (params_from_card→bake→encode) from the fixture card and seed, at 512×256 to keep the repo small. The directories are the baker's names (R6.7,texture_dir: the idfixture:brown_dwarfis the directoryfixture%3Abrown_dwarf); unlike the live backend there is no Q-47{width}x{height}/size directory, because the fixture URLs have none. Regenerate withcd backend && uv run python -m scripts.bake_fixturesafter a baker change;--check(andtests/test_bake_fixtures.py) fails if the committed bytes differ. The frontend fixtures server serves them at/data/textures/...(frontend/fixtures/handler.ts).- Eros (
asteroid_shape): the card keeps thefixture:id and the synthetic markers, but itsshape_sourceis the real Gaskell Eros model,/data/shapes/eros-gaskell.glb(backend/assets/shapes/, served in place by the fixtures server; the viewer takeseros-gaskell.lod1.glbon the low quality tier), and itsdiameter_km(16.84 ± 0.06 km, Yeomans et al. 2000),rot_period_h(5.27 h, LCDB, Warner et al. 2009),albedo(0.25 ± 0.06, Veverka et al. 2000) andspectral_class(S, SMASS) are the JPL SBDB values in the backend's recorded SBDB reply (backend/tests/fixtures/cache/v1/sbdb/, checked intests/test_api_card.py). Each suchsourcesays "real 433 Eros value" and cites it.gaia_rgb,spherex_rgb,phase_angle_degandsun_vectorstay synthetic.scale_mis 16.84 km × 500 = 8420 m, as the backend computes it. - Bennu (
asteroid_shape_bennu, issue #68 Part 8a): an extraasteroid_shapefixture beside Eros with real values only (SBDB diameter, spin, albedo and class, the registered SPOv54 mesh/data/shapes/bennu-spo-v54.glb; eachsourcestarts "synthetic fixture: real 101955 Bennu value, "). Its params arecard_to_paramsof the card, written bybackend/scripts/bake_fixtures.py. It is not an object type, so it has its own golden frames. - Backend-equal layers (issue #62): the
layersof the params fixtures are whatcard_to_paramsgives for the fixture card (tests/test_card_to_params.pycompares them): the gas giant's five layers (bands,flattening,colour,storms,turbulence, Q-115), the procedural asteroid'sdisplacementwithtextures.relief_amp0.03 (Q-117),limb_darkeningon the brown dwarfs (Q-116). The procedural asteroid'sdiameter_kmismeasured(as an SBDB value is), so Measured only draws a plain sphere of it. The gas giant'sdynamicsstay synthetic and are not the source of its layer tags. - Issue #68 additions (Q-150, Q-154): the
planet_watercard carries syntheticmass_mearth,orbit_au,orbital_period_dand the fourhost_*fields; thebrown_dwarf_binarycard carries a syntheticcomponent_teff_Kpair, and its params carrycomponentsand thecomponents/component_brightnesslayers exactly ascard_to_paramsgives them. Theellipsoidlayer ofasteroid_proceduralgainsassumed.c_axis. fixtures/invalid/cases.json: cases that must be rejected. Both sides run the same list, sojsonschemaandajvcannot disagree. Each case'sexpectnames the error it must give (path,keyword, optionaldetail), and the instance must have no other defect, so a case cannot pass for an unrelated reason.
Refusals covered:
| Fixture | Refused in missing |
|---|---|
planet_rocky |
teq_pulse: teq_K.value is null (D-12) |
asteroid_procedural |
spherex_ir: too few points in a channel window (R5.2) |
comet |
visible: no colour basis |
candidate |
mesh, visible: no 3D body (R7.6) |
candidate |
dynamics:spin_period_h: no body and no class, so no rung can answer (D-32) |
Tier and dynamics (D-32):
- Every
Layerhas a requiredtier(1 measured, 2 derived, 3 model_dependent, 4 inferred_from_analog, 5 artistic). The schema forces tier to agree withtag. Aderivedormodel_dependentlayer also needs a non-blankformula, and amodel_dependentlayer anassumedobject (at least one key, number or string values) naming the inputs that were not measured. Layers have novalue, soassertTaggeddoes not apply to them. - Every params fixture has a
dynamicsblock.speedupis required ({}when nothing moves), keys are one ofspin,spots,flares,winds,clouds,pulsation, values are above 0. Each rate is aDynamicsValue(value,tag,tier,source, andformula/assumedunder the same rules as a layer). Itssourcestarts "synthetic fixture". A rate with no rung is left out and listed asdynamics:<key>inmissing. Tests assert that everyspeedupkey has an animated rate present. The fixtures cover tiers 1 to 5. - Periods and lifetimes (
spin_period_h,spot_lifetime_d,pulsation_period_d) are above 0 andflare_rate_per_dis 0 or more (PositiveDynamicsValue,NonNegativeDynamicsValue);diff_rotationandjet_speed_msmay be negative. - A measured card value behind a rate wins at tier 1 with the same value (
rot_period_h→spin_period_h,period_var_d→pulsation_period_d), and only those card fields can make a rate tier 1 (tested in both suites). - Rate formulas in the fixtures start with "placeholder, not a spec rule": they only exercise tiers 2 and 3 and are not physics for stage 6 to copy.
assertTaggedchecks card values only: aDynamicsValueis skipped, because its model_dependent rule isassumed, notassumption.- The live backend (stage 7) emits
tier,formulaandassumedon layers but nodynamicsyet (stage 6, a later ticket); the field is optional.
Six schemas, one per JSON reply of A17.8 (A17.9, issue #92). Every gap the spec leaves is a choice recorded in Q-208 (Proposed, Moon).
| Schema | Endpoint | Root |
|---|---|---|
area-index.schema.json |
GET /v1/areas |
AreaIndex {areas[]}; also holds the shared definitions |
area-summary.schema.json |
GET /v1/areas/{area_id} |
AreaSummary {…index entry, frames[], coverage[], steps, method} |
area-known.schema.json |
/known |
AreaKnown {known[], skybot[]} |
area-dots.schema.json |
/dots |
AreaDots {visits[{visit, dots[]}]} |
area-tracks.schema.json |
/tracks |
AreaTracks {tracks[], skybot[]} |
area-checks.schema.json |
/checks (gated, Q-203) |
AreaChecks {test_mover?, completeness?, control?, linker?, method} |
- Every reply is an object with
cached_at,computed_at(ISO-8601 UTC ending inZ),missing(codes matchingAreaMissingCode, A17.8) andprovenance. RA is in [0, 360). The index's two times are null only when it lists no area. - Shared definitions live in
area-index.schema.json(AreaUtcTime,AreaRa,AreaDec,AreaRaDec, the id patterns,AreaMissingCode,AreaTag,AreaProvenanceEntry,AreaMethod,AreaBin,AreaSkybotAnswer,AreaErrorand the four enums). The other five refer to it, so the generated Python modules import only fromarea_index_schema.py. Every type is prefixedArea(the served frame isAreaSummaryFrame), so the Track contract and the pipeline's own names cannot collide; Track keeps its own definitions. - Provenance is a closed object per reply; each value is
{tag, source?, formula?, assumption?}under the card's rules (derivedneeds a non-blankformula,model_dependenta non-blankassumption). Tags aremeasured,derivedormodel_dependentonly (A16.5). The generated models drop these rules, so the API (P7) builds plain dicts and checks them withbackend/app/core/card/validate.py, not by serialising the models (Q-40). methodis{settings: {name: integer | number | string}, checks?};checksholds the seeds and bins of A17.6.- Errors are
AreaError {error, detail}: 404area_not_found, 404dot_not_found, 503stamp_unavailable. The TypeScript bundle names it through itsareaErrorroot key. - Enum lists for the UI come from the generator:
AREA_DOT_LABELS,AREA_VERDICTS,AREA_SED_LABELS,AREA_LINKERS(@/contract). - Checks per ticket (Q-208 (12)):
if/then/elserules onarea-checks.schema.jsondroptest_moverandcompletenessunderchecks:d4_not_run,controlunderchecks:d5_not_run, and every part and thelinkerunderchecks:not_run; otherwise each part and thelinkerare required. The generated models drop these rules (as they drop the provenance rules);method.checks(present when D4 or D5 ran) and the provenance keys (present with their part) are checked by the helper below.checks:not_runcovers only/checks:sed(D6) and the per-tracklinker(D7) are in/trackseither way. - Cross-reply rules (step counts, ids and their order, verdicts against
missingandskybot,unchecked_by,sed,method.checksand the checks provenance keys) are not expressible in a schema: they are functions inbackend/tests/area_consistency.py, which the pipeline (P3) and API (P7) tests can call on their own replies.
fixtures/area/ is synthetic and written by cd backend && uv run python -m scripts.area_fixtures (never by hand; --check fails if a committed byte differs, CI runs it). Markers, tested: ids fixture:…, frame ids fixture-…, data_release: "synthetic_fixture", designations "Synthetic fixture …", and every provenance source starting "synthetic fixture". The numbers in method.settings repeat the starting values of A17.2 to A17.13; nothing here is a pipeline setting to copy.
| Area | Folder | Content |
|---|---|---|
fixture:area-main |
fixtures/area/ |
2 visits × 4 exposures × detectors 1 and 4 (16 frames); visit 1 covers the west three quarters, visit 2 the whole square. 30 stars and 1 fixed source in every frame, 18 glitches, one static one-visit tracklet (4 mover dots in no track), and T1 found_blind (Synthetic fixture A1, object_id synthetic-mover, one OUTLIER dot), T2 unexplained, T3 unchecked (unchecked_by: ["horizons:Synthetic fixture A2"]), T4 possible / one_visit (4 dots on detector 4 in the strip only visit 2 covers, sed too_few). 570 dots. /known lists A1 and a comet C1 that is not detected (object_id null). /checks: a recovered test mover, a 4 × 4 grid of 50 per cell with Wilson intervals and no single figure, a control of 0 in 20, rate_grid:visits. One star dot is listed as stamp:<dot_id> |
fixture:area-multivisit |
fixtures/area/multivisit/ |
For D7: 4 visits × 2 exposures × detectors 2 and 3, 8 stars, 4 glitches, one unexplained track over 4 visits with linker: rate_grid; /known is empty; /checks answers missing: ["checks:not_run"] with no parts. The index lists it, so the UI must handle 2 or more visits |
index.json lists both; each area folder holds summary.json, known.json, dots.json, tracks.json, checks.json and a header-only export.ecsv stub (the real writer is P7, A17.7). The dev fixture server serves them at /v1/areas… (frontend/fixtures/areas.ts). Tests: backend/tests/test_area_contract.py, backend/tests/test_area_fixtures.py, frontend/src/contract/areaFixtures.test.ts, frontend/src/fixturesArea.test.ts, and the area cases in fixtures/invalid/cases.json.
Tests: backend/tests/test_contract_fixtures.py and frontend/src/contract/fixtures.test.ts. Open contract questions: Q-33 to Q-42 in decisions/contract.md, Q-64 in platform-hosting.md and Q-65 in rendering-bodies.md (index: decisions/README.md). The frontend's own M1 fixtures stay in frontend/fixtures/ (Q-30).
fixtures/track/eros-2026-03/path.json is the real /path reply for 433 Eros (A19.13; issue #74), the labelled exception to "everything is synthetic": the backend builds it offline from PR #53's recorded Horizons answers in backend/tests/fixtures/cache/ (20 to 21 Mar 2026, the fixture path settings of backend/scripts/fixture_settings.py, so a 60 min step, not production's 10 min). No Fixture badge. Write it with cd backend && uv run python -m scripts.track_fixtures; --check (and tests/test_track_path.py) fails if a committed byte differs. The synthetic mover of A19.13 (a refused frame, a deferred path, an extended source) is not built yet.