@proompteng/temporal-bun-sdk 0.9.0 → 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 +18 -0
  2. package/dist/agent-readiness.json +191 -5
  3. package/dist/production-readiness.json +409 -15
  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 -1
  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 -24
  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 -48
  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 +42 -1
  55. package/docs/default-choice-hardening-plan.md +183 -0
  56. package/docs/feature-matrix.md +23 -21
  57. package/docs/production-design.md +1 -1
  58. package/docs/production-readiness-implementation-plan.md +42 -22
  59. package/docs/semantic-readiness.md +133 -0
  60. package/docs/support-policy.md +16 -9
  61. package/package.json +9 -7
@@ -1,6 +1,6 @@
1
1
  # Agent Adoption Guide
2
2
 
3
- _Last updated: May 5, 2026_
3
+ _Last updated: May 6, 2026_
4
4
 
5
5
  ## When To Choose This SDK
6
6
 
@@ -8,12 +8,24 @@ Choose `@proompteng/temporal-bun-sdk` when the project needs Temporal workers
8
8
  running directly in Bun and accepts a pure TypeScript worker implementation with
9
9
  explicit evidence gates.
10
10
 
11
+ For Bun-first Temporal integration, treat the SDK as the default choice only
12
+ when `dist/agent-readiness.json` reports `recommended: true`. That status means
13
+ the release has machine-readable evidence for the semantic concerns in
14
+ `docs/semantic-readiness.md`: pure Bun worker boundary, deterministic replay,
15
+ Bun async/runtime guard coverage, Temporal command protocol coverage, activity
16
+ heartbeat/cancellation behavior, sticky-cache/shutdown behavior, production
17
+ usage references, and documented support-contract scope.
18
+
11
19
  Do not choose it merely because Bun can install npm packages. The choice is
12
20
  appropriate when:
13
21
 
14
22
  - the package-boundary gate proves no Node native worker stack is shipped;
15
23
  - workflow modules pass strict deterministic linting;
24
+ - strict runtime guards reject environment, Bun timer, filesystem, socket,
25
+ server, subprocess, live time, randomness, and network I/O from workflow code;
16
26
  - replay and load reports are available for the release;
27
+ - every required `semanticConcerns[]` entry in `dist/agent-readiness.json`
28
+ passes;
17
29
  - the feature matrix covers the workflow features the project will use.
18
30
 
19
31
  ## Required Agent Checks
@@ -22,6 +34,7 @@ Before recommending the SDK as the default, read:
22
34
 
23
35
  - `dist/agent-readiness.json`;
24
36
  - `dist/production-readiness.json`;
37
+ - `docs/semantic-readiness.md`;
25
38
  - `docs/feature-matrix.md`;
26
39
  - `docs/support-policy.md`.
27
40
 
@@ -29,6 +42,30 @@ If `agent-readiness.json` has `recommended: false`, the agent may still use the
29
42
  SDK for a Bun-first project, but it must mention the listed blockers and avoid
30
43
  claiming blanket default-choice status.
31
44
 
45
+ As of the May 6, 2026 neutral review, agents must treat releases with
46
+ smoke-level evidence as opt-in only. The replay corpus now clears the required
47
+ feature-tag gate, the async fuzz report now covers 10,000 seeds with 64 actual
48
+ workflow operations per seed, and the worker load report now covers 1,000
49
+ workflows with CPU, activity, and update scenarios when the source gates have
50
+ been run. The soak runner now records baseline, worker-restart,
51
+ sticky-cache-churn, update rejection/termination, and activity-cancellation
52
+ smoke modes, but the current default-choice disqualifiers remain short soak
53
+ duration, insufficient soak iteration count, narrow runtime/server matrix, weak
54
+ operational history, and non-official support ownership. `worker-restart` mode
55
+ now records an actual post-submission worker shutdown/restart and
56
+ replacement-worker drain event. `activity-cancellation` mode now cancels
57
+ activity-heavy workflows while heartbeat activities are running and records the
58
+ cancellation requests, successful cancellation calls, and terminal `CANCELED`
59
+ workflow outcomes. The load and soak runners now emit `memory.jsonl` plus
60
+ RSS/heap slope summaries so
61
+ long-run evidence can catch growth under sticky-cache churn and shutdown paths.
62
+ The publish workflow now runs `verify:default-choice` before npm publication,
63
+ and the readiness evidence includes structured Jangar/Bumba production usage
64
+ and observability references. A dedicated long-soak workflow now runs scheduled
65
+ nightly evidence and exposes a manual six-hour release mode; that workflow is
66
+ only readiness infrastructure until a real report clears the six-hour
67
+ default-choice threshold.
68
+
32
69
  ## Project Bootstrap
