Migrate remaining APIs to Huma (fort scan draft + tier 3/4)#369
Merged
Conversation
Fort scan (draft-badged) + pokemon search/id + tier 3 reads + tier 4 operational endpoints. Pointer-based response structs everywhere (pokemon template), reusing existing builders and the PR #368 Huma infrastructure. Stacked on feat/huma-pokemon-v2-v3-scan. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
13 tasks in 3 phases: shared infra (fort range unification, ApiLatLon, draft-badge + geofence helpers) -> fort scan (draft) -> pokemon search/id + tier 3 -> tier 4. Pointer-based result structs with golden snapshots; geofence endpoints via RawBody + NormaliseFenceFromBytes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
All planned endpoints (fort scan draft-badged, pokemon search/id, tier 3, tier 4) now served by Huma; v1 scan + /raw + health/version stay on gin. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Register available-pokemon (GET, 202) and retire the gin handler. The result struct (ApiPokemonAvailableResult) is plain ints, so no pointer conversion needed — just doc tags. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The quest-status, clear-quests, and pokestop-positions bodies are JSON (GeoJSON geometry/feature or a Golbat fence), but Huma's RawBody []byte documented them as application/octet-stream (a binary string). Switch to Body json.RawMessage so the OpenAPI shows application/json. json.RawMessage is assignable to []byte, so NormaliseFenceFromBytes is called unchanged; malformed JSON still returns 400 (Huma body-parse error). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Stacked on #368 (
feat/huma-pokemon-v2-v3-scan) — it reuses that PR's Huma infrastructure (ApiLatLon,setupHumaAPI, thegolbatSecretscheme, goccy serializer, body logger). Review/merge #368 first; this targets that branch and should be retargeted tomainonce #368 lands.Summary
Migrates ~18 remaining
/apiendpoints from gin to Huma, so the whole API is documented in OpenAPI / browsable at/docs./api/{gym,pokestop,station,fort}/scan) — served via Huma with a Draft badge (Stoplightx-badges),fort_in_memory503 gating, and the int8/int16 fort DNF range types unified into one./api/pokemon/searchand/api/pokemon/id/{pokemon_id}(v1/pokemon/scanleft on gin, deprecated).query, gymsearch, gym/pokestop/tappable by-id,pokestop-positions.quest-status,clear-quests,devices/all,fort-tracker/{cell,forts},reload-geojson(GET+POST),skip-preserve-pokemon(GET+POST).Response structs converted to pointer-based (so Huma documents them; golden-snapshot tests pin the wire format):
ApiGymResult,ApiPokestopResult,ApiStationResult,ApiTappableResult.ApiFortScanandApiPokemonSearchnow useApiLatLon(fixing the samegeo.Locationlat/lon bug).Still on gin (intentional):
/raw,/health,/version, v1/pokemon/scan,/pokemon/available.Notable behavior changes (consistent across the migration)
422+application/problem+json(was ad-hoc400/500{"error":...}).pokestop-positions/quest-status→400(was500); short-circuits before any DB call.gym/query/station/queryaccept only{"ids":[...]}(legacy bare-array form dropped).clear-questsDB-delete behavior verified identical; all per-endpoint success status codes (200/202) preserved.Test Plan
Automated (CI): golden-snapshot wire-compat for each converted struct,
humateste2e (auth/status/envelope) per group, OpenAPI registration + draft-badge assertions.go test ./...,go build -tags go_json ./...,go vet ./...all green.Manual (live DB):
/docsand confirm operations group by tag and the 4 fort scan ops show the orange Draft badge.clear-questsstill deletes within the geofence as before.Design + plan:
docs/superpowers/specs/2026-05-30-huma-remaining-apis-design.md,docs/superpowers/plans/2026-05-30-huma-remaining-apis.md🤖 Generated with Claude Code