Check parish ID out-of-bounds condition#97
Open
hepplerj wants to merge 10 commits into
Open
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Parish ID existence will be validated against the database instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Unknown parish IDs now return 400 with the offending IDs listed, instead of silently returning an empty array. Closes #44. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…on test Error responses previously carried Cache-Control: max-age=604800, so a 400 for a not-yet-added parish could be cached by clients for a week. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The log.Printf listed 14 %T verbs but passed 15 arguments (row.Name had no verb), which failed go vet and blocked go test's implicit vet step. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
TestMain set lowercase apiary_LOGGING, so access logging stayed on during integration test runs and polluted test output. Co-Authored-By: Claude Fable 5 <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.
Closes #44
Replaces the original hardcoded parish ID range check with validation against the database, per the design in
docs/superpowers/specs/2026-07-23-parish-id-validation-design.md.parseAPIParameters(inbom-bills.go) rejects only malformed (non-integer) parish IDs.Server.invalidParishIDsmethod (inbom-parishes.go) checks requested IDs againstbom.parisheswith a singleWHERE id = ANY($1)lookup.BillsHandlerreturns400 invalid parish ID(s): <ids>for unknown IDs and500if the lookup query fails.clientCacheMiddlewarenow marks error responsesCache-Control: no-store(previously every response, including errors, was client-cacheable for a week — a stale 400 could otherwise mask a newly added parish).Chosen over a corrected hardcoded bound (drifts as the parish table grows — the original 158 was already stale at 151) and a TTL-cached ID set (staleness window rejects newly added parishes). The per-request lookup is a single primary-key query, and the endpoint sits behind the server's 1-hour response cache.
go vetfix: theTypes:debug log inDeathCausesHandler(bom-causes.go) listed 14%Tverbs for 15 arguments, which blockedgo test's implicit vet step repo-wide.go vet ./...is clean on this branch.Pre-merge check: ✅ Done —
TestBomBillsInvalidParishpassed against the live database (2026-07-23), verifying the exact 400 body contract end-to-end.