Skip to content

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

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#338
btravers merged 5 commits into
mainfrom
chore/bump-unthrown-beta.5

Conversation

@btravers

Copy link
Copy Markdown
Collaborator

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 every call site + JSDoc @example.
  • Error combinators gained the *Cases suffixflatMapErrflatMapErrCases, tapErrtapErrCases. Migrated (client interceptors, worker activity/cancellation).
  • ts-pattern is now a peer dependency of unthrown (^5). Added ts-pattern (catalog 5.9.0) to every package that builds against unthrown; 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, so the changesets pipeline cuts 8.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 (the code always used the matcher). 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
(`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. 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:32

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

This PR bumps unthrown and @unthrown/vitest from 5.0.0-beta.3 to 5.0.0-beta.5 across the monorepo, updating call sites and examples for the renamed match/error-combinator APIs and adding ts-pattern to the workspace catalog to satisfy unthrown’s new peer dependency.

Changes:

  • Bump unthrown / @unthrown/vitest catalog versions to 5.0.0-beta.5 and regenerate pnpm-lock.yaml.
  • Migrate code and JSDoc/test examples from errerrCases and tapErr/flatMapErrtapErrCases/flatMapErrCases.
  • Add ts-pattern to the workspace catalog and to relevant package dev dependencies.

Reviewed changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pnpm-workspace.yaml Bumps catalog unthrown + @unthrown/vitest, adds ts-pattern catalog entry.
pnpm-lock.yaml Lockfile updates for unthrown@5.0.0-beta.5 and ts-pattern@5.9.0.
packages/worker/src/workflow.ts Updates JSDoc match examples to use errCases.
packages/worker/src/worker.ts Updates match handler key to errCases in createWorkerOrThrow.
packages/worker/src/cancellation.ts Updates documentation example to errCases.
packages/worker/src/activity.ts Updates JSDoc middleware example to tapErrCases; updates match handler key to errCases.
packages/worker/src/activity-contract-errors.spec.ts Updates test middleware usage to tapErrCases.
packages/worker/package.json Bumps unthrown peer range; adds ts-pattern to dev deps.
packages/contract/package.json Bumps unthrown peer range; adds ts-pattern to dev deps.
packages/client/src/interceptors.ts Updates JSDoc interceptor example to flatMapErrCases.
packages/client/src/client.ts Updates JSDoc match examples to errCases.
packages/client/src/client.spec.ts Updates tests to errCases / flatMapErrCases.
packages/client/src/tests/client.spec.ts Updates integration test match usage to errCases.
packages/client/package.json Bumps unthrown peer range; adds ts-pattern to dev deps.
examples/order-processing-worker/package.json Adds ts-pattern dependency alongside unthrown.
examples/order-processing-client/src/client.ts Updates match usage to errCases.
examples/order-processing-client/package.json Adds ts-pattern dependency alongside unthrown.
.changeset/bump-unthrown-beta-5.md Adds changeset to cut a new beta with the API migration + peer changes.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file
Comments suppressed due to low confidence (1)

packages/contract/package.json:97

  • unthrown@5 now has a ts-pattern peer dependency. Since unthrown is a (currently optional) peer of this package, declaring ts-pattern as an optional peer as well makes the transitive requirement explicit and avoids strict-peer install failures when consumers opt into unthrown.
  "peerDependencies": {
    "unthrown": "^5.0.0-beta.5"
  },
  "peerDependenciesMeta": {
    "unthrown": {
      "optional": true
    }
  },

Comment thread packages/worker/package.json
Comment thread packages/client/package.json
Comment thread packages/client/src/__tests__/client.spec.ts Outdated
btravers added 2 commits July 27, 2026 22:16
unthrown@5 declares ts-pattern as its own peer; mirror it here (matching the
optional-ness of the unthrown peer where applicable) so a consumer 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; using P.instanceOf where a member is a
non-tagged class like Temporal's ApplicationFailure), so a new error can't be
silently absorbed. Migrate all docs (guide, READMEs, source JSDoc) off the
v4-style match({ err: (error) => … }) / matchTags(...) / bare
mapErr/flatMapErr/tapErr to the v5 errCases/*Cases matcher API.
Comment thread docs/guide/client-usage.md Outdated
Comment thread packages/worker/src/worker.ts Outdated
…channel

These are technical/infrastructure failures never branched on for domain logic,
so per unthrown Thesis #1 (E = anticipated domain failures) they belong in the
defect channel, not E. Both classes stay exported and are constructed as the
defect's cause, preserving message/operation/cause for logging.

Boundaries mint them via the injected `defect` (qualify) or `throw` (throw→defect
in a work thunk); every E/union drops them (createWorker/create → never; the
RuntimeClientError arm leaves startWorkflow/executeWorkflow/getHandle/handle ops
and ClientCallError), collapsing the now-dead errCases arms (createWorkerOrThrow
folds with get(); the retry interceptor recovers via recoverDefect). Tests assert
`toBeDefect` with the wrapper class as cause; docs updated.

BREAKING: consumers matching these errors 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 42 out of 43 changed files in this pull request and generated 1 comment.

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

Comment thread packages/client/src/interceptors.ts Outdated
…odel

The `@example` titled "Retry a transient failure once" retried a *modeled*
WorkflowExecutionNotFoundError — not a transient fault, and misleading now that
transient technical faults ride the defect channel. Rewrote it to retry a
transient fault via `recoverDefect` (narrowed to RuntimeClientError, re-raising
anything else), and clarified that modeled domain errors stay on the Err channel.
@btravers
btravers merged commit 8b921ae into main Jul 27, 2026
11 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