Skip to content

fix(project): include trigger reply fields in version hash#1362

Open
officialasishkumar wants to merge 1 commit intoOpenFn:mainfrom
officialasishkumar:fix/version-hash-trigger-keys
Open

fix(project): include trigger reply fields in version hash#1362
officialasishkumar wants to merge 1 commit intoOpenFn:mainfrom
officialasishkumar:fix/version-hash-trigger-keys

Conversation

@officialasishkumar
Copy link
Copy Markdown

@officialasishkumar officialasishkumar commented Apr 9, 2026

Description

This keeps the project-side workflow version hash aligned with Lightning by including webhook_reply and cron_cursor_job_id in the trigger field list used by generateHash().

Without this, the CLI can compute a different hash from Lightning for the same workflow after those trigger fields change.

Changes

  • include webhook_reply and cron_cursor_job_id in packages/project/src/util/version.ts
  • add regression tests covering both trigger fields in packages/project/test/util/version-workflow.test.ts
  • add a changeset so the fix is released through the monorepo flow

Companion to OpenFn/lightning#4599.

AI Usage

Used only for research.

Copy link
Copy Markdown
Collaborator

@josephjclark josephjclark left a comment

Choose a reason for hiding this comment

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

Thank you @officialasishkumar! This is cool. Just a couple of tidy ups before I can merge it

'@openfn/cli': patch
---

Include `webhook_reply` and `cron_cursor_job_id` in workflow version hashes so CLI deploy stays aligned with Lightning.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You need to remove the "stay aligned with Lightnig bit" - this PR is just adding support for extra keys in the version hash, that's it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Removed that wording in f021d98.

`
);

(wf1.steps[0] as any).openfn.webhook_reply = 'before_start';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Instead of this awkward assignment, you can do this in the workflow generator - that's exactly what's it for!

 generateWorkflow(
    ` @id wf1
    t(type=webhook,webhook_reply=before_start)-x
    `

Please also make sure you're generating the absolute minimal keys on the workflow so that it doesn't distract the test code. We shouldn't need an expression on x for example

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Moved this into the workflow generator and trimmed the test setup in f021d98.

`@name wf-1
@id workflow-id
t(type=cron,cron_expression="1")-a
a-b
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You shouldn't need the a-b nodes here at all right? Better to clean that up and keep the tests simple

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Removed the extra nodes and kept the test minimal in f021d98.

const [trigger1, jobA1] = wf1.steps as any[];
const [trigger2, , jobB2] = wf2.steps as any[];

trigger1.openfn.cron_cursor_job_id = jobA1.openfn.uuid;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Again you can do this straight in workflow generation. It doesn't need to be logically consistent either- you can just set the value to x or y, rather than digging out the actual uuids like this

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Changed this to literal x and y values in the generated workflow in f021d98.

@josephjclark
Copy link
Copy Markdown
Collaborator

Oh and @officialasishkumar we like contributors to disclose AI usage in some way so that everyone knows where we stand. We have a checkbox for this in the PR template. Can you update the PR description to at least say "I have used AI to generate this PR"?

I've updated the PR description to remove the weird validation stuff. It's enough in this case that tests are passing in CI

@officialasishkumar
Copy link
Copy Markdown
Author

Hi @josephjclark , yes, i have used AI in research and understanding the codebase

Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
@officialasishkumar officialasishkumar force-pushed the fix/version-hash-trigger-keys branch from 242e36c to f021d98 Compare April 10, 2026 14:06
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.

2 participants