Skip to content

ADR-0112 batch 3: retire the legacy error-shape compatibility layer (error.type, client multi-location probe, enum twins) #4004

Closed

Description

@os-zhuang

Batch 3 of ADR-0112's rollout (#3841; batch 1 = #3988, batch 2 = #4003). Runs after batch 2 — until every emitter speaks the catalog, the compatibility layer below is still load-bearing.

  • Retire error.type as a code carrier. Producers still emitting the code under type move it to code; type either disappears or is redeclared for its original purpose.
  • Delete ObjectStackClient's multi-location code probe. The client reads error.code / error.details.code / error.details.type / error.type in order (kept for old-server compat through The dispatcher puts the HTTP status in error.code and parks the real code in details — pinned in #3687, still unfixed #3842). Once servers this client version supports all emit error.code, collapse to a single read.
  • Fix the client's category / retryable reads. They currently look for these under nesting that the envelope never standardized; align with ApiErrorSchema/EnhancedApiErrorSchema as declared.
  • Dedupe the connector-side ErrorCategory / RetryStrategy twins — the connector packages carry local copies of enums the spec already exports; import from @objectstack/spec instead.

Refs #3841, #3842, #3988.

Activity

  1. os-zhuang commented on Jul 30, 2026

    @os-zhuang
    ContributorAuthor

    All four boxes are already done — three by work that landed in parallel with batches 1–2, one inside batch 2 itself. Verified each rather than taking the commit messages' word for it:

    Box Landed in Evidence
    Retire error.type as a code carrier #3842 error-envelope.conformance.test.ts asserts body.error.type is undefined, and carries a ratchet scanning the envelope helpers for type: 'SCREAMING'. 27 tests green.
    Delete the client's multi-location probe #4007 The chain is down to the two live envelopes' declared spots (errorBody.code, errorBody.error.code). The pre-#3842 error.details.code dig is gone, on the reasoning that SDK and server ship as one changesets fixed group — and that ADR-0112's value renames mean location-compat without value-compat protects nothing anyway.
    Fix the client's category/retryable nesting read #4006 (ADR-0112 D9b) Both now read from inside error per ApiErrorSchema; the old top-level read returned undefined against every conformant server.
    Dedupe the connector ErrorCategory / RetryStrategy twins #4021 (ADR-0112 D9a) ConnectorErrorCategorySchema / ConnectorRetryStrategySchema in integration/connector.zod.ts; grep 'export …ErrorCategory' over spec/src now returns exactly one definition. Side effect worth knowing: the api-side pair now appears in the generated API reference at all — the name collision had been silently dropping both.

    @objectstack/client full suite green (200 tests).

    Closing as completed. With #3988 (batch 1), #4021 (batch 2) and objectui#2977 (the console's tolerant read) merged, ADR-0112's rollout is finished end to end: one vocabulary, schema-enforced, with check:error-code-casing in lint.yml to stop a 209th lowercase literal landing the way the first 208 did.

    The one open descendant is #3977 — the field-level vocabulary, which ADR-0112 D6 deliberately scoped out.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions