Skip to content

Resolve #2287: allow nested CQRS publishes to drain#2315

Merged
ayden94 merged 2 commits into
mainfrom
issue-2287-drain-nested-cqrs-publishes-retry
Jun 25, 2026
Merged

Resolve #2287: allow nested CQRS publishes to drain#2315
ayden94 merged 2 commits into
mainfrom
issue-2287-drain-nested-cqrs-publishes-retry

Conversation

@ayden94

@ayden94 ayden94 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Allow nested CQRS publish(...) and publishAll(...) calls from active handler/saga pipelines to continue draining after shutdown starts while continuing to reject brand-new external publishes.

Linked context: Closes #2287

Changes

  • Added an internal CQRS dispatch-context marker shared by saga and event-bus shutdown guards.
  • Track active publish drain contexts so only context-preserving nested publishes can run while the event bus is stopping.
  • Extended CQRS shutdown regression coverage for nested handler publishes, nested saga publishAll(...), and stale-context rejection.
  • Updated CQRS README and architecture docs in English/Korean, plus a patch changeset for @fluojs/cqrs.

Testing

  • pnpm exec biome check packages/cqrs/src/dispatch-context.ts packages/cqrs/src/buses/event-bus.ts packages/cqrs/src/buses/saga-bus.ts packages/cqrs/src/module.test.ts packages/cqrs/README.md packages/cqrs/README.ko.md docs/architecture/cqrs.md docs/architecture/cqrs.ko.md .changeset/tame-cqrs-drain.md
  • pnpm --filter @fluojs/cqrs... build
  • pnpm --filter @fluojs/cqrs typecheck
  • pnpm --filter @fluojs/cqrs test
  • pnpm docs:sync-check
  • pnpm verify:platform-consistency-governance
  • pnpm verify:changeset-release-lane
  • pnpm verify:release-readiness was attempted; it failed in unrelated existing/infra-sensitive suites (packages/cron/src/optional-redis-peer.test.ts timeout and packages/testing/src/surface.test.ts timeout/unhandled rejection while rebuilding @fluojs/di against missing @fluojs/core declarations).

Release impact

  • This PR has consumer-visible release impact and includes a changeset.
  • This PR has no consumer-visible release impact.

Public export documentation

  • Changed public exports include a source-level summary.
  • Changed exported functions document matching @param / @returns tags where applicable.
  • Source @example blocks and README scenario examples still play complementary roles.

Behavioral contract

  • No documented behavioral contracts were removed without migration notes.
  • New behavioral contracts are documented in the affected package README.
  • Intentional limitations are explicitly stated (not silently removed).
  • Runtime invariants are covered by regression tests.

Platform consistency governance (SSOT)

  • SSOT English/Korean mirror structure remains synchronized for changed governance docs.
  • If platform contract docs changed, companion updates include discoverability/docs index, tooling or CI enforcement, and regression-test evidence.
  • Any package README alignment/conformance claims are backed by createPlatformConformanceHarness(...) tests.

@ayden94 ayden94 merged commit 592320d into main Jun 25, 2026
10 checks passed
@github-actions github-actions Bot mentioned this pull request Jun 24, 2026
@ayden94 ayden94 deleted the issue-2287-drain-nested-cqrs-publishes-retry branch June 25, 2026 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[audit][area:infra-messaging] Allow nested CQRS publishes to drain during shutdown (P1)

1 participant