@@ -3,8 +3,8 @@ import os from "node:os";
33import path from "node:path" ;
44import { afterEach , describe , expect , it } from "vitest" ;
55import loopSpec from "../../fixtures/specs/loop-max-3.json" ;
6- import { runGovernedExperimentWorkflow } from "../../src/orchestration/workflow" ;
76import type { ExperimentSpec } from "../../src/spec/schema" ;
7+ import { experiment_run_governed_workflow , experiment_init } from "../../src/tools" ;
88import { readJson , readJsonl , writeJson } from "../../src/utils/fs" ;
99import { getOrchestrationSummaryPath , getOrchestrationTracePath , getRecoveryCheckpointPath , getWorkspaceConfigPath } from "../../src/utils/paths" ;
1010
@@ -17,6 +17,7 @@ async function makeWorkspace(): Promise<string> {
1717 await fs . writeFile ( path . join ( dir , "src" , "config.json" ) , '{"learning_rate":0.1}\n' , "utf8" ) ;
1818 await fs . writeFile ( path . join ( dir , "src" , "strategy.txt" ) , "baseline\n" , "utf8" ) ;
1919 await fs . writeFile ( path . join ( dir , "src" , "module.ts" ) , "export const variant = 0;\n" , "utf8" ) ;
20+ await fs . writeFile ( path . join ( dir , "evaluate.py" ) , "print(0.93)\n" , "utf8" ) ;
2021 await writeJson ( getWorkspaceConfigPath ( dir ) , { ...loopSpec , workspace_root : dir } ) ;
2122 await writeJson ( getRecoveryCheckpointPath ( dir ) , {
2223 run_id : "recoverable-run" ,
@@ -30,11 +31,12 @@ afterEach(async () => {
3031 await Promise . all ( tempDirs . splice ( 0 ) . map ( ( dir ) => fs . rm ( dir , { recursive : true , force : true } ) ) ) ;
3132} ) ;
3233
33- describe ( "governed experiment workflow" , ( ) => {
34- it ( "writes an orchestration trace in specialist order " , async ( ) => {
34+ describe ( "governed experiment workflow bridge " , ( ) => {
35+ it ( "writes an orchestration trace through the python controller authority path " , async ( ) => {
3536 const workspace = await makeWorkspace ( ) ;
3637 const spec : ExperimentSpec = { ...( loopSpec as ExperimentSpec ) , workspace_root : workspace } ;
37- const result = await runGovernedExperimentWorkflow ( { workspaceRoot : workspace , spec } ) ;
38+ await experiment_init . execute ( { workspace_root : workspace , spec } ) ;
39+ const result = JSON . parse ( await experiment_run_governed_workflow . execute ( { workspace_root : workspace } ) ) ;
3840 const steps = await readJsonl < { actor : string ; status : string ; payload ?: { execution_mode ?: string ; raw_excerpt ?: string | null } } > ( getOrchestrationTracePath ( workspace ) ) ;
3941 const summary = await readJson < { specialist_audit ?: Array < { actor : string ; session_id : string | null ; execution_mode : string | null ; fallback_reason : string | null ; raw_excerpt : string | null } > } > ( getOrchestrationSummaryPath ( workspace ) , { } ) ;
4042 expect ( result . total_iterations ) . toBeGreaterThan ( 0 ) ;
@@ -47,11 +49,8 @@ describe("governed experiment workflow", () => {
4749 "status_poll.py" ,
4850 "judge_result.py" ,
4951 ] ) ;
50- expect ( steps . every ( ( step ) => typeof step . payload ?. execution_mode === "string" || ( step . actor === "Sisyphus (Ultraworker)" && step . status === "blocked" ) ) ) . toBe ( true ) ;
51- expect ( steps . every ( ( step ) => step . payload ?. execution_mode === "fallback" ) ) . toBe ( true ) ;
52- expect ( steps . some ( ( step ) => typeof step . payload ?. raw_excerpt === "string" || step . payload ?. raw_excerpt === null ) ) . toBe ( true ) ;
53- expect ( summary . specialist_audit ?. length ) . toBeGreaterThan ( 0 ) ;
54- expect ( summary . specialist_audit ?. every ( ( entry ) => typeof entry . execution_mode === "string" || entry . execution_mode === null ) ) . toBe ( true ) ;
55- expect ( summary . specialist_audit ?. some ( ( entry ) => entry . raw_excerpt !== null || entry . fallback_reason !== null || entry . session_id !== null ) ) . toBe ( true ) ;
56- } ) ;
52+ expect ( result . authority_path ) . toBe ( "python_controller" ) ;
53+ expect ( result . legacy_ts_workflow ) . toBe ( false ) ;
54+ expect ( summary . specialist_audit ) . toBeUndefined ( ) ;
55+ } , 30000 ) ;
5756} ) ;
0 commit comments