Repository navigation
Issue-221: Hunt register and GET /v1/hunts - #234
Conversation
Add hunt-register.schema.json, the static register of the ten hunts of A22.2 and the endpoint that serves it, checked against the schema. Only asteroids is available. Values the spec does not state are recorded as Q-529, with the new reason code hunt:<id>:not_built. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
JoottunAtish
left a comment
There was a problem hiding this comment.
The register, endpoint, schema and tests look solid. CI is green, the contract check passes, and Q-529 doesn't collide with any other ID. One contract fix is needed before merge.
Blocking
Hunts that are not built claim a level that requires merged code. These are in backend/app/core/hunts/register.py (L188-282), and the schema's level enum (shared/schemas/hunt-register.schema.json L752-755) has no other option.
Nine of the ten hunts are disabled with hunt:<id>:not_built (or needs_release), but they still carry a real level:
experimental: variables, cold_worlds, runaways, dimmers, active_asteroids, slow_moverscharacterisation: ir_excesscontext: transients, dark_companions
A22.10.1 makes each level a requirement. Experimental needs "the code is merged and its known-object match works", Characterisation needs the measurement's own check, and Context needs "the adapter works". A hunt that is not built is Off ("not in the picker, or disabled with a reason").
The picker (A22.3.2, #225) groups rows by level taken from the register. As things stand, it would list six unbuilt hunts under Experimental, whose copy says they "run and return recoveries of known objects only". It would also list H9 under Characterisation, the group that is ticked by default.
off is already in the spec: A22.4.1's Hunt protocol has level: Literal["off", "experimental", "validated", "characterisation", "context"]. Only the A22.7.1 reply shape leaves it out. Q-529 item 6 notes this gap but settles it the other way.
Fix:
- Add
"off"to thelevelenum in the schema and regenerate both contract files. - Give every unbuilt hunt
level: "off". - Update
EXPECTEDinbackend/tests/test_hunt_register.py(L392-403). Optionally, add a test that a disablednot_builtentry always has leveloff. - Reword Q-529 to follow A22.4.1 and A22.10.1, and record the A22.7.1 vs A22.4.1 conflict there.
Non-blocking
- asteroids text (
register.pyL208-218): the summary and title mention spectra and precovery, which aren't built yet (HN-5, HN-11). Please reword this before #225 shows it. Also check that the H4 spectra check against Gaia DR3 is merged; A22.10.1 needs it forcharacterisation. weight: H2 and H9 are markedlight, but their pixel stages are heavy (A22.4.2). HN-1 lane scheduling shouldn't rely on this field alone; consider a per-stage weight orheavy.- Generated
HuntAvailability: it doesn't encode the schema's if/then/else onreason. That's expected from the generator, andcheck()covers it. - Reason strings: they are written by hand. As noted in the PR, they should move to #222's builder.
- VSX route: its wording is still [verify] in A22.9.1, and
verified_at2026-11-18 just repeats the A22.7.3 example. docs/decisions/discovery-hunts.md: consider giving the hunt-register entry its own heading, so later entries that aren't A22.15 rows have a home.
Docs
- A4.11 (
docs/architecture/endpoints.md): add a row forGET /v1/hunts(built, #221,backend/app/api/hunts.py, A22.7.1, Q-529). - A4.12 (
docs/architecture/refusals.md): add a pointer to thehunt:namespace in A22.7.4, including the newhunt:<id>:not_built. - A22.7.1: once the blocking fix is in, add
offto the reply shape.
A22.10.1 lets only merged code claim a level, so every disabled hunt is now off. Add off to the schema's level enum and A22.7.1, record the conflict with A22.4.1 in Q-529, and add GET /v1/hunts to A4.11 and the hunt: codes to A4.12. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Shorten the asteroids title and summary to Discovery as built, give Q-529 its own heading and record that weight cannot describe the pixel stages of H2 and H9. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Fixed the blocker: every unbuilt hunt is now Non-blocking: reworded the One question: I found no Gaia DR3 spectra check in |
|
@MintHerbs details on the CI failure, since you're looking into it. Playwright shard 1/4 failed once on Test: |
MintHerbs
left a comment
There was a problem hiding this comment.
Review: approve with nits
Thanks, this is a clean, well-scoped PR. It stays inside #221 (backend and contract only, no UI), the "Please check" list made the open points easy to review, and the PR body is accurate.
What I checked
- Tests:
tests/test_hunt_register.pyandtests/test_contract_fixtures.pypass offline (SX_OFFLINE=1): 242 passed. I did not rerun the full suite, ruff, mypy or the frontend tests; I'm relying on your local results for those. - Contract (D-18):
node scripts/generate-contract.js --checkreportssrc/contract/generated.tsmatchesshared/schemas/. - Live endpoint: I ran the branch locally.
GET /v1/huntsreturns 200 with all 10 hunts, in A22.2 table order. Onlyasteroidsis available; the other nine are disabled with a reason. - Schema (A22.7.1):
- The array root matches the spec.
additionalProperties: falseis set on every object.calibrationis an object ornull.- The
availabilityif/then/else is correct draft-07:reasonis required when the hunt isdisabledand rejected when it isavailable. - The reason pattern accepts
hunt:dark_companions:needs_release:gaia_dr4.
- Q-40:
backend/app/api/hunts.pychecks the body against the schema before sending it. - Enums (A22.4.1):
kind,levelandweightmatch. Addingoffto A22.7.1 is the right call: A22.4.1 and A22.10.1 both have it, so A22.7.1 was the outlier. - Decisions bookkeeping:
- Q-529 is free on
dev. - The next free id moves to Q-530.
- The index row and the
docs/README.mdrouting range are updated. - "Open (built)" is the right status.
- The
Q-523reference in theendpoints.mdrow is correct (PD-11 Contract).
- Q-529 is free on
- Existing test change: listing the schema in
ALIAS_SCHEMASintest_contract_fixtures.pyis justified, because the generated type for an array root is an alias, not a model. - Docs: in sync. That covers the A22 status line, A22.7.1, A22.7.4, A4.11,
refusals.mdandshared/README.md. No UML is needed yet: A22 already lists the hunt diagrams as still to do, and HN-1 can add/v1/huntsto the component diagram.
Nits (non-blocking)
- No test for the refuse-to-serve path. Nothing checks what happens when the register fails validation. A small test that monkeypatches
register()to return a bad entry (for example a disabled hunt withoutreason) and expects a 5xx would pin the Q-40 behaviour. A follow-up is fine. - Hand-written reason strings.
register.pybuilds thehunt:<id>:...strings by hand. You already flagged that #222's builder should take them over. Please make sure #222 picks upnot_builtas well as the A22.7.4 codes. - Q-529 readability. The entry is one very long table cell. Consider splitting the ten points into a numbered list under the table in a later docs pass, so each one can be answered on its own.
"Please check" (Q-529)
Accepted as written:
- 1, the new
hunt:<id>:not_builtcode - 2,
level: offfor unbuilt hunts - 4,
asteroidsat1.0.0 - 7,
weight: lightfor H7 and H10, andkind: searchfor H2 - 8, VSX as the only route. Listing a route only where the spec gives a URL is the honest choice. Keep the VSX wording marked [verify], and add no H2 or H8 routes until their URLs are verified.
- 9, the summaries
- 10, short release names
Still open, to settle in Q-529 before the picker (#225) and HN-1 read these fields. They don't block this merge:
- 3, the
asteroidslevel. A22.10.1 requires the measurement's own check forcharacterisation, and the Gaia DR3 spectra check doesn't exist yet. Either move H4 toexperimentaluntil it lands, or keepcharacterisationand record it in Q-529 as a deliberate exception. - 5, the title and summary. "Known rocks", describing only what runs today, is the right direction. We'll confirm the final wording when #225 builds the picker.
- 6,
weightfor H2 and H9.lightdescribes only their catalogue stage; their pixel stages are heavy (A22.4.2). Either makeweightthe heaviest stage, or document in A22.4.1 that it is the catalogue stage, so HN-1 doesn't schedule lanes from this field alone.
Kevin, as owner of core/hunts/, please weigh in on 3 and 6.
Approving. Nice work.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Thanks @MintHerbs. I've addressed the nits in
The |
JoottunAtish
left a comment
There was a problem hiding this comment.
Approved with nits. Re-reviewed at a2eccda. All four blockers from my earlier review are fixed:
offis in thelevelenum, the schema, and the regenerated types on both sides.- Every unbuilt hunt is
off, H10 included. EXPECTEDis updated, with a disabled-implies-off test.- Q-529 records the A22.7.1 vs A22.4.1 conflict.
The A4.11 and A4.12 doc fixes are in. The refuse-to-serve test was added, and Q-529 is a numbered list. CI is green.
Nits (non-blocking):
- H4 is still
characterisation(register.py:84), but its Gaia DR3 spectra check isn't built yet (A22.10.1). It's recorded openly as Q-529 point 3. Settle it before #225 readslevel: either move H4 toexperimentalor state it as an exception. - #222 should pick up
hunt:<id>:not_builtand replace the hand-built reason strings inregister.py. Add a line to #222's scope. - A22.7.2 (
docs/architecture/discovery-hunts.md~407) still lists the levels withoutoff. Add a half-sentence there. dark_companionssummary: "DPAC's dark-companion table" is more accurate than "Gaia's own black-hole table".- The VSX route is still [verify]. The
verified_atdate is the review date, not a fresh check.
Name DPAC's dark-companion table in the H10 summary, add `off` to the level note in A22.7.2, and record H4's level as a stated exception in Q-529 until the spectra check is built. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Thanks for the re-review. On the nits (
CI is green, after a re-run for the flaky |
Closes #221
Adds the hunt register and
GET /v1/hunts(A22.7.1): the static list of Discovery hunts that the picker, the plan and the run record will read. It is metadata only, with no network access and no frontend UI.Parts of the register are not given by the spec. They are listed under "Please check" and recorded as Q-529.
What changed
Contract
shared/schemas/hunt-register.schema.json(new): a top-level array, as A22.7.1 writes it, withadditionalProperties: falseon every object.availability.reasonis required whenstateisdisabledand rejected when it isavailable.calibrationis an object ornull.backend/app/contract/hunt_register_schema.pyandfrontend/src/contract/generated.ts(D-18).frontend/scripts/generate-contract.jsgainshuntRegister.shared/README.md: lists the schema.Backend
app/core/hunts/register.py(new): the 10 hunts of A22.2 in table order (H4b is a stage ofasteroids, not its own entry).register()returns a copy.app/api/hunts.py(new):GET /v1/hunts, checked against the schema before it is sent (Q-40).app/main.py: includes the router.Docs
docs/decisions/discovery-hunts.md, its index row, the next free id (Q-530) and the routing row indocs/README.md.hunt:<id>:not_built. A22.7.1:offin the reply shape.GET /v1/huntsrow. A4.12: a pointer to thehunt:codes.Tests
tests/test_hunt_register.py(new): the reply validates against the schema and the generated type; ids are unique and matchHuntId; onlyasteroidsis available; every other hunt has its reason and isoff;kind,level,weight,versionand routes are pinned; bad availability shapes are rejected.tests/test_contract_fixtures.py: existing test changed. It expected a Pydantic model for every schema. This schema's root is an array, so its generated type is an alias; it is now listed inALIAS_SCHEMAS.The register
variablesnot_builtcold_worldsnot_builtasteroidsrunawaysnot_builtir_excessnot_builtdimmersnot_builtactive_asteroidsnot_builtslow_moversnot_builttransientsnot_builtdark_companionsneeds_release:gaia_dr4calibrationisnullfor all.Please check (Q-529, "Open (built)"): Kevin, Moon
hunt:<id>:not_built. A22.7.4 had no code for a hunt whose code is not merged. Hunt refusal codes and API errors #222 should include it in its builder.level: offfor every disabled hunt (A22.10.1).offis added to the schema and to A22.7.1, which had left it out although A22.4.1 has it.asteroidsis stillcharacterisation. A22.10.1 needs the measurement's own check for that level, and I found no Gaia DR3 spectra check inbackend/orfrontend/src. It is available and runs Discovery today.asteroidsversion1.0.0is not in the spec.asteroidstitle and summary now say only what runs today ("Known rocks"). Predict-first, spectra and precovery (HN-5, HN-11) are not built. Wording to be confirmed before the picker (Hunt picker card (against fixtures) #225) shows it.weight: lightfor H2 and H9 covers their catalogue stages only. Their pixel stages are heavy (A22.4.2), so HN-1 should not schedule lanes from this field alone.weight: lightfor H7 and H10, andkind: searchfor H2 (the spec says "search, then characterisation").variables(reworded to "checked against", A22.3.6),asteroids(item 5) andactive_asteroids(newly written).Related work
hunt-*.schema.json; this PR adds only the register schema.Huntprotocol (HN-1), the plan onPOST /v1/scans, run records, rows and any UI.Test results (local, offline)
pytest1873 passed, 5 skipped;ruff check,ruff format --checkandmypyclean; contract--checkpasses (bake-fixtures, area-fixtures and demo-pack--checkpassed before the review fixes).A local code review before the first push found no blocking issues. The changes requested in review are in the last two commits.
Done when (from #221)
GET /v1/huntsreturns every hunt of A22.2 and validates against the schema.🤖 Generated with Claude Code