Expect a 400, not a 404, for a record that is gone

Running the password tier against a disposable 5.13.50 instance for the
first time failed its last check. The purge itself was fine — the row really
was gone — but the assertion looked for a 404 and the server answers 400.

`Handler.php` maps Laravel's `ModelNotFoundException` to a 400 carrying
`No query results for model [App\Models\X].` and reserves 404 for a route
that does not exist, so a not-found check written against 404 never fires.
The assertion now matches the status together with the message, so a 400
raised for some other reason still fails, and `Error::Api` says so for
callers, who would otherwise write the same dead branch.

Also adds jq to the devshell, which the MSRV recheck in CLAUDE.md pipes
through but which was only ever resolving from the host.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 21:57:12 -04:00
co-authored by Claude Opus 5
parent 0485272080
commit e7c9663621
5 changed files with 35 additions and 11 deletions
+9 -2
View File
@@ -158,8 +158,9 @@ if a typed row lost a key (`keys kept: <resource>`, names only, never
values), and the write tier creates a purchase order, location, webhook and
recurring invoice from bare `Default` models, since those are what broke.
With `IN_API_PASSWORD` set as well, a password tier merges two throwaway
clients and purges the survivor (a real, permanent delete); it has not yet
been run against an instance. `.github/workflows/smoke.yml` runs it on demand (`workflow_dispatch` only,
clients and purges the survivor (a real, permanent delete); it was run
against a disposable 5.13.50 instance on 2026-10-24 and all four checks
pass. `.github/workflows/smoke.yml` runs it on demand (`workflow_dispatch` only,
needing `IN_BASE_URL` and `IN_API_TOKEN` secrets); the write tier runs only if
the `write_host` input names the instance's host.
@@ -311,6 +312,12 @@ changes, doc tweaks) does not need an entry.
decode, API error responses (with per-field validation `errors` map), and
client construction errors. `ApiErrorBody` mirrors Invoice Ninja's error
JSON shape.
- **A missing record is a `400`, not a `404`.** `Handler.php` maps Laravel's
`ModelNotFoundException` to a 400 carrying `No query results for model
[App\Models\X].`, and keeps 404 for a route that does not exist or a method
it does not support. So don't write a not-found check against 404 — the
smoke test's post-purge assertion did, and passed only because it had
never been run. Match the status together with the message.
## Coverage