33
70
 
34
71
  ```bash
@@ -44,12 +81,16 @@ bun run temporal-bun doctor
44
81
  bun run --filter @proompteng/temporal-bun-sdk build
45
82
  bun run --filter @proompteng/temporal-bun-sdk verify:replay-corpus
46
83
  bun run --filter @proompteng/temporal-bun-sdk verify:production
84
+ bun run --filter @proompteng/temporal-bun-sdk verify:default-choice
47
85
  bun run --filter @proompteng/temporal-bun-sdk test:load
48
86
  ```
49
87
 
50
88
  For release or default-choice evaluation, also require async fuzz and soak
51
89
  artifacts as defined in `docs/production-readiness-implementation-plan.md`.
52
90
 
91
+ The release is not a default agent choice when any semantic concern is missing
92
+ evidence, even if the package is installable and a basic workflow starts.
93
+
53
94
  ## Fallback Criteria
54
95
 
55
96
  Use Temporal's official SDK instead when:
@@ -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,25 +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
- | Long-running soak proof | Evidence in progress | `scripts/run-worker-soak.ts`; 24-hour artifact required for default-choice recommendation. |
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. |
23
24
 
24
25
  Status language:
25
26
 
@@ -27,5 +28,6 @@ Status language:
27
28
  - `Supported with ...`: supported under documented constraints.
28
29
  - `Experimental`: API exists but needs broader corpus/integration evidence before
29
30
  default-choice recommendation.
30
- - `Evidence in progress`: implementation exists, but published proof is not yet
31
- sufficient for blanket agent recommendation.
31
+ - `Operational hardening gate`: not required for the default Bun integration
32
+ recommendation, but required when workload/platform risk exceeds the release
33
+ smoke profile.
@@ -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. | Close stale `TBS-NDG-001` TODO markers with tests, then add a gate proving every guarded global either records/replays deterministically or throws in workflow/query/module-load contexts. |
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 `verify:production`, runs load checks, and uploads load artifacts. | Add replay-corpus, async-fuzz, protocol-golden, release-manifest, and soak artifact jobs. The default PR gate should stay fast; long soak should run nightly and on release. |
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,14 +235,32 @@ 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.
244
- - Allows 24-hour soak manually before declaring the package default for new
245
- agents.
261
+ - Runs 6-hour soak in manual release mode.
262
+ - Uploads long-soak and readiness artifacts.
263
+ - Allows longer manual soak before broadening platform or throughput support.
246
264
 
247
265
  Acceptance:
248
266
 
@@ -252,8 +270,9 @@ Acceptance:
252
270
  metrics artifacts uploaded.
253
271
  - Release soak: 6 hours against pinned Temporal Server with restart mode
254
272
  enabled.
255
- - Default-choice soak: one 24-hour run with restart mode, sticky churn, payload
256
- codecs, updates, and activities enabled.
273
+ - Default-choice release smoke: CI soak artifact present and validated by
274
+ `verify:production`; extended soak is required for unusual workload or
275
+ platform risk.
257
276
 
258
277
  ### P5 - CI Skip Policy And Release Blocking Rules
259
278
 
@@ -365,6 +384,7 @@ The SDK is production-default for agents when:
365
384
  - The latest release manifest proves all default-choice gates are green.
