Repository navigation
refactor(api): tasks and processes become core primitives features plug into - #233
Merged
artem-broccoli merged 19 commits intoNov 15, 2026
Conversation
…s in through registrations Tasks and processes import no module. Processes reads people and working calendars through ports the employees module fills, record dates and subjects through record type registrations, and triggering events from the modules that publish them. A process step's task is marked done with the ordinary task command; processes completes the step before the commit. Reopen and cancelling a task by hand are gone; the person who asked deletes an open task instead.
A run whose subject record or person was removed no longer finishes when its last task is marked done, and the daily check cancels a run whose record, such as a deleted task, is gone. Manual starts accept the record id in any case. Tasks register their own triggering events.
Also drop the unused single-person subject read and inline mark done's task change.
Task becomes a class: who sees it, who marks it done or deletes it, and that done and cancelled are final live on it; every change returns a new task.
ProcessRun becomes a class with its steps: completing a step's tasks, finishing, the removal check and cancelling live on it. Changes load the run with lockRun and write it back with saveRun.
… to the database Saving a run rewrote every step's task id, which could restore a task id the database had just cleared and fail a concurrent mark done.
artem-broccoli
commented
Nov 15, 2026
Processes' ports move to processes/ports and the employees module's implementations of them to employees/adapters, both enforced as layers, so a module's outside dependencies show in its folders.
artem-broccoli
commented
Nov 15, 2026
Processes keeps what a day offset means, its search limit and the refusal; utils counts working days for any caller.
The steps live in the version's definition; the table holds a run's progress on each of them.
…ocess by hand Starting by hand stays behind create on process_run for the subject.
…nd's fields under it A task step's assignee, title, description and due move under `task`, so another kind of step brings its own fields without touching the root.
…nts start it parseProcessDefinition restores the stored on_event trigger as an EventTrigger; isTriggeredBy moves onto it.
…hich events start it" This reverts commit fc537bc.
artem-broccoli
merged commit Nov 15, 2026
968d16b
into
artem/bro-262-never-lose-a-record-change-that-starts-a
7 checks passed
artem-broccoli
deleted the
artem/bro-270-tasks-and-processes-become-shared-foundations
branch
November 15, 2026 06:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tasks and processes become shared foundations in
core/, beside records, and import no business module. Features plug in instead:readSubjects) and the dates a record-date trigger may start on (dateFields,findByDateBetween). Employees registersemployee(itsstartDate); tasks registerstask.employees.addedby employees;tasks.task_createdandtasks.task_status_changedby tasks), collected once at startup; a key registered twice stops startup.PeoplePortandWorkingCalendarsPort, which employees fills with adapters, together with the bank holiday rule. Ports live in a module'sports/folder and their implementations in the implementing module'sadapters/folder, both enforced as lint layers.tasks.markDone. Processes listens to the task's status event before the commit and completes the step and the run in the same transaction. Every transaction that locks a task and its run takes the task first; the daily check now locks a run's open tasks before the run. A run that can no longer go on (its record or person is gone) is left for the daily check, and a task done meanwhile stays done.Task.processSourceis served by processes, and the Employee fields ofTaskby employees, so the GraphQL shape the web app reads stays the same.Taskowns who sees it, who marks it done or deletes it, and that done and cancelled are final.ProcessRunholds its steps and owns completing them, finishing, the removal check and cancelling; changes load it withlockRunand write it back withsaveRun.keyandkindat its root and its kind's fields under it (task: { assignee, title, description, due });startableByAdminis gone, so an admin may start any process by hand withcreateonprocess_run. The run steps table is nowprocess_run_step_progress: the steps live in the version's definition, the table holds a run's progress on each.utils(addWorkingDays); processes keeps what a day offset means and its limit.module.mdopens with JSON examples of its main flow;processes/module.mdshows a run started by a change and by a date.Behaviour changes:
tasks.delete), with a confirmation; only a process cancels the tasks it created, with a reason.Stacked on #227.
Testing
pnpm check, all API integration tests (1546) and end-to-end tests (304) pass; web unit tests pass.tasks.markDone(both steps, one step, concurrent completion, removed subject or assignee, manual tasks untouched), the daily check cancelling a run whose task record was deleted, definition parsing against registrations, and refusing a key registered twice.drizzle-kit generatereports no change for tasks and processes. The Docker image builds andpnpm devstarts on a fresh database.docs/qa/tasks.mdis updated for Delete and the removed Reopen and Undo.Release Notes: