Repository navigation
Issue-224: Row schemas and the synthetic hunts fixture - #238
raghavburtony-creator wants to merge 2 commits into
Conversation
hunt-row.schema.json (A22.7.3) and hunt-rows.schema.json (A22.7.1) with generated backend and frontend types, and shared/fixtures/hunts/: a register of all ten hunts and one synthetic run (done, done with a coverage gap, failed, not covered, experimental, disabled) with every row status. Contract tests on both sides check validity, unique row ids per hunt, totals, provenance tags and claim words (A22.3.6). Shape choices are recorded as Q-530. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017Dj9JKE2PD2Q83yFMgMRYm
JoottunAtish
left a comment
There was a problem hiding this comment.
Good work overall. The schemas, the fixture and the tests are strong:
- every file is marked synthetic, and every id has the
fixture:prefix - the experimental hunt has recoveries only
- totals and RA order check out
- the generated code is in sync
A few fixes are needed, starting with a red CI.
Blocking
1. The frontend typecheck fails, so ci-gate is red. frontend/src/contract/huntFixtures.test.ts:7 imports HuntRegister, HuntRow and HuntRows from @/contract, but frontend/src/contract/index.ts does not export them. Add them to the exports in index.ts. (The "3,418 passed" in the PR body is the Vitest run, which does not typecheck.) The failed Playwright shard (build-view luma test) looks unrelated; re-run it.
2. Q-530 also appears in #239. This PR was opened first, so it keeps Q-530, and #239 will move to Q-531. Nothing to change here; just be aware that both PRs edit the Discovery hunts routing row in docs/README.md.
3. The fixture's refusal codes break A22.7.4. A22.7.4 says hunt:<id>:not_covered:<where> followed by a reason, for example hunt:variables:not_covered:square_29:no_visit_pair. The fixture uses hunt:<id>:not_covered:outside_footprint, with no <where> part. #239's parser would reject these codes. Fix them in:
shared/fixtures/hunts/cold_worlds/rows.json:22,103shared/fixtures/hunts/active_asteroids/rows.json:13,27
Please also tighten the HuntMissingCode pattern (hunt-row.schema.json:523) so the schema catches this.
4. The failed and not-covered row replies contradict A22.7.1. A22.7.1 serves rows only for a finished hunt and returns 409 hunt_not_done otherwise, and hunt-rows.schema.json:5 repeats that rule. But HuntState (:90), slow_movers/rows.json (failed) and active_asteroids/rows.json (not_covered) model a 200 reply. Q-530 point 8 states both rules without flagging the clash. Pick one:
- (a) Record in Q-530 that it amends A22.7.1 for these states, for Moon to confirm.
- (b) Keep the 409 and move those examples to the run-record fixture (HN-2).
Either is fine; it just can't be left silent (CLAUDE.md: "never pick silently").
5. Make the provenance tag required on HuntMatch (hunt-row.schema.json:638). A22.8.1 gives every match or non-match a tag: derived, or model_dependent for H4 (R-20). The project rule is a tag on every value. Every fixture match already has one, so this costs nothing. Update Q-530 point 3 to match.
Non-blocking
backend/tests/test_hunt_fixtures.py:106checks the wrong direction:set(REPLIES) <= set(by_id). Its comment says "every hunt of the register is in the run", buttransientsis missing from the run and nothing catches it (A22.7.6 asks for every hunt). Add a not-run reason for it or an explicit exemption.test_hunt_fixtures.py:119hardcodeshunt:dimmers:gate_not_passedinside a loop over all experimental hunts. Build the code fromhunt.- "
fetched_atis non-null unlesserror" (A22.8.2) is only checked in tests. Moving it into the schema's if/then would protect real hunts too. ruled_outrequires a failed check. A22.8.2 also allows "ruled out by a match", so say in Q-530 that this is expressed as a failed check.slow_moverslistsarchive:tessundercoverage.not_covered. A failed service counts as "not searched", not "not covered" (A22.3.6, A22.7.4). Keep it inmissingonly, or note the choice in Q-530.- The failed and not-covered replies carry
{keys:["rows"], tag:"measured"}but hold no values. Drop that entry, or allow an empty provenance list. - The backend copies
CLAIMSfromfrontend/src/test/claimWords.ts, so the two can drift. Use a shared JSON list, or add a test that compares them. huntFixtures.test.ts:toEqual(['done','failed','not_covered'])breaks as soon as a new state example is added. Use a superset check, as the backend does.dimmers/rows/P1.jsontitles a recovery "Known planet candidate", which blurs thecandidatestatus. Consider "Known planet host (TOI)".HuntCompleteness.banddoesn't enforce low ≤ value ≤ high.
Scope note
Serving these fixtures with the synthetic badge and the X-SX-Fixture: synthetic header (Q-32) is in the issue but not in this PR. The done-when boxes are met, so a follow-up ticket is fine; please say so in the PR body.
…s, required match tag) - Export the Hunt* types from the contract index (the ci-gate typecheck failure). - Refusal codes follow A22.7.4: hunt:<id>:not_covered:<where>:<reason>; the schema accepts only the eight kinds. - Match tag required; fetched_at is null exactly when the query failed. - Failed and not covered replies: Q-530 point 9 records the amendment of A22.7.1; slow_movers keeps archive:tess in missing only; empty provenance. - Tests: register coverage direction, code built from the hunt, claim-word drift, completeness band, not covered consistency. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017Dj9JKE2PD2Q83yFMgMRYm
Renumber the decision to Q-531 (#238 takes Q-530), word the hunt:disabled detail without the raw code, set <where> to "patch" for catalogue hunts, say where each placeholder comes from, and make the review's small doc and comment fixes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Q-531 states this form and the row schema of PR #238 requires it, but the builder and parser accepted any segment. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
JoottunAtish
left a comment
There was a problem hiding this comment.
Re-reviewed at c13b477. Everything from the last review is fixed, and CI is green. Approving.
What I checked:
frontend/src/contract/index.tsexports the hunt types, and the typecheck passes.- This PR keeps Q-530; #239 uses Q-531.
- The not-covered codes carry
<where>(square_<n>orpatch), and the newHuntNotCoveredCodepattern catches a missing one. Every fixture code parses under #239'scodes.py. - The 200-vs-409 conflict is recorded as Q-530 point 9, for Moon to confirm.
tagis required onHuntMatch.- All the non-blocking points are handled: the exemption for
transients, the code built fromhunt, the schema if/then onfetched_at, theruled_outnote,archive:tesskept inmissing, the empty provenance, the claim-words comparison test, the superset check, and the "Known planet host (TOI)" title. The completeness band is checked in tests only, which is fine because draft-07 can't compare two values.
Nits (non-blocking, fine as a follow-up)
- Q-530 point 8 clashes with point 9. Point 8 (
docs/decisions/discovery-hunts.md:135) still says the route serves rows only for a done hunt, while point 9 proposes a 200 with empty rows. Reword point 8 to defer to point 9. - Q-530 is missing from the header and routing lines. Add it to the topic-file header (
discovery-hunts.md:3,:5, where Q-530 is also not verbatim) and to the routing row indocs/README.md:110(still "Q-487 to Q-529"). #239 and #242 edit the same lines, so whichever merges later should combine all three. For the "Next free" line indocs/decisions/README.md, use the latest wording from the PRs. - Optional pointer in A22.7.1. Add a one-line "see Q-530 point 9" to A22.7.1 itself. Today only the A22.7.6 note mentions the proposed amendment.
- The PR body is out of date. The "A failed or not covered hunt serves no rows (A22.7.1)" sentence predates the Q-530 point 9 proposal, and the test counts are from before the fix. Please also open a follow-up ticket for serving these fixtures with the synthetic badge and the
X-SX-Fixture: syntheticheader (Q-32), and link it here. - The claim-words comparison test is brittle. It depends on the
pattern: /…/giliteral format inclaimWords.ts. It fails loudly if that changes, so that's acceptable; a comment would help.
Q-530 still needs Moon's confirmation, especially point 9.
Closes #224
What
shared/schemas/hunt-row.schema.json(one row, A22.7.3) andhunt-rows.schema.json(the list reply, A22.7.1), with generated Pydantic and TypeScript types.shared/fixtures/hunts/: the register of all ten hunts and one synthetic run: done, done with a coverage gap, experimental, failed, not covered, and a disabled hunt in the register. Every row status is covered by the hunts that are done.backend/tests/test_hunt_fixtures.py,frontend/src/contract/huntFixtures.test.ts): every fixture validates, row ids are unique per hunt and follow the letter rule, totals match the rows, each evidence tag matches its provenance entry, no claim words (A22.3.6, Test helper that fails on claim words in hunt text (A22.3.6) #201).shared/README.md, A22.7.6 status note, and Q-530 recording the shape choices the spec does not state.For the reviewer
provenanceas a list of{keys, tag, source}; status rules enforced by the schema; H7 has no row-id letter, so no rows yet.rows.votandrows.ecsv#227),run/scan-planextensions (HN-2), and serving these routes from the frontend fixtures server (X-SX-Fixture: synthetic).Tests
Backend 1,903 passed, frontend 3,418 passed;
contract:checkpasses on both sides.Generated by Claude Code