Skip to content

chore(deps): bump unthrown to 5.0.0-beta.5 - #602

Merged
btravers merged 5 commits into
mainfrom
chore/bump-unthrown-beta.5
Jul 27, 2026
Merged

chore(deps): bump unthrown to 5.0.0-beta.5#602
btravers merged 5 commits into
mainfrom
chore/bump-unthrown-beta.5

Conversation

@btravers

Copy link
Copy Markdown
Contributor

Bumps unthrown (and @unthrown/vitest) from 5.0.0-beta.3 to 5.0.0-beta.5, cutting a new beta of the contract packages.

What changed in unthrown between beta.3 and beta.5

  • match's error handler renamed errerrCases (it takes the exhaustive ts-pattern matcher). Migrated call sites + JSDoc @examples.
  • Error combinators gained the *Cases suffixmapErrmapErrCases, flatMapErrflatMapErrCases, tapErrtapErrCases. Migrated across client, worker (retry/worker), and examples.
  • ts-pattern is now a peer dependency of unthrown (^5). Added ts-pattern (catalog 5.9.0) to every package that builds against unthrown (core, worker, examples, tests); client already had it. strictPeerDependencies now resolves.
  • Peer range raised to ^5.0.0-beta.5.

Gate

format --check, lint, typecheck, knip, test, build all green.

New beta

A patch changeset is included; the fixed version group bumps all six packages, so the changesets pipeline cuts 3.0.0-beta.1 on merge.

Follow-up (not in this PR)

The docs/guide/*.md guides still contain v4-style match({ err: (error) => … }) plain-callback examples that predate v5's matcher API. They need a dedicated docs migration to the errCases: (matcher) => matcher.with(P._, …) form — left out here to keep this a focused dependency bump.

Track the beta.4/beta.5 API changes: match's error handler key renamed
`err` → `errCases`, and the bare error combinators gained the `*Cases` suffix
(`mapErr` → `mapErrCases`, `flatMapErr` → `flatMapErrCases`, `tapErr` →
`tapErrCases`). unthrown@5 now declares `ts-pattern` as a peer dependency, so
`ts-pattern` (^5, catalog 5.9.0) is added to the packages that build against
unthrown (core, worker, examples, tests). Peer range raised to `^5.0.0-beta.5`.

The guide docs still show v4-style `match({ err: (error) => … })` examples and
are left for a separate docs migration pass.
Copilot AI review requested due to automatic review settings July 27, 2026 19:36
Comment thread packages/client/src/client.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the monorepo to unthrown@5.0.0-beta.5 (and @unthrown/vitest@5.0.0-beta.5), migrating call sites and examples to the renamed error-case APIs and ensuring ts-pattern is present where needed to satisfy unthrown’s new peer dependency.

Changes:

  • Bumped unthrown / @unthrown/vitest from 5.0.0-beta.35.0.0-beta.5 via the workspace catalog + lockfile refresh.
  • Migrated worker/client code to errCases and *ErrCases combinator names (mapErrCases, flatMapErrCases, tapErrCases).
  • Added ts-pattern to the relevant packages (tests/examples and dev deps for build targets) and included a patch changeset for the fixed version group.

Reviewed changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/package.json Adds ts-pattern so tests satisfy unthrown’s new peer dependency.
pnpm-workspace.yaml Updates catalog pins for unthrown and @unthrown/vitest (and confirms ts-pattern catalog entry).
pnpm-lock.yaml Lockfile update reflecting unthrown@5.0.0-beta.5 and ts-pattern peer resolution.
packages/worker/src/worker.ts Migrates worker error combinators to *ErrCases.
packages/worker/src/retry.ts Migrates retry publish error handling to flatMapErrCases.
packages/worker/src/errors.ts Updates JSDoc example to errCases.
packages/worker/package.json Bumps unthrown peer range and adds ts-pattern to devDependencies.
packages/core/src/errors.ts Updates JSDoc examples to errCases.
packages/core/package.json Bumps unthrown peer range and adds ts-pattern to devDependencies.
packages/client/src/interceptors.ts Updates interceptor JSDoc example to flatMapErrCases.
packages/client/src/interceptors.spec.ts Updates tests to flatMapErrCases.
packages/client/src/client.ts Migrates client error combinators and updates match example to errCases.
packages/client/package.json Bumps unthrown peer range to ^5.0.0-beta.5.
examples/basic-order-processing-worker/src/index.ts Updates example worker creation error handling to tapErrCases.
examples/basic-order-processing-worker/package.json Adds ts-pattern dependency for the example package.
examples/basic-order-processing-client/src/index.ts Updates example client error handling to tapErrCases.
examples/basic-order-processing-client/package.json Adds ts-pattern dependency for the example package.
.changeset/bump-unthrown-beta-5.md Adds a patch changeset documenting the breaking API renames and peer update.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

Comment thread .changeset/bump-unthrown-beta-5.md
btravers added 2 commits July 27, 2026 22:14
unthrown@5 declares ts-pattern as its own peer; mirror it here so a consumer of
these packages gets the explicit single-copy requirement (and no strict-peer
install surprise). The devDependency stays for the local build.
Replace every P._ wildcard with explicit enumeration of the error union
(grouping cases that share a handler), so a new error can't be silently
absorbed. Migrate all docs (guide, README, .agents/rules) off the v4-style
match({ err: (error) => … }) and bare mapErr/flatMapErr/tapErr to the v5
errCases/*Cases matcher API. A retry test that injected an out-of-contract
Error (which only passed because P._ caught anything) now injects the real
in-contract TechnicalError.
Comment thread .agents/rules/handlers.md Outdated
TechnicalError is a technical/infrastructure failure never branched on for
domain logic, so per unthrown Thesis #1 (E = anticipated domain failures) it
belongs in the defect channel, not E. RetryableError / NonRetryableError (the
domain-meaningful retryable-vs-terminal distinction) stay modeled.

It is minted via the injected `defect` at qualify boundaries (AmqpClient ops,
(de)compression, schema validation), `throw`→defect inside combinator callbacks,
or `fromSafeThrowable` at imperative/early-return sites. Every AmqpClient op and
worker/client pipeline drops it from E (→ never); the ~15 lone-TechnicalError
enumerations collapse; observers move to tapDefect / tapFailure and swallows to
recoverDefect. The class stays exported as the defect's cause.

Because a terminal Defect is a value (not a throw), the consume callback now
nacks an unhandled terminal defect to DLX — preserving the pre-migration
"terminal technical failure → DLQ" behaviour and preventing a stuck/poison-loop
message (an already-succeeded handler must not be re-run on redelivery).

Tests assert `toBeDefect` with TechnicalError as cause; docs updated.

BREAKING: consumers matching TechnicalError move to the defect arm.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 66 out of 67 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

Comment thread packages/worker/src/worker.ts Outdated
Comment thread packages/client/src/client.ts Outdated
validateSchema (worker) and the publish validateMessage (client) called
`schema["~standard"].validate(...)` directly, so a Standard Schema validator
that throws *synchronously* would escape before fromPromise wrapped it — out of
processMessage / out of publish() as a raw throw, contradicting the error model
(a thrown/rejected validator is a defect). Guard the call with the same
try/catch → technicalDefect(...) pattern already used at the RPC validation
sites, so a sync throw surfaces on the defect channel like a rejection.
@btravers
btravers merged commit fd89fb0 into main Jul 27, 2026
12 checks passed
@btravers
btravers deleted the chore/bump-unthrown-beta.5 branch July 27, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants