@proompteng/temporal-bun-sdk 0.9.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +11 -0
  2. package/dist/agent-readiness.json +27 -9
  3. package/dist/production-readiness.json +232 -19
  4. package/dist/src/activities/lifecycle.d.ts.map +1 -1
  5. package/dist/src/activities/lifecycle.js +12 -5
  6. package/dist/src/activities/lifecycle.js.map +1 -1
  7. package/dist/src/bin/lint-workflows-command.d.ts +3 -3
  8. package/dist/src/bin/lint-workflows-command.d.ts.map +1 -1
  9. package/dist/src/bin/lint-workflows-command.js +5 -0
  10. package/dist/src/bin/lint-workflows-command.js.map +1 -1
  11. package/dist/src/bin/replay-command.d.ts +2 -2
  12. package/dist/src/bin/replay-command.d.ts.map +1 -1
  13. package/dist/src/bin/replay-command.js +9 -5
  14. package/dist/src/bin/replay-command.js.map +1 -1
  15. package/dist/src/bin/temporal-bun.d.ts +2 -2
  16. package/dist/src/client/interceptors.d.ts.map +1 -1
  17. package/dist/src/client/interceptors.js +1 -1
  18. package/dist/src/client/interceptors.js.map +1 -1
  19. package/dist/src/client.d.ts.map +1 -1
  20. package/dist/src/client.js +102 -35
  21. package/dist/src/client.js.map +1 -1
  22. package/dist/src/common/payloads/codecs.d.ts +4 -4
  23. package/dist/src/common/payloads/codecs.d.ts.map +1 -1
  24. package/dist/src/config.d.ts +10 -10
  25. package/dist/src/config.d.ts.map +1 -1
  26. package/dist/src/interceptors/types.d.ts.map +1 -1
  27. package/dist/src/interceptors/types.js +6 -4
  28. package/dist/src/interceptors/types.js.map +1 -1
  29. package/dist/src/otel/auto-instrumentations-node.d.ts +1 -1
  30. package/dist/src/otel/auto-instrumentations-node.d.ts.map +1 -1
  31. package/dist/src/worker/runtime.d.ts.map +1 -1
  32. package/dist/src/worker/runtime.js +169 -23
  33. package/dist/src/worker/runtime.js.map +1 -1
  34. package/dist/src/workflow/command-event-matrix.d.ts +13 -0
  35. package/dist/src/workflow/command-event-matrix.d.ts.map +1 -0
  36. package/dist/src/workflow/command-event-matrix.js +158 -0
  37. package/dist/src/workflow/command-event-matrix.js.map +1 -0
  38. package/dist/src/workflow/context.d.ts.map +1 -1
  39. package/dist/src/workflow/context.js +0 -11
  40. package/dist/src/workflow/context.js.map +1 -1
  41. package/dist/src/workflow/determinism.d.ts.map +1 -1
  42. package/dist/src/workflow/determinism.js +27 -1
  43. package/dist/src/workflow/determinism.js.map +1 -1
  44. package/dist/src/workflow/executor.d.ts.map +1 -1
  45. package/dist/src/workflow/executor.js +22 -21
  46. package/dist/src/workflow/executor.js.map +1 -1
  47. package/dist/src/workflow/guards.d.ts.map +1 -1
  48. package/dist/src/workflow/guards.js +141 -36
  49. package/dist/src/workflow/guards.js.map +1 -1
  50. package/dist/src/workflow/index.d.ts +1 -0
  51. package/dist/src/workflow/index.d.ts.map +1 -1
  52. package/dist/src/workflow/index.js +1 -0
  53. package/dist/src/workflow/index.js.map +1 -1
  54. package/docs/agent-adoption-guide.md +28 -1
  55. package/docs/default-choice-hardening-plan.md +183 -0
  56. package/docs/feature-matrix.md +20 -20
  57. package/docs/production-design.md +1 -1
  58. package/docs/production-readiness-implementation-plan.md +36 -17
  59. package/docs/semantic-readiness.md +67 -13
  60. package/docs/support-policy.md +6 -2
  61. package/package.json +9 -7
@@ -0,0 +1,183 @@
1
+ # Temporal Bun SDK Default-Choice Hardening Plan
2
+
3
+ _Last updated: May 6, 2026_
4
+
5
+ ## Current Verdict
6
+
7
+ The SDK is published and usable for opt-in Bun-first Temporal projects, but it
8
+ is not default-choice ready. A neutral release-gate review rejected the current
9
+ evidence because it is too small, too self-attested, and too narrow for a
10
+ production Temporal worker SDK.
11
+
12
+ `dist/agent-readiness.json` must stay `recommended: false` until this plan's
13
+ acceptance criteria are satisfied.
14
+
15
+ ## Acceptance Criteria
16
+
17
+ 1. Replay corpus:
18
+ - at least 25 checked-in histories;
19
+ - required feature coverage: timer, activity, retry, child workflow,
20
+ continue-as-new, signal, query, update, cancellation, failure, search
21
+ attributes, payload codec, versioning, side effect, and workflow-task
22
+ failure;
23
+ - report includes feature tags, Bun version, SDK version, Temporal Server
24
+ version, payload codec profile, event counts, expected command counts, and
25
+ mismatch counts.
26
+ 2. Command/event compatibility:
27
+ - checked-in matrix mapping every supported `WorkflowCommandIntent` to
28
+ Temporal command type and expected history event families;
29
+ - golden tests for success and failure/cancellation paths;
30
+ - replay tests that prove histories generated by real Temporal Server events
31
+ reproduce the expected command state.
32
+ 3. Bun/JSC async semantics:
33
+ - async fuzz report includes operation coverage and failure oracle details;
34
+ - at least 10,000 seeds and 64 operations per seed;
35
+ - adversarial checks for promise microtasks, timers, `Date.now`,
36
+ `Math.random`, local activity, side effect, versioning, patching, metadata,
37
+ and blocked ambient APIs.
38
+ 4. Worker isolation:
39
+ - adversarial workflow tests for filesystem, network, subprocess, clock,
40
+ random, global mutation, and cross-workflow state leakage;
41
+ - runtime and lint gates must both fail closed.
42
+ 5. Load and soak:
43
+ - at least 1,000 workflows per default-choice load run;
44
+ - peak workflow concurrency of at least 50;
45
+ - CPU, activity, and update workflow scenarios present in the report;
46
+ - six-hour release soak with at least 12 successful load iterations;
47
+ - failure injection for shutdown, restart, server disconnect, sticky cache
48
+ churn, cancellation, and retry paths.
49
+ 6. Compatibility matrix:
50
+ - recorded Bun version, platform, architecture, Temporal CLI/server version,
51
+ namespace mode, sticky/non-sticky mode, and task queue mode;
52
+ - broaden support only after the matrix row has passing evidence.
53
+ 7. Operational evidence:
54
+ - production services using the SDK expose traffic, uptime, deploy, rollback,
55
+ upgrade, and incident evidence;
56
+ - release artifacts link raw reports, not only summarized pass/fail fields.
57
+ 8. Support scope:
58
+ - docs continue to state that the official Temporal SDK is preferred when
59
+ Temporal-maintained Core support is mandatory.
60
+
61
+ ## Implementation Order
62
+
63
+ 1. Gate honesty: keep publish evidence separate from default-choice evidence and
64
+ make `verify:default-choice` fail until the above thresholds pass.
65
+ 2. Replay expansion: add real histories and feature-tag coverage before raising
66
+ claims.
67
+ 3. Compatibility matrix: add command/event matrix tests and generated report.
68
+ 4. Isolation hardening: add adversarial workflow modules and fail-closed guard
69
+ tests.
70
+ 5. Load/soak hardening: add scenario coverage, restart/disconnect modes, memory
71
+ samples, and long-running release lanes.
72
+ 6. Release evidence: package raw report snapshots or link immutable CI
73
+ artifacts from `production-readiness.json`.
74
+ 7. External review: rerun the neutral ChatGPT/oracle prompt against the raw
75
+ public evidence and keep `recommended: false` unless the answer is
76
+ `YES` or a documented `CONDITIONAL` that matches the support scope.
77
+
78
+ ## Progress Log
79
+
80
+ - May 6, 2026: added `verify:default-choice` as a failing strict gate and kept
81
+ `verify:production` honest for opt-in release evidence.
82
+ - May 6, 2026: added a checked-in command/event matrix for all currently
83
+ materialized workflow command kinds.
84
+ - May 6, 2026: expanded the replay corpus to 28 fixtures, including 25
85
+ Temporal CLI dev-server histories captured by
86
+ `scripts/capture-replay-corpus.ts`. The corpus now meets the fixture-count
87
+ floor and verifies command-kind drift, but it still lacks required coverage
88
+ for signal, query, update, cancellation, search-attributes, versioning,
89
+ side-effect, and workflow-task-failure evidence, so default-choice readiness
90
+ remains blocked.
91
+ - May 6, 2026: expanded the replay corpus again to 35 fixtures, including 32
92
+ Temporal CLI dev-server histories. `verify:replay-corpus` now records
93
+ feature tags, command kinds, external operation kinds, and Temporal history
94
+ event families. The replay gate is passing with required coverage for signal,
95
+ query, update, cancellation, search attributes, versioning, side effect, and
96
+ workflow-task-failure evidence. Default-choice readiness remains blocked by
97
+ async-fuzz operation depth, load/soak thresholds, CI workflow coverage, and
98
+ production-operation evidence.
99
+ - May 6, 2026: raised the async fuzz default to 10,000 seeds with 64 workflow
100
+ operations per seed and changed the report to count operation coverage from
101
+ the workflow result instead of the planned RNG path. The async gate now
102
+ records 640,000 executed operations, full coverage, and the replay/mutation
103
+ oracle. Default-choice readiness remains blocked by load/soak thresholds, CI
104
+ workflow coverage, broader workflow-isolation/runtime matrix evidence, and
105
+ production-operation history.
106
+ - May 6, 2026: replaced the old 64-workflow smoke load artifact with a
107
+ 1,000-workflow Temporal CLI dev-server run that hit peak workflow concurrency
108
+ 50, completed all submitted workflows, and covered CPU, activity, and update
109
+ workflow scenarios. Default-choice readiness remains blocked by the six-hour
110
+ soak requirement, CI default-choice coverage, broader workflow-isolation and
111
+ runtime matrix evidence, and production-operation history.
112
+ - May 6, 2026: hardened the soak runner to record per-iteration load summaries,
113
+ runtime/server metadata, and failure-mode coverage for baseline,
114
+ worker-restart, sticky-cache-churn, and update rejection/termination paths.
115
+ The smoke run covered the four then-required modes, but default-choice
116
+ readiness remained blocked by the six-hour soak duration, 12-iteration
117
+ release threshold, broader runtime matrix evidence, and production-operation
118
+ history.
119
+ - May 7, 2026: added an `activity-cancellation` soak mode that cancels
120
+ activity-heavy workflows while heartbeat activities are running and requires
121
+ cancellation-attempt/success plus terminal `CANCELED` outcome evidence in
122
+ `verify:production`. The smoke run now covers five failure modes with no
123
+ missing failure-mode evidence, but default-choice readiness remains blocked by
124
+ the six-hour soak duration, 12-iteration release threshold, and the
125
+ sticky-cache/shutdown semantic gate that depends on long-soak evidence.
126
+ - May 7, 2026: added a direct shutdown-poller regression test that keeps normal
127
+ workflow, sticky workflow, and activity long-poll RPCs open, then verifies
128
+ worker shutdown aborts every poll, flushes metrics, and reports a drained
129
+ shutdown. This closes an important unit-level evidence gap for the
130
+ sticky-cache/shutdown concern, while the default-choice gate still requires
131
+ the six-hour soak report before marking that concern fully evidenced.
132
+ - May 6, 2026: added `verify:default-choice` to the npm publish path and added
133
+ structured production-usage evidence for Jangar/Bumba source, deployment, and
134
+ observability references. The CI coverage blocker is closed locally, but
135
+ default-choice readiness remains blocked by long-soak evidence and the
136
+ sticky-cache/shutdown semantic gate that depends on it.
137
+ - May 6, 2026: added `.github/workflows/temporal-bun-sdk-nightly.yml` for
138
+ scheduled two-hour long-soak evidence and manual six-hour release soak runs,
139
+ with release mode gated by `verify:default-choice` and artifact upload. The
140
+ evidence generator now validates that this long-soak lane exists, but default
141
+ choice remains blocked until an actual six-hour report passes.
142
+ - May 7, 2026: added load/soak memory sampling artifacts. Load iterations and
143
+ soak wrappers now write `memory.jsonl` and RSS/heap slope summaries, and
144
+ `verify:production` keeps soak evidence failed when memory samples are
145
+ missing or exceed the configured slope limit. Default choice remains blocked
146
+ until a real six-hour, 12-iteration release soak passes with those artifacts.
147
+ - May 7, 2026: widened the worker-load heartbeat activity timeout budget and
148
+ moved it into explicit load configuration. The prior release soak used a
149
+ `10s` schedule-to-close timeout for activity-heavy workflows; under the
150
+ `1000`-workflow release profile, one baseline activity waited about `9.5s`
151
+ before its third retry started and then failed on schedule-to-close. The gate
152
+ now uses a `30s`/`60s`/`90s`/`150s` heartbeat/start/schedule budget and
153
+ records heartbeat, start-to-close, schedule-to-start, and
154
+ schedule-to-close budgets in the load report so release soak evidence is
155
+ measuring worker/runtime behavior instead of an undersized synthetic timeout.
156
+ - May 7, 2026: moved worker-load completion verification off the Temporal CLI
157
+ describe loop and onto the SDK's native `DescribeWorkflowExecution` RPC path
158
+ with bounded describe concurrency. The failed publish soak completed two full
159
+ passes of every failure mode and passed memory-slope checks, but the 11th
160
+ iteration timed out while the external CLI verifier was describing 1,000
161
+ workflows. Release-soak evidence now measures SDK worker/client behavior
162
+ instead of the throughput of a shell-based verifier.
163
+ - May 7, 2026: isolated the signal/query and query-only integration suites onto
164
+ UUID-suffixed task queues by default. The shared remote Temporal namespace had
165
+ stale `temporal-bun-integration` workflow tasks from previous runs, so workers
166
+ could pick up unrelated failed executions before exercising the current test.
167
+ Remote CI evidence now distinguishes SDK behavior from namespace/task-queue
168
+ contamination.
169
+ - May 7, 2026: fixed a real signal/query determinism blocker exposed by the
170
+ remote CI gate. Query-handler records and query-time logs are no longer
171
+ persisted into the workflow determinism state for normal workflow tasks,
172
+ because Temporal queries are not history events. A regression test now covers
173
+ the sequence that failed in CI: query while blocked, then process a signal and
174
+ query the updated state without tripping nondeterminism.
175
+ - May 8, 2026: the publish-mode six-hour soak completed 40 consecutive
176
+ `1000`-workflow iterations across baseline, worker restart, sticky churn,
177
+ update rejection/termination, and activity cancellation before the 41st
178
+ iteration hit the worker-load runner's fixed `105s` completion budget. The
179
+ gate now scales the default completion budget with workflow count and
180
+ concurrency, records that derived budget in load reports, and writes partial
181
+ workflow completion status plus a serialized completion failure before
182
+ returning nonzero. Default choice remains blocked until the publish-mode soak
183
+ reruns and publishes `0.10.0`.
@@ -1,26 +1,26 @@
1
1
  # Temporal Bun SDK Feature Matrix
