workflows: rollback types#6766
Conversation
There was a problem hiding this comment.
I'm Bonk, and I've done a quick review of your PR.
This PR adds TypeScript types for Workflow step.do() rollback options (WorkflowRollbackContext, WorkflowRollbackHandler, WorkflowStepRollbackOptions).
Issues
-
[MEDIUM]
WorkflowStepRollbackOptions<T>generic not threaded throughdo()overloads — TheWorkflowStepRollbackOptionstype accepts a genericTthat flows toWorkflowRollbackContext<T>.output, but bothdo()overloads use the bareWorkflowStepRollbackOptions(defaultingTtounknown). This meansctx.outputin the rollback handler is alwaysunknown, even though the step's return typeTis known. Users will have to castoutputmanually, which defeats the purpose of the generic. See inline suggestion. -
[LOW] Type tests assert
outputisunknown— masks issue #1 — The type tests currently assertctx.outputisunknown, which passes but only because the generic isn't wired through. If/when you fix issue #1, the tests for the first overload should assert the inferred type (e.g.,string), which would catch any future regression.
These comments were generated by an AI code reviewer and may not be perfect. Please use your judgment when evaluating them.
|
I've posted a review on PR #6766 with 2 findings:
|
Merging this PR will not alter performance
Comparing Footnotes
|
|
/bonk review |
There was a problem hiding this comment.
Previous review findings have all been addressed — WorkflowStepRollbackOptions<T> is now correctly threaded through both do() overloads, and the type tests assert string | undefined instead of unknown.
Remaining findings:
-
[LOW] No backward-compatibility test for
do()without rollback options — All three test cases pass a rollback options object (even{}). Consider adding a test that callsdo()without the trailing parameter to verify the existing API shape still works. -
[LOW] Separate
import typestatement —import type {WorkflowStep}on line 12 could be folded into the existing import block on lines 5-11 using inlinetypesyntax (import { ..., type WorkflowStep }) to reduce import clutter.
These comments were generated by an AI code reviewer and may not be perfect. Please use your judgment when evaluating them.
|
I've posted a review on PR #6766 with 2 findings:
The previous review's MEDIUM finding (generic |
b1e522d to
4a51e89
Compare
|
/bonk review |
There was a problem hiding this comment.
All findings from previous reviews have been addressed:
- [RESOLVED] Generic
Tthreaded through bothdo()overloads —WorkflowStepRollbackOptions<T>now correctly propagates the callback's return type toctx.outputin the rollback handler. - [RESOLVED] Type tests updated to assert
string | undefinedinstead ofunknown. - [RESOLVED] Backward-compatibility tests added for
do()without rollback options (both 2-arg and 3-arg forms). - [RESOLVED] Import merged into single block using inline
typesyntax.
No new findings. The type definitions are correct, overloads are unambiguous, generated snapshots are consistent across all four files, and test coverage is thorough. The ChatCompletionsInput -> ChatCompletionsBase change in the snapshots is an expected artifact of regeneration against the current main branch.
These comments were generated by an AI code reviewer and may not be perfect. Please use your judgment when evaluating them.
|
I've posted a review on PR #6766 with no new findings. All issues from the two previous reviews have been addressed:
The PR is clean — type definitions are correct, overloads are unambiguous, snapshots are consistent, and test coverage is thorough. It has approvals from both |
Adds Workers types for optional
step.do(name, config?, callback, { rollback, rollbackConfig })Workflow rollback options.