fix(workflow-engine-redis): support top-level module options in loader - #16740
fix(workflow-engine-redis): support top-level module options in loader#16740Tyagiquamar wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 8fca432 The changes in this PR will be included in the next version bump. This PR includes changesets to release 83 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Thanks for the contribution! Initial automated review looks good. The author fixes a mismatch between the TypeScript module-options type (RedisWorkflowsOptions, which declares top-level fields like redisUrl) and the runtime loader (which only read from the nested options.redis object). The fix adds a one-line fallback: redisConfig = options?.redis ?? options ?? {}. Nested config continues to take priority for backward compatibility; top-level config now works as well. A redis?: RedisWorkflowsOptions field is added to the type to make the legacy nested format type-safe. The error message is updated to reflect both paths, and unit tests cover top-level config, shared queue/worker options, per-queue overrides, and missing-URL errors for both config shapes. PR template is complete, the issue is verified and open, a correctly-formatted patch changeset is included, and no security, performance, or correctness issues were found. Heads up: PR #16698 (opened 2026-09-02) also references issue #16697 and was opened earlier; if #16698 (or #16699, #16730, #16736) is merged first, this PR may be closed as a duplicate. Triggered by: new PR opened |
|
Hi, friendly ping for review on this PR when you have a moment. Happy to address any feedback. Thanks! |
What
This PR updates the Redis Workflow Engine module loader (
packages/modules/workflow-engine-redis/src/loaders/redis.ts) to read options from top-level module configuration (options) in addition to the legacy nestedoptions.redisobject. It also adds an optionalredis?: RedisWorkflowsOptionsfield toRedisWorkflowsOptionsfor full backwards compatibility.Why
Closes #16697.
Module options declared via
declare module "@medusajs/types"define top-level configuration options (e.g.options: { redisUrl: "...", queueOptions: { ... } }), matching the module options pattern used across other infrastructure modules (such as@medusajs/event-bus-redisand@medusajs/cache-redis).Previously, the runtime loader only destructured
options?.redis, causing top-level options to be ignored and throwing an error indicating that noredisUrlwas provided even when properly configured according to the TypeScript types.How
packages/modules/workflow-engine-redis/src/loaders/redis.ts, resolveredisConfigasoptions?.redis ?? options ?? {}.No \redisUrl` (or deprecated `redis.redisUrl` / `url`) provided in `workflowOrchestrator` module options.`.redis?: RedisWorkflowsOptionsintypes/index.tsso legacy nested configurations remain type-safe.redis.spec.tscovering top-level configuration, per-queue overrides, and missing-URL validation.@medusajs/workflow-engine-redis.Testing
packages/modules/workflow-engine-redis/src/loaders/__tests__/redis.spec.tsverifying:redisUrland shared queue/worker options resolution