Extract + Drizzle flows aggregate (flows + runs + audit + legacy_forge_calls) #843
Labels
No labels
area:agents
area:dashboard
area:database
area:design
area:design-review
area:flows
area:infra
area:meta
area:security
area:sessions
area:webhook
area:workdir
security
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Blocks
Depends on
#845 Extract + Drizzle
service_config + label_catalog + agent_type_* aggregates
charles/claude-hooks
#849 Cleanup: delete
db.ts, lint-ban raw SQL outside DB layer, update docs
charles/claude-hooks
#844 Extract + Drizzle
agents aggregate (preserve onAgentDelete hook)
charles/claude-hooks
Reference
charles/claude-hooks#843
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
As a maintainer, I want all flow-related tables (
flows,flow_runs,flow_node_runs,flow_audit,legacy_forge_calls) split out and rewritten on Drizzle, so that the largest SQL surface indb.ts(~25 fns) lives in one cohesive module with type-safe queries.Acceptance criteria
Extraction
flows.ts+flow-runs.ts+flow-audit.ts+legacy-forge-calls.ts(split by table for review-ability).db.ts:1571-1953for exhaustive list):listFlows,getFlow,upsertFlow,seedDefaultFlow,deleteFlow,insertFlowRun,finishFlowRun,getFlowRun,listFlowRuns,deleteFlowRun,pruneFlowRunsOlderThan,insertFlowNodeRun,listFlowNodeRuns,listFlowNodeIntentsSince,insertFlowAudit,listFlowAudit,getFlowAuditByVersion,withFlowTransaction,insertLegacyForgeCall,listLegacyForgeCallsSince,resetLegacyForgeCalls.Transactions
withFlowTransaction(fn)keeps same signature; internally wraps Drizzle + raw via sharedgetDb().transaction(...)so other-aggregate raw SQL inside the closure still participates.Drizzle
schema/flows.ts+schema/flow-runs.ts+schema/flow-audit.ts+schema/legacy-forge-calls.ts.Tests
flows-db.test.tsgreen.withFlowTransaction, write to flows (Drizzle) + holds (Drizzle from #840) + still-raw aggregate, rollback, all changes reverted.Out of scope
domain/flows/) — only DB layer changes.References
apps/server/src/infrastructure/database/db.ts:1571-1953.apps/server/src/domain/flows/flow-dispatch.ts(caller).agentsaggregate (preserveonAgentDeletehook)service_config+label_catalog+agent_type_*aggregatesdb.ts, lint-ban raw SQL outside DB layer, update docs🤖 Auto-assigned to code-lead (heuristic: default → code-lead (no specific label match; safer than code)). Reply
/unassignto reroute.