Skip to content

Commit f021d98

Browse files
fix(project): include trigger reply fields in version hash
Signed-off-by: Asish Kumar <officialasishkumar@gmail.com>
1 parent dd3b889 commit f021d98

3 files changed

Lines changed: 47 additions & 1 deletion

File tree

.changeset/quiet-seals-battle.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@openfn/project': patch
3+
'@openfn/cli': patch
4+
---
5+
6+
Include `webhook_reply` and `cron_cursor_job_id` in workflow version hashes.

packages/project/src/util/version.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,13 @@ export const generateHash = (
5454
'body',
5555
].sort();
5656

57-
const triggerKeys = ['type', 'cron_expression', 'enabled'].sort();
57+
const triggerKeys = [
58+
'type',
59+
'cron_expression',
60+
'enabled',
61+
'webhook_reply',
62+
'cron_cursor_job_id',
63+
].sort();
5864

5965
const edgeKeys = [
6066
'name', // generated

packages/project/test/util/version-workflow.test.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,40 @@ test('hash a trigger', (t) => {
384384
t.not(generateHash(webhook), generateHash(cronExpression));
385385
});
386386

387+
test('hash changes when webhook_reply changes', (t) => {
388+
const wf1 = generateWorkflow(
389+
`@name wf-1
390+
@id workflow-id
391+
t(type=webhook,webhook_reply=x)-x
392+
`
393+
);
394+
const wf2 = generateWorkflow(
395+
`@name wf-1
396+
@id workflow-id
397+
t(type=webhook,webhook_reply=y)-x
398+
`
399+
);
400+
401+
t.not(generateHash(wf1), generateHash(wf2));
402+
});
403+
404+
test('hash changes when cron_cursor_job_id changes', (t) => {
405+
const wf1 = generateWorkflow(
406+
`@name wf-1
407+
@id workflow-id
408+
t(type=cron,cron_expression="1",cron_cursor_job_id=x)-x
409+
`
410+
);
411+
const wf2 = generateWorkflow(
412+
`@name wf-1
413+
@id workflow-id
414+
t(type=cron,cron_expression="1",cron_cursor_job_id=y)-x
415+
`
416+
);
417+
418+
t.not(generateHash(wf1), generateHash(wf2));
419+
});
420+
387421
test('hash changes across an edge', (t) => {
388422
const basicEdge = generateWorkflow(
389423
`

0 commit comments

Comments
 (0)