Skip to content

v1.0.4

Choose a tag to compare

@n-ae n-ae released this 18 Jul 16:08

Patch release closing the M1 finding from
docs/assessment-maintainable-architect-v4-v1.0.3.md,
which reconciled two independent reviews of v1.0.3 (a Codex direct review
and a second, adversarially-minded review) through fresh verification
against actual source rather than trusting either review's prose. No
breaking changes; module path unchanged.

Fixed:

  • v1.0.3 protected classification (GetErrorCode) against a typed-nil
    coded error (e.g. a *NotFoundError returned nil on some path, then
    assigned to a plain error), but GetStackTrace and
    RecaptureStackTrace shared no such guard - each ran its own
    errors.As search and called the result directly, panicking on the
    same typed-nil-interface footgun outermostCoded already closed for
    classification. Since errorLogFields calls GetStackTrace for any
    5xx classification (exactly what a typed-nil error normalizes to),
    this reached WriteHTTPError/WriteHTTPProblem during logging,
    after the response body had already been written. Verified
    end-to-end against a real httptest.Server: inside
    RecoveryMiddleware, that second panic was treated as arriving after
    response commitment, aborting the connection and dropping an
    already-correct 500 response instead of delivering it. Both functions
    now share outermostCoded's isNilValue guard, treating a typed-nil
    match as "not found" rather than dereferencing it.
  • logError now returns immediately when the logger is nil, before
    building log fields, matching the early-return pattern Renderer.log
    already used one layer up - avoids doing (and risking) work for a
    caller who opted out of logging entirely.

Test coverage: 100.0% (root module). zerologadapter is unchanged this
release - per the documented adapter-versioning policy, it's tagged
independently and only when the adapter itself changes, so its latest
tag lagging the root's is expected, not an oversight.