Skip to content

v1.0.3

Choose a tag to compare

@n-ae n-ae released this 18 Jul 14:32

Patch release closing the three actionable findings from
docs/assessment-maintainable-architect-v4-v1.0.2.md, which reconciled
two disagreeing Codex reviews of v1.0.2 (one reporting zero findings,
one reporting five) through independent adversarial verification. No
breaking changes; module path unchanged.

Fixed:

  • A typed-nil coded error (e.g. a *NotFoundError returned nil on some
    path, then assigned to a plain error) panicked response rendering
    instead of classifying as ErrCodeInternal. errors.As matches on
    type, not nilness, so the classic Go typed-nil-interface footgun
    reached Code() on a nil receiver before any accessor ran.
    outermostCoded now rejects a typed-nil match centrally, so
    GetErrorCode and every JSON/problem body writer that shares it
    degrade to ErrCodeInternal instead of dereferencing.
  • An external Coder-only implementation (a documented, first-class
    extension point that doesn't require embedding BaseError) could
    return "" from Code() and have it ride straight through to the
    wire as the machine-readable error code. New/Wrap already
    normalized this for the package's own constructors as of v1.0.2;
    GetErrorCode now normalizes it too, closing the gap for bare
    third-party types at the one extraction point every renderer funnels
    through.

Documented:

  • Coder, ProblemTyper, ProblemInstancer, ProblemTitler, and
    Authenticator now state their contract explicitly: a true bool
    return implies a non-empty string, the same guarantee BaseError's
    own implementations already make. No code change - a third-party
    implementation following the documented convention was already safe.
  • Two design choices raised by the v1.0.2 review and confirmed
    deliberate rather than oversights are now recorded as ADRs instead of
    living only in review prose: Logger has no context.Context
    parameter (docs/adr/0001),
    and a marshal-panic log keeps the original error's stack rather than
    capturing a second one at the panic site
    (docs/adr/0002).

Test coverage: 100.0% (root module), 100.0% (zerologadapter, unchanged
this release).