test(topology_jobs): seed research_outcome so transition test matches new invariant
ci / gates (push) Successful in 6s
ci / frontend (push) Successful in 38s
ci / rust (push) Successful in 2m48s
ci / e2e (push) Has been skipped
ci / publish (push) Successful in 4m32s

Commit 7e0620f tightened notify_run_completed to only advance a topic from
`processing` → `reviewing` when at least one research_outcome exists for it.
The transition test never inserted an outcome, so post-7e0620f it started
failing on the "no siblings in flight → topic transitions" assertion.

Mirror the worker order: persist the outcome after topology_runs::complete
and before notify_run_completed. The test now enforces the new invariant
rather than papering over it.
This commit is contained in:
Omar Sobh
2026-07-11 13:11:00 -07:00
parent bc39f854d8
commit dd791061ee
+9 -1
View File
@@ -2,7 +2,9 @@
//! (CAS) → checkpoint → complete, plus the stale-run resume sweep. This is the
//! foundation that lets long-horizon topology runs survive worker restarts.
use cm_db::repo::{loops, research_topics, teams, topology_runs, users, workspaces};
use cm_db::repo::{
loops, research_outcomes, research_topics, teams, topology_runs, users, workspaces,
};
use cm_domain::{
AccessPolicy, Agent, AgentId, AgentStatus, Role, User, UserId, Workspace, WorkspaceId,
};
@@ -298,6 +300,12 @@ async fn notify_run_completed_transitions_topic_when_no_siblings_in_flight() {
topology_runs::complete(&pool, run_id, &result)
.await
.unwrap();
// A completed run is not enough on its own: `notify_run_completed` only
// advances the topic to `reviewing` once at least one outcome exists,
// so mirror the worker order and persist the artifact first.
research_outcomes::insert(&pool, topic, "# body", Some(run_id))
.await
.unwrap();
let transitioned = topology_runs::notify_run_completed(&pool, run_id)
.await