2
2
 
3
- _Last updated: May 5, 2026_
3
+ _Last updated: May 6, 2026_
4
4
 
5
- | Feature | Status | Evidence |
6
- | ---------------------------------- | -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
7
- | Pure Bun worker runtime | Supported | `src/worker/runtime.ts`, `verify:production`, package-boundary tests. |
8
- | Workflow command context | Supported | `src/workflow/context.ts`, `tests/workflow/*.test.ts`, protocol golden tests. |
9
- | Deterministic time/random wrappers | Supported | `src/workflow/guards.ts`, runtime guard tests, query guard matrix. |
10
- | Workflow queries | Supported with strict read-only guards | `tests/integration/query-only.integration.test.ts`, `tests/workflow/query-guard-matrix.test.ts`. |
11
- | Workflow signals | Supported | `tests/integration/signal-query.integration.test.ts`, `tests/workflow/signals-queries.test.ts`. |
12
- | Workflow updates | Supported | `tests/integration/workflow-updates.test.ts`, `tests/worker.update-protocol.test.ts`. |
13
- | Activities | Supported | `tests/integration/activity-lifecycle.integration.test.ts`, `tests/activities/lifecycle.test.ts`. |
14
- | Heartbeats and cancellation | Supported | Activity lifecycle integration tests. |
15
- | Sticky queues/cache | Supported | `src/worker/sticky-cache.ts`, worker runtime integration tests, load report. |
16
- | Replay ingestion | Supported | `src/workflow/replay.ts`, replay fixtures, replay corpus verifier. |
17
- | Payload codecs | Supported | JSON tunnel, gzip, AES-GCM tests and payload codec integration. |
18
- | TLS/mTLS | Supported | TLS config tests and docs. |
19
- | Temporal Cloud Ops | Supported when endpoint credentials are configured | Cloud Ops integration is optional without credentials. |
20
- | Worker build IDs/versioning | Supported with strict pinned policy in production | Worker runtime configuration and build-id registration tests. |
21
- | Nexus operation commands | Experimental | Unit coverage exists; replay corpus and integration coverage must expand before default-choice recommendation. |
22
- | Release soak proof | Supported with release smoke | `scripts/run-worker-soak.ts`; CI uploads `worker-soak/report.json` and `verify:production` validates it. |
23
- | Extended soak proof | Operational hardening gate | Run longer soak windows for unusually high-throughput or new platform/runtime combinations. |
5
+ | Feature | Status | Evidence |
6
+ | ---------------------------------- | -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
7
+ | Pure Bun worker runtime | Supported | `src/worker/runtime.ts`, `verify:production`, package-boundary tests. |
8
+ | Workflow command context | Supported | `src/workflow/context.ts`, `tests/workflow/*.test.ts`, protocol golden tests. |
9
+ | Deterministic time/random wrappers | Supported | `src/workflow/guards.ts`, runtime guard tests, query guard matrix. |
10
+ | Workflow queries | Supported with strict read-only guards | `tests/integration/query-only.integration.test.ts`, `tests/workflow/query-guard-matrix.test.ts`. |
11
+ | Workflow signals | Supported | `tests/integration/signal-query.integration.test.ts`, `tests/workflow/signals-queries.test.ts`. |
12
+ | Workflow updates | Supported | `tests/integration/workflow-updates.test.ts`, `tests/worker.update-protocol.test.ts`. |
13
+ | Activities | Supported | `tests/integration/activity-lifecycle.integration.test.ts`, `tests/activities/lifecycle.test.ts`. |
14
+ | Heartbeats and cancellation | Supported | Activity lifecycle integration tests. |
15
+ | Sticky queues/cache | Supported | `src/worker/sticky-cache.ts`, worker runtime integration tests, load report. |
16
+ | Replay ingestion | Supported | `src/workflow/replay.ts`, replay fixtures, replay corpus verifier. |
17
+ | Payload codecs | Supported | JSON tunnel, gzip, AES-GCM tests and payload codec integration. |
18
+ | TLS/mTLS | Supported | TLS config tests and docs. |
19
+ | Temporal Cloud Ops | Supported when endpoint credentials are configured | Cloud Ops integration is optional without credentials. |
20
+ | Worker build IDs/versioning | Supported with strict pinned policy in production | Worker runtime configuration and build-id registration tests. |
21
+ | Nexus operation commands | Experimental | Unit coverage exists; replay corpus and integration coverage must expand before default-choice recommendation. |
22
+ | Release soak proof | Supported with release smoke | `scripts/run-worker-soak.ts`; CI uploads `worker-soak/report.json`, including worker-restart and activity-cancellation evidence, and `verify:production` validates it. |
23
+ | Extended soak proof | Operational hardening gate | Run longer soak windows for unusually high-throughput or new platform/runtime combinations. |
24
24
 
