feat(FN-3013): add durable insight lifecycle with bounded run executor
Adds durable insight lifecycle management to the Fusion system, including a bounded insight run executor, storage contracts for insight and research data, and API integration through the insights routes. Legacy schema compatibility is stabilized, and lifecycle safeguards are documented in the archit Fusion-Task-Id: FN-3013
This commit is contained in:
@@ -158,7 +158,13 @@ Concrete references:
|
||||
|
||||
- `InsightStore` (`insight-store.ts`, `insight-types.ts`) persists extracted project learnings
|
||||
- Uses fingerprint-based deduplication and run tracking
|
||||
- Backed by `project_insights` and `project_insight_runs`
|
||||
- Run lifecycle is hardened through `insight-run-executor.ts` + `InsightStore` transition guards:
|
||||
- single active run per `projectId + trigger` (`pending|running` conflict)
|
||||
- terminal-state immutability for run rows
|
||||
- persisted failure classification (`cancelled`, `timed_out`, `retryable_transient`, `non_retryable`) and retry lineage metadata
|
||||
- append-only durable event trail in `project_insight_run_events`
|
||||
- Dashboard routes (`insights-routes.ts`) consume the core executor/store APIs for run start, cancel, retry, and event inspection (`/api/insights/runs/:id/events`)
|
||||
- Backed by `project_insights`, `project_insight_runs`, and `project_insight_run_events`
|
||||
|
||||
### Research Runs
|
||||
|
||||
|
||||
@@ -191,7 +191,8 @@ Additional backend notes:
|
||||
| `roadmap_milestones` | Milestones within roadmaps (`roadmapId` FK). |
|
||||
| `roadmap_features` | Features within roadmap milestones (`milestoneId` FK). |
|
||||
| `project_insights` | Extracted project insights with fingerprint-based deduplication and provenance metadata. |
|
||||
| `project_insight_runs` | Insight extraction run history and run-level metrics/status. |
|
||||
| `project_insight_runs` | Insight extraction run history with durable lifecycle metadata (`lifecycle` JSON includes terminalReason/cause, failureClass, retryable flag, cancellationRequestedAt, timeoutAt, retry lineage fields). Terminal rows are immutable for state transitions. |
|
||||
| `project_insight_run_events` | Append-only per-run lifecycle trail (`seq`, `type`, `message`, optional `status`/`classification`/`metadata`) used by cancel/retry/timeout auditing and API inspection. |
|
||||
| `todo_lists` | Project-scoped todo list metadata (`projectId`, title, created/updated timestamps). |
|
||||
| `todo_items` | Todo list items (`listId` FK) with completion state, completion timestamp, and deterministic `sortOrder`. |
|
||||
| `ai_sessions` *(migration-created)* | Persisted AI interactive sessions (planning/interview/subtask) with status and conversation history. |
|
||||
|
||||
Reference in New Issue
Block a user