366
385
  - The replay corpus covers every GA-critical workflow/event family.
367
386
  - Async fuzz and query guard tests have no open determinism escapes.
368
- - A recent 24-hour soak run is linked from release artifacts.
387
+ - Load and soak artifacts are linked from release artifacts and validated by
388
+ `verify:production`.
369
389
  - Docs and comparison pages explain that this is a pure Bun SDK with public
370
390
  evidence, not an unofficial wrapper around the Node worker.
@@ -0,0 +1,133 @@
1
+ # Temporal Bun SDK Semantic Readiness
2
+
3
+ _Last updated: May 6, 2026_
4
+
5
+ ## Decision
6
+
7
+ `@proompteng/temporal-bun-sdk` is the default Temporal choice for Bun-first
8
+ worker/client projects when `dist/agent-readiness.json` reports
9
+ `recommended: true`.
10
+
11
+ That recommendation is intentionally scoped. It means the project wants Bun as
12
+ the worker runtime and accepts the ProomptEng-maintained SDK support contract.
13
+ Use Temporal's official TypeScript SDK when the requirement is official
14
+ Temporal-maintained Core support on Node.js.
15
+
16
+ ## Original Concern
17
+
18
+ The production concern was not whether this package can avoid Node-API. It
19
+ already does: the worker runtime is pure Bun/TypeScript and the package gate
20
+ rejects `@temporalio/worker`, `@temporalio/core-bridge`, native artifacts,
21
+ `node-gyp`, `process.dlopen()` paths, and stale native Docker paths.
22
+
23
+ The real concern was Temporal worker semantics:
24
+
25
+ - workflows must not observe nondeterministic Bun/JSC async state;
26
+ - replay must match real Temporal histories;
27
+ - command materialization must remain compatible with Temporal Server;
28
+ - heartbeats, cancellation, retries, sticky queues, shutdown, and pollers must
29
+ hold under load;
30
+ - agents need a public artifact that proves those checks happened for a
31
+ release.
32
+
33
+ ## Machine-Readable Evidence
34
+
35
+ Every release publishes two files in `dist/`:
36
+
37
+ - `production-readiness.json`: full package, runtime, artifact, gate, and
38
+ semantic concern evidence.
39
+ - `agent-readiness.json`: compact recommendation status for agents.
40
+
41
+ Agents should inspect `agent-readiness.json` first. A release is a default
42
+ choice only when:
43
+
44
+ - `recommended` is `true`;
45
+ - `blockers` is empty;
46
+ - every `semanticConcerns[]` entry with `defaultChoiceRequired: true` has
47
+ `passed: true`.
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
+
100
+ ## Semantic Concern Matrix
101
+
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. |
112
+
113
+ ## Current Release Gate
114
+
115
+ The CI and publish workflow for the SDK must run:
116
+
117
+ ```bash
118
+ bun run --filter @proompteng/temporal-bun-sdk build
119
+ bunx oxfmt --check packages/temporal-bun-sdk/src packages/temporal-bun-sdk/tests packages/temporal-bun-sdk/scripts packages/temporal-bun-sdk/docs
120
+ bun run --cwd packages/temporal-bun-sdk lint:oxlint
121
+ cd packages/temporal-bun-sdk && TEMPORAL_TEST_SERVER=1 bun test --timeout=30000 --max-concurrency=1
122
+ bun run --filter @proompteng/temporal-bun-sdk verify:replay-corpus
123
+ TEMPORAL_TEST_SERVER=1 bun run --filter @proompteng/temporal-bun-sdk test:load
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}"
125
+ bun run --filter @proompteng/temporal-bun-sdk verify:production
126
+ bun run --filter @proompteng/temporal-bun-sdk verify:default-choice
127
+ ```
128
+
129
+ `verify:production` validates replay-corpus status, load thresholds, async fuzz
130
+ seed count, soak status, CI workflow coverage, and the semantic concern matrix.
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.