NF-4: Persistence + default graph #325

Closed
opened 2026-04-24 11:29:50 +00:00 by code-lead · 1 comment
Collaborator

As the platform, I want flows, runs, and per-node traces persisted in SQLite with a default graph seeded on first boot so that the engine survives restarts and reproduces today's dispatch unchanged.

Acceptance criteria

Schema

  • Three new SQLite tables: flows, flow_runs, flow_node_runs — columns per spec § Persistence.
  • Migration seeds the default flow row with the baked default-graph body on first boot; reseeds when source=default + version differs from the shipped constant.

Default graph

  • apps/server/src/domain/flows/default-graph.json — canonical baked graph; loader validates it against the NF-2 schema at test time.
  • Reproduces every dispatch in today's webhook-handlers.ts, webhook-ci.ts, slash-commands.ts, deps.ts.

Read endpoints

  • GET /flows, GET /flows/:id, GET /flows/runs, GET /flows/runs/:id (auth-gated mutations deferred to NF-7).

Retention

  • 30-day retention on flow_runs + flow_node_runs, swept by the existing sweeper.

Out of scope

  • Mutation endpoints — NF-7.
  • Divergence detection — NF-5.

References

As the platform, I want flows, runs, and per-node traces persisted in SQLite with a default graph seeded on first boot so that the engine survives restarts and reproduces today's dispatch unchanged. ## Acceptance criteria ### Schema - [ ] Three new SQLite tables: `flows`, `flow_runs`, `flow_node_runs` — columns per spec § Persistence. - [ ] Migration seeds the `default` flow row with the baked default-graph body on first boot; reseeds when `source=default` + `version` differs from the shipped constant. ### Default graph - [ ] `apps/server/src/domain/flows/default-graph.json` — canonical baked graph; loader validates it against the NF-2 schema at test time. - [ ] Reproduces every dispatch in today's `webhook-handlers.ts`, `webhook-ci.ts`, `slash-commands.ts`, `deps.ts`. ### Read endpoints - [ ] `GET /flows`, `GET /flows/:id`, `GET /flows/runs`, `GET /flows/runs/:id` (auth-gated mutations deferred to NF-7). ### Retention - [ ] 30-day retention on `flow_runs` + `flow_node_runs`, swept by the existing sweeper. ## Out of scope - Mutation endpoints — NF-7. - Divergence detection — NF-5. ## References - Spec: [`specs/node-flows.md`](../src/branch/main/specs/node-flows.md) § Persistence. - Depends on NF-3 (#324).
Author
Collaborator

🤖 Auto-assigned to boss (heuristic: default → boss (no specific label match; safer than dev)). Reply /unassign to reroute.

🤖 Auto-assigned to **boss** (heuristic: default → boss (no specific label match; safer than dev)). Reply `/unassign` to reroute.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks#325
No description provided.