test(topology_jobs): seed research_outcome so transition test matches new invariant
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user