You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 077a5d2
Browse filesBrowse the repository at this point in the historyBrowse files
fix(webapp,run-store): answer 404, not 500, for an unroutable or absent id
Two read paths answered 500 for input a caller controls. Found while
validating the gen-2 shard arms against a local instance.
`resolveShard` is pure id-shape, so any base32hex core plus [a-z0-9] plus
"2" parses as gen-2 and names a shard. The routing store throws for a
shard key it has no store for, and that throw reached the API boundary as
a 500 — so any caller holding an API key could induce one by guessing a
shard char, of which there are 36. A 5xx on a read also trips canary
rollbacks on deploy.
The throw stays: failing loud beats reading the wrong database. What
changes is the status the boundary reports. `#shardStore` now throws a
typed `UnknownShardKey` carrying the key and the configured set, and the
API boundary maps it to 404 — the same answer an absent gen-1 or cuid id
already gives. The boundary still logs at error level with the key, so a
shard dropped from a config meant to be append-only still alarms.
Separately, the waitpoint wait route threw `json(404)` from inside its own
try, so the catch-all caught that Response and re-threw it as a 500. Every
not-found waitpoint answered 500, including a plain absent cuid. Re-throw
a Response untouched: it carries a deliberate status, not a failure.
`#shardStore` also claimed its throw was unreachable with the two-store
compat constructor. It is reachable, because that constructor defaults to
the real resolver. Comment corrected and the reachability pinned by a test
that uses the real resolver rather than an injected one.
Measured on a local instance: all four cases that returned 500 now return
404, absent gen-1 and cuid ids still 404, and a real run still 200.
0 commit comments