Repository navigation
[miniflare] Add workflow introspection for exported Workflows - #17016
edmundhung wants to merge 2 commits into
Conversation
🦋 Changeset detectedLatest commit: 7920aae The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 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 |
@cloudflare/autoconfig
@cloudflare/build-output-utils
@cloudflare/codemods
@cloudflare/config
@cloudflare/containers-shared
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-functions
@cloudflare/pages-shared
@cloudflare/runtime-types
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-plugin
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
| if (workflowIntrospectionSessions.has(this.env.WORKFLOW_NAME)) { | ||
| throw new Error( | ||
| `Workflow ${JSON.stringify(this.env.WORKFLOW_NAME)} already has an active introspection session for binding ${JSON.stringify(this.env.BINDING_NAME)}.` | ||
| `Workflow ${JSON.stringify(this.env.WORKFLOW_NAME)} already has an active introspection session.` |
There was a problem hiding this comment.
Dropping the binding name here as an introspection session is started per workflow instead of per binding. It would also be confusing as more users adopts exports which might not have an binding anymore.
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
There was a problem hiding this comment.
Superseded by the review of
7920aaed.
This review, of 161ab5dd
✅ Approved — No issues found. The new exported-Workflow introspection methods are small and checked against the Worker's exports, and they come with tests.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
🔒 Security: ✅ LGTM
No issues found.
📖 AGENTS.md: ✅ LGTM
No issues found.
📋 Code Quality: ✅ LGTM
No issues found.
⚡ Performance: ✅ LGTM
No issues found.
📝 Documentation: ✅ LGTM
No issues found.
Reviewed commit: 161ab5dd
…owInstance() for exported Workflows Node.js could only introspect a Workflow through an `env` binding from getBindings(), so a Workflow only on `ctx.exports` couldn't be introspected. Each exported Workflow now has a proxy binding, found by its Worker and class name.
161ab5d to
7920aae
Compare
There was a problem hiding this comment.
✅ Approved — No issues found. The new exported-Workflow introspection methods are small and checked against the Worker's exports, and they come with tests.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
🔒 Security: ✅ LGTM
No issues found.
📖 AGENTS.md: ✅ LGTM
No issues found.
📋 Code Quality: ✅ LGTM
No issues found.
⚡ Performance: ✅ LGTM
No issues found.
📝 Documentation: ✅ LGTM
No issues found.
Reviewed commit: 7920aaed — same changes as 161ab5dd, so this is that commit's review (no new review was run; line numbers are as of 161ab5dd)
Part of RM-31812. The cf test harness (#16798) is stacked on this.
Adds
unsafeIntrospectWorkflow(workerName, className)andunsafeIntrospectWorkflowInstance(workerName, className, instanceId), so Node.js code can introspect a Workflow that a Worker exports, including one only onctx.exports, without anenvbinding. Introspection through a binding, as in the Vitest plugin, is unchanged.unsafeMiniflare methods for the cf test harness