25
25
  Status language:
26
26
 
@@ -251,7 +251,7 @@ can contribute independently without re-planning.
251
251
  - CPU-heavy + I/O-heavy workflows live under `tests/integration/load/**` alongside the JSONL metrics aggregator. The harness starts the Temporal CLI dev server, creates `.artifacts/worker-load` per run, and collects sticky cache, poll latency, and throughput metrics via the worker runtime's file exporter.
252
252
  - Local runs: `cd packages/temporal-bun-sdk && TEMPORAL_INTEGRATION_TESTS=1 bun test tests/integration/worker-load.test.ts` (Bun test runner) or `cd packages/temporal-bun-sdk && bun run test:load` (Bun CLI script).
253
253
  - CI: `.github/workflows/temporal-bun-sdk.yml` now executes `cd packages/temporal-bun-sdk && bun run test:load` after the main suite and uploads the `.artifacts/worker-load/{metrics.jsonl,report.json,temporal-cli.log}` bundle for reviewers.
254
- - Default knobs submit 36 workflows with a 100s completion budget and workflow/activity concurrency of 10/14; the Bun test adds a ~15s cushion over `TEMPORAL_LOAD_TEST_TIMEOUT_MS + TEMPORAL_LOAD_TEST_METRICS_FLUSH_MS` so that healthy runs finish well before the CI hard timeout while still exercising the scheduler.
254
+ - Default knobs submit 64 workflows with a 100s completion budget and workflow/activity concurrency of 10/14; completion evidence is verified through the SDK's own `DescribeWorkflowExecution` RPC path with bounded `TEMPORAL_LOAD_TEST_DESCRIBE_CONCURRENCY` instead of shelling out to `temporal workflow describe` for every workflow. This keeps the release soak focused on worker/runtime behavior instead of CLI polling overhead.
255
255
 
256
256
  ### TBS-004 – Observability (Complete)
257
257
 
@@ -41,18 +41,18 @@ work is to convert private confidence into public, machine-checkable evidence.
41
41
 
42
42
  ## Code Read Findings
43
43
 
