feat: add dry-run workflow execution boundary

This commit is contained in:
john
2026-07-24 22:30:41 +08:00
parent 646178944d
commit c9ad841543
12 changed files with 553 additions and 17 deletions
+50 -2
View File
@@ -69,8 +69,11 @@ test('orchestrator config persists versioned admin updates and selects canary us
userId: 'user-1',
workflowName: 'code-run-v1',
});
assert.equal(selected.engine, 'langgraph');
assert.equal(selected.reason, 'user_allowlist');
assert.equal(selected.engine, 'native');
assert.equal(selected.candidateEngine, 'langgraph');
assert.equal(selected.reason, 'execution_gate_disabled');
assert.equal(selected.candidateReason, 'user_allowlist');
assert.equal(selected.dryRun, true);
const native = await service.selectEngine({
runId: 'run-2',
@@ -78,9 +81,54 @@ test('orchestrator config persists versioned admin updates and selects canary us
workflowName: 'code-run-v1',
});
assert.equal(native.engine, 'native');
assert.equal(native.candidateEngine, 'native');
assert.equal(native.reason, 'canary_not_selected');
});
test('orchestrator execution handoff remains hard-disabled when Active is requested', async () => {
const service = createOrchestratorAdminConfigService(createPool(), { env: {} });
await service.updateAdminConfig({
mode: 'active',
serviceUrl: 'http://127.0.0.1:8093',
});
const runtime = await service.getRuntimeState();
assert.equal(runtime.runtime.plansLangGraph, true);
assert.equal(runtime.runtime.executesLangGraph, false);
assert.deepEqual(runtime.runtime.executionHandoff, {
implemented: false,
requested: true,
enabled: false,
reason: 'phase3_dry_run_only',
});
const selected = await service.selectEngine({
runId: 'run-1',
userId: 'user-1',
workflowName: 'code-run-v1',
});
assert.equal(selected.engine, 'native');
assert.equal(selected.candidateEngine, 'langgraph');
assert.equal(selected.dryRun, true);
});
test('orchestrator keeps a Native primary as a non-dry-run Native selection', async () => {
const service = createOrchestratorAdminConfigService(createPool(), { env: {} });
await service.updateAdminConfig({
mode: 'active',
primaryEngine: 'native',
});
const selected = await service.selectEngine({
runId: 'run-native',
workflowName: 'code-run-v1',
});
assert.equal(selected.engine, 'native');
assert.equal(selected.candidateEngine, 'native');
assert.equal(selected.reason, 'active');
assert.equal(selected.dryRun, false);
});
test('orchestrator emergency kill switch always forces native selection', async () => {
const service = createOrchestratorAdminConfigService(createPool(), {
env: { MEMIND_ORCHESTRATOR_KILL_SWITCH: '1' },