Commit Graph
1 Commits
Author SHA1 Message Date
Omar Sobh 258113e4d8 migrations: 0030 research_topics + 0031 loops schema
ci / gates (push) Successful in 5s
ci / frontend (push) Successful in 24s
ci / rust (push) Successful in 3m44s
ci / publish (push) Successful in 3m6s
ci / e2e (push) Failing after 29m54s
First commit of the Research + Loops feature arc. Schema only — routes,
runtime hooks, and the UI arrive in subsequent commits.

0030 — research_topics
  Container entity with a small state machine (standby → processing →
  reviewing → publishing → published). Owns runs via a nullable
  topology_runs.research_topic_id FK, so all existing SSE/audit/gated-
  approval plumbing surfaces without changes. Many-to-many join table
  captures the role_slot the wizard assigns each agent ("lead", "critic",
  "writer") so the canvas can group avatars sensibly.

0031 — loops
  Durable recurring topology execution. graph + task_template pair with a
  triggers JSONB (any of cron / on_completion / webhook, all can be on
  simultaneously) and a repeat_policy (infinite / N iters / until). Every
  iteration writes a topology_runs row with loop_id, iteration (1-indexed),
  and parent_run_id chained back to N-1 — cross-iteration context comes
  from that hop, no extra state store needed. Webhook auth is HMAC-SHA256
  keyed by webhook_signing_key. Missed cron windows fire once and skip the
  backlog (see comment header).

Both migrations only ADD tables/columns and use ON DELETE SET NULL for the
back-refs, so they're safe to run against prod without downtime. The
existing indexes on topology_runs keep serving legacy (non-research,
non-loop) runs unchanged.

Publish approval extension (approvals.kind for the reviewing → publishing
gate) comes as a separate migration in the publish-gate commit.
2026-07-06 04:14:06 -07:00