44
- | Surface | Current implementation | Production gap to close |
45
- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
46
- | Package boundary | `packages/temporal-bun-sdk/package.json` ships `dist`, `docs`, `skills`, and `README.md`; runtime dependencies are `@bufbuild/protobuf`, Connect, Effect, and TypeScript. `verify:production` runs `tests/packaging/manifest-packaging.test.ts`. | Keep this as a release gate and publish the result in a release manifest so agents can prove the package is not a Node/native wrapper. |
47
- | Worker runtime | `src/worker/runtime.ts` owns config load, WorkflowService transport, workflow/activity pollers, sticky queues, deployment/build IDs, scheduler, metrics, plugins, graceful shutdown, determinism marker emission, and activity task lifecycle. | Add restart/chaos/soak scenarios for poll cancellation, sticky cache drift, task-not-found, heartbeat failure, tuner changes, and shutdown during active workflow/activity tasks. |
48
- | Workflow execution | `src/workflow/executor.ts` runs registered workflows through Effect, creates `WorkflowCommandContext`, evaluates queries, processes updates, and materializes success/failure commands. | Add protocol golden tests that compare emitted commands and update protocol messages against captured histories and expected server-visible events. |
49
- | Determinism guard | `src/workflow/determinism.ts` records command, random, time, signal, query, and update streams and throws `WorkflowNondeterminismError` on replay mismatch. | Add async interleaving fuzz tests and query-mode negative tests. Query handlers must never read live time/randomness as a hidden side channel. |
50
- | Runtime guards | `src/workflow/guards.ts` patches `Date`, `Date.now`, `Math.random`, `crypto.randomUUID`, `crypto.getRandomValues`, `fetch`, timers, `performance.now`, `WebSocket`, `Bun.spawn`, and `Bun.nanoseconds`; `WorkflowExecutor` requires strict guards in production. | Release gate includes runtime guard tests, query guard matrix, workflow lint tests, async fuzz artifacts, and semantic-readiness evidence for Bun async/runtime behavior. |
51
- | Static workflow lint | `src/bin/lint-workflows-command.ts` walks workflow import graphs and denies unsafe imports/globals/member expressions. Tests cover `fetch`, `process.env`, captured `Date.now`, and importing client APIs from workflows. | Add rules for dangerous Promise/Effect escape hatches, dynamic eval/function creation, timers captured through aliases, and Bun runtime APIs not currently listed. Make release CI fail if configured workflow entries are missing. |
52
- | Replay | `src/workflow/replay.ts` ingests real histories, applies full/delta determinism markers, reconstructs command history, tracks updates, and diffs mismatch metadata. Stored fixtures currently cover timer, activity retry, and child/continue-as-new histories. | Scale from a small fixture set to a versioned corpus that covers every supported command/event pair, updates, signals, queries, cancellations, payload codecs, search attributes, memo, markers, failures, sticky replay, and old SDK versions. |
53
- | Integration | `tests/integration/**` covers history replay, activity lifecycle, query-only workflows, signal/query, workflow updates, payload codecs, client resilience, worker ops, schedules, and worker runtime behavior behind `TEMPORAL_INTEGRATION_TESTS=1`. | Split optional service-unavailable skips from release-blocking skips. In release CI, a missing dev server or unimplemented critical endpoint must fail instead of silently reducing coverage. |
54
- | Load | `tests/integration/load/**` submits CPU, activity, and update workflows, checks throughput, sticky hit ratio, and poll p95 latency, and writes JSONL/report artifacts. | Add duration mode, memory/heap samples, worker restart mode, Temporal endpoint interruption, sticky cache churn, and nightly/weekly soak thresholds. |
55
- | CI | `.github/workflows/temporal-bun-sdk.yml` builds, lints, tests, runs replay-corpus, async-fuzz, load, soak smoke, semantic production verification, and uploads release artifacts. | Add longer restart/chaos soak lanes before broadening support to new platforms, Temporal Server minors, or higher-throughput profiles. |
44
+ | Surface | Current implementation | Production gap to close |
45
+ | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
46
+ | Package boundary | `packages/temporal-bun-sdk/package.json` ships `dist`, `docs`, `skills`, and `README.md`; runtime dependencies are `@bufbuild/protobuf`, Connect, Effect, and TypeScript. `verify:production` runs `tests/packaging/manifest-packaging.test.ts`. | Keep this as a release gate and publish the result in a release manifest so agents can prove the package is not a Node/native wrapper. |
47
+ | Worker runtime | `src/worker/runtime.ts` owns config load, WorkflowService transport, workflow/activity pollers, sticky queues, deployment/build IDs, scheduler, metrics, plugins, graceful shutdown, determinism marker emission, and activity task lifecycle. | Add restart/chaos/soak scenarios for poll cancellation, sticky cache drift, task-not-found, heartbeat failure, tuner changes, and shutdown during active workflow/activity tasks. |
48
+ | Workflow execution | `src/workflow/executor.ts` runs registered workflows through Effect, creates `WorkflowCommandContext`, evaluates queries, processes updates, and materializes success/failure commands. | Add protocol golden tests that compare emitted commands and update protocol messages against captured histories and expected server-visible events. |
49
+ | Determinism guard | `src/workflow/determinism.ts` records command, random, time, signal, query, and update streams and throws `WorkflowNondeterminismError` on replay mismatch. | Add async interleaving fuzz tests and query-mode negative tests. Query handlers must never read live time/randomness as a hidden side channel. |
50
+ | Runtime guards | `src/workflow/guards.ts` patches `Date`, `Date.now`, `Math.random`, `crypto.randomUUID`, `crypto.getRandomValues`, `fetch`, timers, `performance.now`, `WebSocket`, `process.env`, `Bun.env`, `Bun.spawn`, `Bun.nanoseconds`, `Bun.sleep`, `Bun.file`, `Bun.write`, `Bun.connect`, and `Bun.serve`; `WorkflowExecutor` requires strict guards in production. | Release gate includes runtime guard tests, query guard matrix, workflow lint tests, async fuzz artifacts, and semantic-readiness evidence for Bun async/runtime behavior. |
51
+ | Static workflow lint | `src/bin/lint-workflows-command.ts` walks workflow import graphs and denies unsafe imports/globals/member expressions. Tests cover `fetch`, `process.env`, `Bun.env`, Bun timer/file/socket APIs, captured `Date.now`, and importing client APIs from workflows. | Add rules for timers captured through aliases and keep expanding adversarial workflow-isolation cases as Bun exposes new runtime APIs. Make release CI fail if configured workflow entries are missing. |
52
+ | Replay | `src/workflow/replay.ts` ingests real histories, applies full/delta determinism markers, reconstructs command history, tracks updates, and diffs mismatch metadata. Stored fixtures now cover the required replay feature tags, including signal/query/update, cancellation, search attributes, side effects, versioning, and workflow-task failure. | Scale from the current gate-passing replay corpus to a larger versioned corpus that covers every supported command/event pair, sticky replay variants, old SDK versions, and additional Temporal Server/Bun/platform rows. |
53
+ | Integration | `tests/integration/**` covers history replay, activity lifecycle, query-only workflows, signal/query, workflow updates, payload codecs, client resilience, worker ops, schedules, and worker runtime behavior behind `TEMPORAL_INTEGRATION_TESTS=1`. | Split optional service-unavailable skips from release-blocking skips. In release CI, a missing dev server or unimplemented critical endpoint must fail instead of silently reducing coverage. |
54
+ | Load/soak | `tests/integration/load/**` submits CPU, activity, and update workflows, checks throughput, sticky hit ratio, and poll p95 latency, and writes JSONL/report artifacts. `scripts/run-worker-soak.ts` wraps load iterations and now records baseline, worker-restart, sticky-cache-churn, update rejection/termination, and activity-cancellation smoke modes. | Add Temporal endpoint interruption, heartbeat RPC failure injection, and completed nightly/release soak evidence. |
55
+ | CI | `.github/workflows/temporal-bun-sdk.yml` builds, lints, tests, runs replay-corpus, async-fuzz, load, soak smoke, semantic production verification, and uploads release artifacts. | Add longer restart/chaos soak lanes before broadening support to new platforms, Temporal Server minors, or higher-throughput profiles. |
56
56
 
