Skip to content

[Workflows] Add workflowName and schedule to WorkflowEvent#6781

Merged
danlapid merged 2 commits into
mainfrom
osilva/WOR-1221
May 26, 2026
Merged

[Workflows] Add workflowName and schedule to WorkflowEvent#6781
danlapid merged 2 commits into
mainfrom
osilva/WOR-1221

Conversation

@pombosilva
Copy link
Copy Markdown
Contributor

Adds two fields to WorkflowEvent:

  • workflowName: string — name of the workflow the event belongs to
  • schedule?: WorkflowCronSchedule — present when the instance was triggered by a cron schedule
    Also adds the new WorkflowCronSchedule type (cron, scheduledTime).
export class MyWorkflow extends WorkflowEntrypoint<Env, Params> {
  async run(event: WorkflowEvent<Params>, step: WorkflowStep) {
    console.log(event.workflowName); // e.g. "my-workflow"
    if (event.schedule) {
      console.log(event.schedule.cron);          // "0 * * * *"
      console.log(event.schedule.scheduledTime); // 1737000000000
    }
  }
}

Copy link
Copy Markdown
Contributor

@ask-bonk ask-bonk Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm Bonk, and I've done a quick review of your PR.

Adds WorkflowCronSchedule type and two new fields (workflowName, schedule) to WorkflowEvent.

Issues (ranked by severity):

  1. [LOW] generated-snapshot/ appears hand-editedtypes/AGENTS.md states: "Do not edit files in generated-snapshot/ directly — they are overwritten by just generate-types." Please verify the snapshots were regenerated with just generate-types rather than manually edited. CI will reject a mismatch, but running the generator also ensures the blank-line formatting between WorkflowStepConfig and WorkflowCronSchedule in the snapshots matches what the pipeline actually produces (the defines/ source has a blank line separator that the snapshots lack).

  2. [LOW] No type tests for new typestypes/test/types/rpc.ts has tests for WorkflowStep but none for WorkflowEvent. Adding a basic compile-time check for the new fields (workflowName, schedule, WorkflowCronSchedule) would catch regressions.


This review was generated by an AI assistant and may contain inaccuracies.

Comment thread types/defines/rpc.d.ts
@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented May 25, 2026

Review posted successfully on PR #6781. Here's a summary of the findings:

  1. [LOW] generated-snapshot/ appears hand-edited — The snapshot files should be regenerated with just generate-types rather than manually edited. There's a formatting discrepancy (blank line spacing) between the defines/ source and the snapshots that suggests manual editing.

  2. [LOW] No type tests — No compile-time type tests were added for the new WorkflowCronSchedule type or the new WorkflowEvent fields in types/test/types/rpc.ts.

  3. [LOW] Missing JSDoc — Suggested adding a JSDoc comment to scheduledTime to clarify it's epoch milliseconds, since other scheduledTime fields in the codebase are typed as Date in some contexts and number in others.

Overall this is a clean, additive change with no backward compatibility concerns. All issues are low severity.

github run

@pombosilva pombosilva marked this pull request as ready for review May 25, 2026 14:09
@pombosilva pombosilva requested review from a team as code owners May 25, 2026 14:09
@danlapid danlapid merged commit b0c9335 into main May 26, 2026
25 of 27 checks passed
@danlapid danlapid deleted the osilva/WOR-1221 branch May 26, 2026 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants