]> Piment Noir Git Repositories - poolifier.git/commit
fix!: correct task lifecycle and type export bugs (#3360)
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Sun, 18 Oct 2026 17:59:07 +0000 (19:59 +0200)
committerGitHub <noreply@github.com>
Sun, 18 Oct 2026 17:59:07 +0000 (19:59 +0200)
commit4fdd74fb09443761900fd95eb5e854d0d479318b
tree471473a5dfdf1a329110824be4c9aad5f978d3ee
parent14ab8cfdcf2d1cd8076807f65e86736004d110da
fix!: correct task lifecycle and type export bugs (#3360)

* fix: correct task lifecycle and type export bugs

* test(types): isolate declaration probes from runtime coverage

* fix(pool): synchronize replacement task function replay

* fix: settle task function operations when workers exit

* fix: retire worker message listeners before node removal

* fix: preserve operation cohorts and replay readiness

* [autofix.ci] apply automated fixes

* fix: preserve task defaults and assimilate foreign promises

Restore acknowledged defaults before readiness and preserve empty-cohort no-op semantics. Bound replay listeners with sequential operations and stable worker identity. Normalize foreign promises and thenables across tasks, cancellation and cleanup without changing protected execution contracts.

* fix: snapshot and serialize task function mutations

Adapt relevant fixes from poolifier-web-worker#196 without replacing Node lifecycle handling.

Normalize decorated native promises and avoid constructing weights when counting retries.

* fix: complete task lifecycle port and replay guarantees

* fix: normalize async results and thenables

* fix: skip unready weighted workers

* fix: keep terminating replay workers unready

* [autofix.ci] apply automated fixes

* build: align ECMAScript target with ES2024 lib

* build: align TypeScript examples with ES2024

* docs: clarify user-facing task lifecycle rules

* fix: preserve task function mutation and result contracts

* fix: preserve queued operation identity and abortable results

* docs: align task function signatures with thenable support

* fix: scope bootstrap failures by worker affinity

* fix!: preserve task operation and strategy invariants

Reject lost operation identity without releasing live cohorts early.
Keep ready peers' strategies registered during worker replay.

BREAKING CHANGE: deferred custom operation handlers must retain request
UUIDs or the original task-function properties reference. Replies without
recoverable identity reject instead of leaving changes pending.

* fix: preserve buffered task function operation results

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
38 files changed:
README.md
docs/api.md
docs/worker-choice-strategies.md
examples/typescript/http-client-pool/tsconfig.json
examples/typescript/http-server-pool/express-cluster/tsconfig.json
examples/typescript/http-server-pool/express-hybrid/tsconfig.json
examples/typescript/http-server-pool/express-worker_threads/tsconfig.json
examples/typescript/http-server-pool/fastify-cluster/tsconfig.json
examples/typescript/http-server-pool/fastify-hybrid/tsconfig.json
examples/typescript/http-server-pool/fastify-worker_threads/tsconfig.json
examples/typescript/smtp-client-pool/tsconfig.json
examples/typescript/websocket-server-pool/ws-cluster/tsconfig.json
examples/typescript/websocket-server-pool/ws-hybrid/tsconfig.json
examples/typescript/websocket-server-pool/ws-worker_threads/tsconfig.json
package.json
pnpm-lock.yaml
rollup.config.mjs
src/pools/abstract-pool.ts
src/pools/pool.ts
src/pools/selection-strategies/selection-strategies-utils.ts
src/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.ts
src/pools/worker-node.ts
src/utility-types.ts
src/worker/abstract-worker.ts
src/worker/cluster-worker.ts
src/worker/task-functions.ts
src/worker/thread-worker.ts
src/worker/worker-options.ts
tests/declarations.test.mjs [new file with mode: 0644]
tests/pools/abstract-pool.test.mjs
tests/pools/task-function-replay.test.mjs [new file with mode: 0644]
tests/pools/task-lifecycle.test.mjs [new file with mode: 0644]
tests/pools/worker-exit.test.mjs
tests/worker-files/cluster/legacyTaskFunctionWorker.mjs [new file with mode: 0644]
tests/worker-files/thread/bootstrapAffinityWorker.mjs
tests/worker-files/thread/taskLifecycleWorker.mjs [new file with mode: 0644]
tsconfig.build.json
tsconfig.json