fix(flow-producer): reject deduplication and debounce options (#2780)#4121
Open
mohanrajvenkatesan23-04 wants to merge 1 commit into
Open
Conversation
FlowProducer cannot honour deduplication or debounce: parent ids must be known before multi.exec() commits, but a dedup hit returns the existing job's id rather than the freshly generated one — orphaning the flow's children. The FlowJob type currently still permits these opts at the root, and they were silently dropped at runtime. Throw a clear error from add() and addBulk() instead. Per maintainer guidance on taskforcesh#2780: "we should throw an error in this case". - Add assertNoDeduplication() helper in flow-producer.ts - Call it at the top of add() and addBulk() - Add three regression tests in tests/flow.test.ts covering both opts on add() and the bulk path Closes taskforcesh#2780
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
FlowProducer.add()andaddBulk()silently droppedopts.deduplication/opts.debounce. A dedup hit returns the existing job's id rather than the freshly generated one, which orphans the flow's children — there is no safe way to reconcile the two ids inside the multi-exec transaction.Per maintainer @roggervalf on #2780:
Closes #2780.
What
src/classes/flow-producer.ts: file-privateassertNoDeduplication(flow)helper called at the top ofadd()andaddBulk(). Throws a clear error naming the offending queue/job.tests/flow.test.ts: three regression tests coveringdeduplicationonadd(),debounceonadd(), anddeduplicationmixed intoaddBulk().I left the
FlowJobtype alone for now — removingdebounce/deduplicationfrom the root type would be a TypeScript breaking change that warrants a separate decision. The runtime check covers JS users and any TS escape hatch.Test plan
tests/flow.test.tsadds three new cases under "when deduplication or debounce is provided to a flow"redis@7-alpine,valkey@8, anddragonflydb@latest