Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/quiet-seals-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@openfn/project': patch
'@openfn/cli': patch
---

Include `webhook_reply` and `cron_cursor_job_id` in workflow version hashes.
8 changes: 7 additions & 1 deletion packages/project/src/util/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,13 @@ export const generateHash = (
'body',
].sort();

const triggerKeys = ['type', 'cron_expression', 'enabled'].sort();
const triggerKeys = [
'type',
'cron_expression',
'enabled',
'webhook_reply',
'cron_cursor_job_id',
].sort();

const edgeKeys = [
'name', // generated
Expand Down
34 changes: 34 additions & 0 deletions packages/project/test/util/version-workflow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,40 @@ test('hash a trigger', (t) => {
t.not(generateHash(webhook), generateHash(cronExpression));
});

test('hash changes when webhook_reply changes', (t) => {
const wf1 = generateWorkflow(
`@name wf-1
@id workflow-id
t(type=webhook,webhook_reply=x)-x
`
);
const wf2 = generateWorkflow(
`@name wf-1
@id workflow-id
t(type=webhook,webhook_reply=y)-x
`
);

t.not(generateHash(wf1), generateHash(wf2));
});

test('hash changes when cron_cursor_job_id changes', (t) => {
const wf1 = generateWorkflow(
`@name wf-1
@id workflow-id
t(type=cron,cron_expression="1",cron_cursor_job_id=x)-x
`
);
const wf2 = generateWorkflow(
`@name wf-1
@id workflow-id
t(type=cron,cron_expression="1",cron_cursor_job_id=y)-x
`
);

t.not(generateHash(wf1), generateHash(wf2));
});

test('hash changes across an edge', (t) => {
const basicEdge = generateWorkflow(
`
Expand Down