57
57
  ## Production Bar
58
58
 
@@ -124,8 +124,8 @@ Implementation:
124
124
  - `Effect.tryPromise` and `Effect.promise` in workflow handlers unless called
125
125
  through SDK-provided deterministic adapters;
126
126
  - captured unsafe globals through aliases;
127
- - `eval`, `Function`, dynamic import, and Bun runtime APIs beyond the current
128
- deny list.
127
+ - `eval`, `Function`, dynamic import, and Bun runtime APIs that expose live
128
+ environment, timer, filesystem, socket, subprocess, or server state.
129
129
  - Add a CLI gate that runs `temporal-bun lint-workflows` in strict JSON mode and
130
130
  writes `.artifacts/workflow-lint/report.json`.
131
131
 
@@ -235,12 +235,31 @@ Implementation:
235
235
  - force sticky cache eviction and drift rebuilds;
236
236
  - track task-not-found, nondeterminism, heartbeat retry/failure, activity
237
237
  failure, workflow failure, and sticky heal metrics.
238
- - Add `scripts/run-worker-soak.ts`.
238
+ - Harden `scripts/run-worker-soak.ts`.
239
239
  - Duration-mode wrapper around the load runner with stricter artifact
240
240
  validation.
241
- - Add `.github/workflows/temporal-bun-sdk-nightly.yml`.
241
+ - Current smoke mode records per-iteration load summaries, `memory.jsonl`,
242
+ RSS/heap slope summaries, and coverage for baseline, worker-restart,
243
+ sticky-cache-churn, update rejection/termination, and activity
244
+ cancellation.
245
+ - `tests/worker.task-queue-kind.test.ts` now directly holds normal workflow,
246
+ sticky workflow, and activity long-poll RPCs open and verifies worker
247
+ shutdown aborts every poll, flushes metrics, and reports a drained shutdown.
248
+ - `worker-restart` now shuts down the active worker runtime after workflow
249
+ submission, waits briefly, starts a replacement runtime on the same queue,
250
+ and records restart events in the load and soak reports.
251
+ - `activity-cancellation` cancels activity-heavy workflows while heartbeat
252
+ activities are running and records cancellation attempts, successful
253
+ cancellation calls, and terminal `CANCELED` workflow outcomes in the load
254
+ and soak reports.
255
+ - Remaining work is endpoint disconnect injection, heartbeat RPC failure
256
+ injection, and completing the long-running release lanes with passing
257
+ six-hour evidence.
258
+ - `.github/workflows/temporal-bun-sdk-nightly.yml` now provides the long-soak
259
+ lane.
242
260
  - Runs 2-hour soak nightly.
243
- - Runs 6-hour soak on release branch.
261
+ - Runs 6-hour soak in manual release mode.
262
+ - Uploads long-soak and readiness artifacts.
244
263
  - Allows longer manual soak before broadening platform or throughput support.
245
264
 
246
265
  Acceptance:
@@ -1,6 +1,6 @@
1
1
  # Temporal Bun SDK Semantic Readiness
2
2
 
3
- _Last updated: May 5, 2026_
3
+ _Last updated: May 6, 2026_
4
4
 
5
5
  ## Decision
6
6
 
@@ -46,18 +46,69 @@ choice only when:
46
46
  - every `semanticConcerns[]` entry with `defaultChoiceRequired: true` has
47
47
  `passed: true`.
