Background tasks and to-dos
The K.taches registry lists the long operations under way: a campaign scan, document indexing, an import, a workflow run. It is distinct from the workflow engine, which also uses the word task but means something else. This page describes both registries, the bridge pattern, and the to-do panel.
Declaring a background task
| Rule | Reason |
|---|---|
| A task declares annulable only if it can actually stop. | A button that cancels nothing is worse than no button. |
| Only success clears itself. | An unread failure would disappear before being seen. |
| An indeterminate task says so. | A bar that advances without a real measure sets a false expectation. |
| The title carries the short name, the subject the full path. | Two simultaneous scans must be told apart without a tooltip. |
The bridge pattern
A module that produces long operations does not call the registry itself. It emits its life cycle on the bus, and a small separate file listens and creates the tasks. Producer and registry ignore each other, which makes it possible to add progress reporting to a module without touching its code, and to remove it the same way.
Listeners are installed inside K.whenShellReady, not on file load. Nothing guarantees the registry is loaded before the bridge in the shell batch, and testing K.taches on load would give up silently and never retry.
Tasks panel
The panel lists running tasks and unacknowledged failures, with their title, subject and progress where it is known. It offers a cancel button only for tasks that declared one.
The case that made this panel necessary is the campaign scan: the wait occupies the Campaign panel, so on a folder of three hundred files a user who wants to work elsewhere during the scan loses sight of the operation. Progress is therefore shown where it is felt, not only where it was triggered.
To-dos
The to-do feature marks any object in the software as needing attention, with or without a note, and gathers those marks in a single panel: incomplete samples, scripts, projects, chain nodes.
| Point | Behaviour |
|---|---|
| Setting a mark | Through the object's context menu, aggregated from the menu registry. |
| Covered types | Declared in a type registry, one adapter per target. |
| Note | Optional. A mark without a note is still a mark. |
| Write | To the database, outside the signed registry: a to-do mark is not a data change. |
Menu contributions go through K.menus, which aggregates every contribution for a given target. A to-do entry therefore appears in the existing menus without any panel being modified. Since the contexts supplied by panels do not all carry an object reference, the to-do feature installs one adapter per target rather than imposing a common field on every panel.