BaryoDev / BaryoDev/barakoCMS

Workflows: a scheduled sweep starts one run per entry, so definitions stay flat

Open
#909 0 comments 0 reactions 0 assignees View on GitHub
core design
Dominant language
C#
Stars
6
Forks
7
Avg merge
4h 42m
Merged PRs (30d)
307

Description

#835 plans a `forEach` step with inner steps inside a workflow definition. D19 (`DECISIONS.md:718`) says a workflow definition stays data, and attempts are indexed by ordinal with the idempotency key `{run}-{ordinal}` and parameters snapshotted per action (`barakoCMS/Features/Workflows/WorkflowRunQueue.cs:113-119`). Inner steps per item do not fit that shape: an item's retry, idempotency and outcome have no ordinal of their own.

### Why it matters

A nightly sweep over open bookings, a reminder to every member whose subscription ends this week, or a report per class all iterate. If iteration lives inside a definition, the runner grows loops, nested attempts and partial-retry rules, and a failure on item 400 of 1000 is hard to see or resume.

### The general concept

A sweep is a trigger. It runs a saved query on a schedule and starts one ordinary run per matching entry, so each entry gets its own run, attempts, idempotency and outcome, and definitions stay flat. #835 should be amended to use this for `forEach`, and the schedule trigger in #839 is where it attaches.

### Where it lives

Core: workflows and saved queries.

### Compatibility

Not built yet, so nothing released changes. It removes the need for nested steps in the definition format, which keeps the stored definition shape as it is.

### Done when

- #835 is amended to describe iteration as a sweep trigger.
- A sweep over a query matching three entries starts three runs, and a failure in one leaves the other two succeeded.
- Rerunning the same due sweep does not start duplicate runs.

Found in the architecture sweep of 15 September 2026.

Contributor guide

Open the contributing guide

Research direction

Read DECISIONS.md:718 and WorkflowRunQueue.cs:113-119 first, then inspect the workflow and saved-query entry points referenced by #835 and #839. The work is done when #835 describes iteration as a sweep trigger, a three-entry sweep creates three independent runs with isolated failure, and rerunning the due sweep creates no duplicates.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.