48
48
 
49
+ `verify:production` must generate honest evidence even when the release is not
50
+ default-ready. `verify:default-choice` is the stricter release gate that fails
51
+ unless `agent-readiness.json` clears the default-choice threshold.
52
+
53
+ ## Neutral Review Blockers
54
+
55
+ A neutral ChatGPT release-gate review rejected the 0.9.1 evidence as
56
+ insufficient for default production choice. The durable blockers were:
57
+
58
+ - readiness JSON alone is self-attested unless it exposes inspectable raw
59
+ reports and coverage scope;
60
+ - three replay fixtures are not enough for Temporal determinism confidence;
61
+ - one-second soak and 64-workflow load evidence are smoke-level only;
62
+ - command/event compatibility needs a complete matrix, not a small golden test;
63
+ - Bun/JSC async fuzz needs generator scope, operation coverage, and a stronger
64
+ oracle;
65
+ - workflow isolation needs adversarial tests beyond linting and runtime guards;
66
+ - production deployment references need operational history, traffic, upgrade,
67
+ rollback, and incident evidence;
68
+ - default support remains scoped because this is not the official
69
+ Temporal-maintained SDK.
70
+
71
+ Current releases must leave `recommended: false` until these blockers are
72
+ materially closed. The replay corpus now includes 35 checked-in fixtures, 32 of
73
+ which are Temporal CLI dev-server captures, and the replay gate covers the
74
+ required replay feature tags. The async fuzz gate now records 10,000 seeds, 64
75
+ actual workflow operations per seed, full operation coverage, and a
76
+ replay/mutation oracle when run. The worker load gate now records 1,000
77
+ completed workflows, peak workflow concurrency 50, and CPU/activity/update
78
+ scenario coverage when run. The remaining default-choice blockers are soak
79
+ duration/iteration evidence and broader cross-version workflow-isolation/runtime
80
+ matrix evidence. Runtime guards and strict workflow lint now cover direct
81
+ `process.env`, `Bun.env`, `Bun.sleep`, `Bun.file`, `Bun.write`, `Bun.connect`,
82
+ and `Bun.serve` escape hatches in addition to the earlier time/random/network
83
+ guards. The publish workflow now runs `verify:default-choice` before npm
84
+ publication, and the evidence collector scans Jangar/Bumba source, deployment,
85
+ and observability references for production usage. A dedicated long-soak
86
+ workflow now provides scheduled nightly runs and a manual six-hour release mode.
87
+ The soak smoke report records baseline, worker-restart, sticky-cache-churn,
88
+ update rejection/termination, and activity-cancellation modes and writes
89
+ `memory.jsonl` with RSS/heap slope summaries. The `worker-restart` mode now
90
+ records a real post-submission runtime restart and replacement-worker drain
91
+ event. The `activity-cancellation` mode now requests cancellation of
92
+ activity-heavy workflows while heartbeat activities are running and requires
93
+ terminal `CANCELED` workflow outcomes, not only accepted cancellation RPCs.
94
+ The worker shutdown test now holds normal workflow, sticky workflow, and
95
+ activity long-poll RPCs open, then verifies shutdown aborts every poll and
96
+ drains the runtime.
97
+ Neither the smoke run nor workflow existence is a substitute for the six-hour
98
+ release soak report.
99
+
49
100
  ## Semantic Concern Matrix
50
101
 
51
- | Concern | Required evidence |
52
- | ------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
53
- | Pure Bun worker boundary | Package files, Dockerfile, package-boundary test, no forbidden Node/native deps. |
54
- | Deterministic replay | Replay fixtures, replay corpus report, replay engine tests, async fuzz artifact. |
55
- | Bun async semantics | Runtime guards, query guard matrix, workflow lint, 10k-seed async fuzz artifact. |
56
- | Temporal command protocol | Command materialization source, protocol golden tests, replay corpus verifier. |
57
- | Activity lifecycle | Activity lifecycle implementation, activity context tests, heartbeat/cancellation integration coverage, load artifact. |
58
- | Sticky cache and shutdown | Worker runtime, sticky-cache tests, worker runtime integration coverage, load and soak artifacts. |
59
- | Production usage | `services/jangar`, `services/bumba`, and Grafana Temporal worker observability references. |
60
- | Support contract | Support policy, agent adoption guide, and SDK comparison docs. |
102
+ | Concern | Required evidence |
103
+ | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
104
+ | Pure Bun worker boundary | Package files, Dockerfile, package-boundary test, no forbidden Node/native deps. |
105
+ | Deterministic replay | At least 25 replay fixtures with required feature-tag coverage, command-kind drift checks, replay corpus report, replay engine tests, async fuzz artifact. |
106
+ | Bun async semantics | Runtime guards including environment/Bun I/O escape hatches, query guard matrix, workflow lint, 10k-seed async fuzz artifact with operation coverage and at least 64 operations per seed. |
107
+ | Temporal command protocol | Command materialization source, command/event matrix, protocol golden tests, replay corpus verifier, and full compatibility evidence. |
108
+ | Activity lifecycle | Activity lifecycle implementation, activity context tests, heartbeat/cancellation integration coverage, load artifact. |
109
+ | Sticky cache and shutdown | Worker runtime, sticky-cache tests, worker runtime integration coverage, load artifact, long-soak workflow, memory-slope artifact, and passing release soak artifact. |
110
+ | Production usage | `services/jangar`, `services/bumba`, and Grafana Temporal worker observability references. |
111
+ | Support contract | Support policy, agent adoption guide, and SDK comparison docs. |
61
112
 
62
113
  ## Current Release Gate
63
114
 
