Skip to content

Issue-224: Row schemas and the synthetic hunts fixture - #238

Open
raghavburtony-creator wants to merge 2 commits into
devfrom
claude/confident-volta-qjs1nl
Open

raghavburtony-creator wants to merge 2 commits into
devfrom
claude/confident-volta-qjs1nl

Conversation

@raghavburtony-creator

Copy link
Copy Markdown
Collaborator

Closes #224

What

  • shared/schemas/hunt-row.schema.json (one row, A22.7.3) and hunt-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.
  • Contract tests on both sides (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).
  • Docs: shared/README.md, A22.7.6 status note, and Q-530 recording the shape choices the spec does not state.

For the reviewer

  • Shape choices to confirm (Q-530): tags limited to measured, derived and model_dependent; provenance as a list of {keys, tag, source}; status rules enforced by the schema; H7 has no row-id letter, so no rows yet.
  • A failed or not covered hunt serves no rows (A22.7.1), so "one of every status per hunt" holds only for done hunts.
  • Not in this PR: the sample bundle (Bundle table writers: rows.vot and rows.ecsv #227), run/scan-plan extensions (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:check passes on both sides.


Generated by Claude Code

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 JoottunAtish left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,103
  • shared/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:106 checks the wrong direction: set(REPLIES) <= set(by_id). Its comment says "every hunt of the register is in the run", but transients is 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:119 hardcodes hunt:dimmers:gate_not_passed inside a loop over all experimental hunts. Build the code from hunt.
  • "fetched_at is non-null unless error" (A22.8.2) is only checked in tests. Moving it into the schema's if/then would protect real hunts too.
  • ruled_out requires 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_movers lists archive:tess under coverage.not_covered. A failed service counts as "not searched", not "not covered" (A22.3.6, A22.7.4). Keep it in missing only, 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 CLAIMS from frontend/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.json titles a recovery "Known planet candidate", which blurs the candidate status. Consider "Known planet host (TOI)".
  • HuntCompleteness.band doesn'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
zakiyyah-osman added a commit that referenced this pull request Dec 1, 2026
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>
zakiyyah-osman added a commit that referenced this pull request Dec 1, 2026
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 JoottunAtish linked an issue Dec 1, 2026 that may be closed by this pull request
2 tasks

@JoottunAtish JoottunAtish left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed at c13b477. Everything from the last review is fixed, and CI is green. Approving.

What I checked:

  • frontend/src/contract/index.ts exports the hunt types, and the typecheck passes.
  • This PR keeps Q-530; #239 uses Q-531.
  • The not-covered codes carry <where> (square_<n> or patch), and the new HuntNotCoveredCode pattern catches a missing one. Every fixture code parses under #239's codes.py.
  • The 200-vs-409 conflict is recorded as Q-530 point 9, for Moon to confirm.
  • tag is required on HuntMatch.
  • All the non-blocking points are handled: the exemption for transients, the code built from hunt, the schema if/then on fetched_at, the ruled_out note, archive:tess kept in missing, 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)

  1. 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.
  2. 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 in docs/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 in docs/decisions/README.md, use the latest wording from the PRs.
  3. 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.
  4. 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: synthetic header (Q-32), and link it here.
  5. The claim-words comparison test is brittle. It depends on the pattern: /…/gi literal format in claimWords.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.

@raghavburtony-creator
raghavburtony-creator added this pull request to the merge queue Dec 2, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Row schemas and the synthetic hunts fixture

3 participants