Silently swallowed errors: unparseable exp yields 401 instead of 400, sidecar write failures logged nowhere #72
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Verified against
mainat61f42e6. Repo rules forbid silently defaulting an invalid explicit value; these are the remaining instances in the request path.internal/handlers/image.go:43-47— an unparseableexpquery parameter has itsstrconverror discarded, leavingreq.Expireszero. The request then fails asErrMissingExpiration, so the client gets 401 Unauthorized for what is a malformed request.exp=bananaand a genuinely unsigned request are indistinguishable to the caller, which makes integration debugging needlessly hard. Should be a 400 naming the parameter.internal/imgcache/storage.go:417-420— the.metasidecar write failure is discarded with a bare_ = err, no log line. The variant file is then on disk with no sidecar; content type falls back toapplication/octet-streamon a later read.internal/imgcache/cache.go:169-172— the source metadata JSON write failure is likewise discarded with_ = errand no log.internal/imgcache/cache.go:312-313— twoQueryRowContextresults discarded with_ =. The wrong-table problem is #56; noting the swallowing separately, because even after #56 fixes the tables, a failing query would still be invisible.Cases 2 and 3 are defensible as non-fatal (the DB is authoritative), but "non-fatal" and "invisible" are different things: a disk filling up or a permissions problem currently produces no signal at all. This became more consequential with #51/PR #55, where reconciliation relies on sidecars to recover content types.
Definition of done
expreturns 400 naming the parameter and the offending value, not 401. Failing test first.warnwith enough context to act on (path or key, and the error). Keep them non-fatal; the goal is visibility, not new failure modes._ = errin non-test code and either handle or log each; state in the PR what was found and why anything left alone is genuinely fine.make checkgreen (errcheckis already enforced by the canonical config landing in #54 — coordinate ordering, since that PR may touch some of these lines).Coordination
Case 4 overlaps #56. Cases 2-3 touch files PR #55 changes heavily. Prefer doing this after both PRs land.