@@ -70,10 +121,13 @@ bun run --cwd packages/temporal-bun-sdk lint:oxlint
70
121
  cd packages/temporal-bun-sdk && TEMPORAL_TEST_SERVER=1 bun test --timeout=30000 --max-concurrency=1
71
122
  bun run --filter @proompteng/temporal-bun-sdk verify:replay-corpus
72
123
  TEMPORAL_TEST_SERVER=1 bun run --filter @proompteng/temporal-bun-sdk test:load
73
- TEMPORAL_TEST_SERVER=1 bun run --filter @proompteng/temporal-bun-sdk test:soak -- --duration 1000 --workflows 16 --workflow-concurrency 4 --activity-concurrency 6
124
+ TEMPORAL_TEST_SERVER=1 bun run --filter @proompteng/temporal-bun-sdk test:soak -- --duration 21600000 --workflows 1000 --workflow-concurrency 50 --activity-concurrency 80 --failure-modes "${TEMPORAL_SOAK_FAILURE_MODES}"
74
125
  bun run --filter @proompteng/temporal-bun-sdk verify:production
126
+ bun run --filter @proompteng/temporal-bun-sdk verify:default-choice
75
127
  ```
76
128
 
77
129
  `verify:production` validates replay-corpus status, load thresholds, async fuzz
78
130
  seed count, soak status, CI workflow coverage, and the semantic concern matrix.
79
- It fails the release if any required concern is not evidenced.
131
+ It writes `recommended: false` with blockers when the default bar is not met.
132
+ `verify:default-choice` fails the release if any required concern is not
133
+ evidenced.
@@ -1,6 +1,6 @@
1
1
  # Temporal Bun SDK Support Policy
2
2
 
3
- _Last updated: May 5, 2026_
3
+ _Last updated: May 6, 2026_
4
4
 
5
5
  ## Supported Runtime Matrix
6
6
 
@@ -10,7 +10,7 @@ _Last updated: May 5, 2026_
10
10
  | Node | Build tooling only | The worker runtime is Bun TypeScript. Node is used by repository tooling and GitHub Actions setup, not by the published worker runtime. |
11
11
  | Temporal Server | Current CI cluster plus pinned dev server histories | Additional server minor/version coverage requires replay-corpus and integration evidence before being documented as preferred. |
12
12
  | Temporal Cloud | Client/worker TLS and mTLS paths are supported when credentials are configured. | Cloud Ops tests remain optional unless credentials are present. |
13
- | OS/arch | Linux arm64 in CI, local macOS development | Additional platforms require package-boundary, build, test, replay, and load evidence. |
13
+ | OS/arch | Linux x64 release CI, local macOS development | Additional platforms require package-boundary, build, test, replay, and load evidence. |
14
14
 
15
15
  ## Supported Package Boundary
16
16
 
@@ -47,6 +47,10 @@ async determinism fuzz, load, soak, CI coverage, package-boundary, and semantic
47
47
  concern evidence meet the default-choice thresholds in
48
48
  `docs/semantic-readiness.md`.
49
49
 
50
+ Default-choice evidence is intentionally stricter than publish evidence. A
51
+ release may publish with `recommended: false` so users can opt in, but agents
52
+ must not select it by default until `verify:default-choice` passes.
53
+
50
54
  ## Known Limits
51
55
 
52
56
  - This is a pure Bun SDK, not Temporal's official TypeScript SDK and not a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proompteng/temporal-bun-sdk",
3
- "version": "0.9.1",
3
+ "version": "0.10.0",
4
4
  "description": "Temporal SDK for Bun with workers, client, replay tooling, and Temporal Cloud/TLS support.",
5
5
  "keywords": [
6
6
  "bun",
@@ -82,9 +82,11 @@
82
82
  "test:load": "bun scripts/run-worker-load.ts",
83
83
  "test:soak": "bun scripts/run-worker-soak.ts",
84
84
  "evidence:production": "bun scripts/collect-production-evidence.ts",
85
+ "capture:replay-corpus": "bun scripts/capture-replay-corpus.ts",
85
86
  "verify:replay-corpus": "bun scripts/verify-replay-corpus.ts",
86
87
  "test:coverage": "bun test --coverage",
87
88
  "verify:production": "bun run evidence:production && bun test tests/packaging/manifest-packaging.test.ts",
89
+ "verify:default-choice": "TEMPORAL_REQUIRE_DEFAULT_CHOICE=1 bun run evidence:production && bun test tests/packaging/manifest-packaging.test.ts",
88
90
  "start:worker": "bun run dist/src/bin/start-worker.js",
89
91
  "temporal:start": "bun scripts/start-temporal-cli.ts",
90
92
  "temporal:stop": "bun scripts/stop-temporal-cli.ts",
@@ -93,15 +95,15 @@
93
95
  "lint:oxlint:type": "oxlint --config ../../.oxlintrc.json --type-aware --tsconfig ./tsconfig.oxlint.json --ignore-pattern tests ."
94
96
  },
95
97
  "dependencies": {
96
- "@bufbuild/protobuf": "^2.1.0",
97
- "@connectrpc/connect": "^2.1.0",
98
- "@connectrpc/connect-node": "^2.1.0",
98
+ "@bufbuild/protobuf": "^2.12.0",
99
+ "@connectrpc/connect": "^2.1.1",
100
+ "@connectrpc/connect-node": "^2.1.1",
99
101
  "@effect/schema": "^0.75.5",
100
- "effect": "^3.19.18",
101
- "typescript": "^5.9.3"
102
+ "effect": "^3.21.2",
103
+ "typescript": "^6.0.3"
102
104
  },
103
105
  "devDependencies": {
104
- "@types/node": "^22.7.5",
106
+ "@types/node": "^25.6.0",
105
107
  "bun-types": "^1.3.13"
106
108
  },
107
109
  "engines": {