feat(wrangler): introspect workflow with test harness#14438
Conversation
🦋 Changeset detectedLatest commit: 4b12b7f The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 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 |
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
|
Review posted successfully to PR #14438. Summary of my review:
|
|
✅ All changesets look good |
@cloudflare/autoconfig
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
| async modifyAll(fn: ModifierCallback): Promise<void> { | ||
| const sessionId = this.getSessionId(); | ||
| await fn(new WorkflowInstanceModificationRecorder(this.#operations)); | ||
| await this.workflow.unsafeSetIntrospectionOperations( | ||
| sessionId, | ||
| this.#operations | ||
| ); | ||
| } |
There was a problem hiding this comment.
🚩 Operations accumulate across multiple modifyAll calls rather than replacing
Each modifyAll call creates a new WorkflowInstanceModificationRecorder wrapping the same #operations array (packages/workflows-shared/src/introspection.ts:152). Operations pushed by the callback accumulate, and the full array is sent to the remote via unsafeSetIntrospectionOperations, which replaces (session.operations = operations at packages/workflows-shared/src/binding.ts:272). This means a second modifyAll call includes all operations from the first call. Current test usage only calls modifyAll once per introspector, so the accumulation pattern isn't exercised. If a user calls modifyAll twice expecting replacement semantics, they'd get unexpected duplication of operations like disableSleeps. This is a design choice rather than a bug, but the behavior isn't documented.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
I think it is the same behavior before this change.
Fixes n/a.
This adds Workflow introspection to
createTestHarness()A picture of a cute animal (not mandatory, but encouraged)