Skip to content

fix(workflow): honor definition 'enabled' flag on upsert - #2956

Open
flaukowski wants to merge 1 commit into
block:mainfrom
flaukowski:upstream-workflow-enabled
Open

fix(workflow): honor definition 'enabled' flag on upsert#2956
flaukowski wants to merge 1 commit into
block:mainfrom
flaukowski:upstream-workflow-enabled

Conversation

@flaukowski

@flaukowski flaukowski commented Jul 26, 2026

Copy link
Copy Markdown

upsert_workflow's ON CONFLICT DO UPDATE sets name/definition/definition_hash but never enabled. Re-publishing a kind:30620 workflow definition with enabled: false therefore updates the stored JSON while leaving the row's enabled column TRUE — a disabled scheduled workflow keeps firing.

This parses enabled from the definition (WorkflowDef.enabled, default true) and applies it on both insert and update. Minimal, contained to the DB helper; no signature change.

Found while disabling a scheduled workflow via a re-published definition.

Related work

#1593 reports workflows that "keep firing on their cron schedules and cannot be disabled", and attributes it to orphan rows created before #1369, stating that after the d-tag upsert landed "all new operations behave correctly".

That is still not true for the disable path on current main, for a separate reason: the upsert's ON CONFLICT DO UPDATE never writes the enabled column, so re-publishing a definition with enabled: false updates the JSON and leaves the row enabled. No orphan row required — this reproduces on a workflow created today.

This PR fixes that half. #1593's orphan reconciliation (and its point 2, surfacing side-effect failures) is still needed for the legacy rows.

Rebased onto current main; cargo clippy -p buzz-db is clean.

@flaukowski
flaukowski requested a review from a team as a code owner July 26, 2026 07:01
@flaukowski
flaukowski force-pushed the upstream-workflow-enabled branch from fd14710 to bf64c0d Compare July 28, 2026 19:24
upsert_workflow's ON CONFLICT DO UPDATE set name/definition/hash but never
enabled, so re-publishing a kind:30620 definition with enabled: false changed
the stored JSON while leaving the row enabled=TRUE — a disabled workflow kept
firing on its schedule. Parse enabled from the definition and apply it on both
insert and update.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: flaukowski <[email protected]>
(cherry picked from commit 96e1688)
@flaukowski
flaukowski force-pushed the upstream-workflow-enabled branch from bf64c0d to 8de1cce Compare July 28, 2026 23:43
@flaukowski

Copy link
Copy Markdown
Author

@tlongwell-block — flagging this your way as the most recent author of buzz-db/src/workflow.rs.

Rebased onto current main today; cargo clippy -p buzz-db is clean.

Worth surfacing since it may raise the priority: this is a still-live half of #1593. That issue concludes that after #1369's d-tag upsert landed, "all new operations behave correctly" — but disable-via-redefinition is still a no-op on current main, for an unrelated reason: the upsert's ON CONFLICT DO UPDATE sets name/definition/definition_hash but never enabled. No legacy orphan row required; it reproduces on a workflow created today, which is how we hit it. #1593's orphan reconciliation is still separately needed for the pre-#1369 rows.

CI is at action_required and needs a maintainer to approve the run.

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.

1 participant