state-hub/dashboard/src/docs/workstream-lifecycle.md

87 lines
2.8 KiB
Markdown
Raw Normal View History

---
2026-05-18 01:31:36 +02:00
title: Workstream Lifecycle - Reference
---
2026-05-18 01:31:36 +02:00
# Workstream Lifecycle - Reference
2026-05-18 01:31:36 +02:00
A workstream is an information object that occupies a named lifecycle state.
The stored `status` field keeps that state, while the task-flow engine derives
which other states are reachable and which exit assertions are blocking
movement. Dashboard health filters such as `needs_review` and `stalled` are
derived labels, not stored lifecycle values.
---
2026-05-18 01:31:36 +02:00
## Stored Lifecycle States
2026-05-18 01:31:36 +02:00
| State | Source | Meaning |
|---|---|---|
2026-05-18 01:31:36 +02:00
| **proposed** | DB `status = proposed` | Plan exists, but must be reviewed against current repo state |
| **ready** | DB `status = ready` | Plan has been reviewed and is ready to execute |
| **active** | DB `status = active` | Work is in progress |
| **blocked** | DB `status = blocked` | Work cannot proceed until a dependency, decision, or input clears |
| **backlog** | DB `status = backlog` | Intentionally parked so it stays out of current work views |
| **finished** | DB `status = finished` | Implementation is complete |
| **archived** | DB `status = archived` | Historical record outside normal planning and execution |
Normal progression:
```text
backlog -> proposed -> ready -> active -> finished -> archived
\ \
\ -> blocked -> active
-> backlog
```
---
2026-05-18 01:31:36 +02:00
## Health Labels
2026-05-18 01:31:36 +02:00
| Label | Source | Meaning |
|---|---|---|
2026-05-18 01:31:36 +02:00
| **needs_review** | Ready-review metadata + git diff | A `ready` workplan may be stale because relevant files changed since review |
| **stalled** | Task counts + timestamp | Work started, but there has been no meaningful progress after the threshold |
2026-05-18 01:31:36 +02:00
`needs_review` and `stalled` can appear beside lifecycle states. They should
not be written into workplan frontmatter or directly into the workstream
`status` field.
2026-05-18 01:31:36 +02:00
---
2026-05-18 01:31:36 +02:00
## Ready Review Metadata
2026-05-18 01:31:36 +02:00
Ready workplans may include optional frontmatter:
2026-05-18 01:31:36 +02:00
```yaml
reviewed_at: "YYYY-MM-DD"
reviewed_by: "human-or-agent"
reviewed_against_commit: "<git-sha>"
context_paths:
- "path/or/glob"
```
2026-05-18 01:31:36 +02:00
If `reviewed_against_commit` differs from `HEAD`, State Hub checks
`context_paths` when present. Relevant changes produce the derived
`needs_review` label. Automatic demotion from `ready` to `proposed` is guarded
behind explicit tooling, not done silently.
---
2026-05-18 01:31:36 +02:00
## Flow Operations
2026-05-18 01:31:36 +02:00
```text
get_flow_state(entity_type="workstream", entity_id="<uuid>")
advance_workstation(entity_type="workstream", entity_id="<uuid>", target_workstation="finished")
```
2026-05-18 01:31:36 +02:00
Direct status patching still exists for bootstrap and compatibility work:
2026-05-18 01:31:36 +02:00
```bash
curl -X PATCH http://127.0.0.1:8000/workstreams/<uuid>/ \
-H "Content-Type: application/json" \
-d '{"status": "finished"}'
```
2026-05-18 01:31:36 +02:00
Workstreams are never hard-deleted. Use `finished` for completed
implementation and `archived` for historical records outside normal planning.