Python
test: update integration fixtures for shared provider and submission contracts
Rohit Pbe28d0de27b7
diff --git a/harness/tests/agent_team_contract.rs b/harness/tests/agent_team_contract.rsindex dd5a3eb7..410b5b3c 100644--- a/harness/tests/agent_team_contract.rs+++ b/harness/tests/agent_team_contract.rs@@ -683,21 +683,18 @@ pub fn exercise_coding_defaults(db: &mut dyn StateStore) {assert!(db.agent_team("lead", "team_spawn", &wrong, None).is_err());let mut selected = verifier;selected["source"] = json!({"kind":"submission","id":"handoff_original"});- let v = db+ // A syntactically valid reference is insufficient: it must already belong+ // to this team. Failed reservation must not allocate the verifier.+ assert!(db.agent_team("lead", "team_spawn", &selected, None)- .unwrap();- assert_eq!(v["instance"]["phase"], "reserved");- assert_eq!(v["source"], selected["source"]);+ .is_err());let snapshot = db.agent_team("lead", "snapshot", &json!({}), None).unwrap();+ assert!(snapshot["roster"]["instances"]["check"].is_null());assert_eq!(snapshot["roster"]["requests"]["ui"]["source"],json!({"kind":"initial"}));- assert_eq!(- snapshot["roster"]["requests"]["check"]["source"],- selected["source"]- );- assert!(snapshot["workspaces"].as_object().unwrap().is_empty()); // Still needs real import/admission.+ assert!(snapshot["workspaces"].as_object().unwrap().is_empty());let public = openworker_runtime::agent_team::public_snapshot(snapshot);assert!(public.get("coding").is_none());assert!(public.get("coding_selection").is_none());@@ -754,6 +751,35 @@ pub fn exercise_coding_defaults(db: &mut dyn StateStore) {.unwrap();db.agent_team("lead", "ready", &json!({"agent_id":"shared-source"}), None).unwrap();+ // Register an actual originating submission after the builder's source+ // receipt, then verify that the same selection can reserve a verifier.+ let (mut submitting, _, _) = db.accept(&child.id, "submit", "Submit work").unwrap();+ let turn = submitting.turn.as_mut().unwrap();+ turn.status = "running".into();+ turn.queue = vec![+ json!({"type":"function_call","call_id":"submit-code","name":"team_submit_code","arguments":"{}"}),+ ];+ db.save(&submitting, "assistant_message", json!({}))+ .unwrap();+ let submission = db+ .agent_team(+ &child.id,+ "team_submit_code",+ &json!({"commit":"b".repeat(40),"summary":"Builder revision"}),+ None,+ )+ .unwrap();+ selected["source"]["id"] = submission["id"].clone();+ let v = db+ .agent_team("lead", "team_spawn", &selected, None)+ .unwrap();+ assert_eq!(v["instance"]["phase"], "reserved");+ assert_eq!(v["source"], selected["source"]);+ let snapshot = db.agent_team("lead", "snapshot", &json!({}), None).unwrap();+ assert_eq!(+ snapshot["roster"]["requests"]["check"]["source"],+ selected["source"]+ );let mut changed = args.clone();changed["coding"]["source"]["commit"] = json!("b".repeat(40));assert!(db.agent_team("lead", "create", &changed, None).is_err());diff --git a/harness/typescript-sdk/test/assistant.test.mjs b/harness/typescript-sdk/test/assistant.test.mjsindex feb8a5cf..7d442ba3 100644--- a/harness/typescript-sdk/test/assistant.test.mjs+++ b/harness/typescript-sdk/test/assistant.test.mjs@@ -8,7 +8,8 @@ import { Harness } from "../dist/index.js";const plan = (name, args) => `TEST_RESOURCE_GRANTS ${JSON.stringify([{name, arguments: args}])}`;async function invoke(h, s, name, args) {const run = await s.send(plan(name, args));- assert.equal((await run.result()).status, "completed");+ const terminal = await run.result();+ assert.equal(terminal.status, "completed", JSON.stringify({terminal, events: terminal.status === "completed" ? [] : await h.request("event/read", {session_id: s.id, after: 0})}));const history = await h.request("history/read", {session_id: s.id, after: 0});const item = history.items.map(v => v.item).reverse().find(v => v.type === "function_call_output");const result = JSON.parse(item.output);diff --git a/harness/typescript-sdk/test/integration.test.mjs b/harness/typescript-sdk/test/integration.test.mjsindex 72102c7c..6866ca73 100644--- a/harness/typescript-sdk/test/integration.test.mjs+++ b/harness/typescript-sdk/test/integration.test.mjs@@ -1,6 +1,6 @@import { test } from "node:test";import assert from "node:assert/strict";-import { mkdtemp, mkdir, rm, readFile, writeFile } from "node:fs/promises";+import { mkdtemp, mkdir, rm, readFile, writeFile, realpath } from "node:fs/promises";import { tmpdir } from "node:os";import { join } from "node:path";import { fileURLToPath } from "node:url";@@ -50,7 +50,8 @@ for (const database of ["sqlite", "postgres"]) {timeout: 360_000,},async (t) => {- const root = await mkdtemp(join(tmpdir(), "ow-ts-real-"));+ // Trusted server policy paths cannot traverse macOS's /var symlink.+ const root = await realpath(await mkdtemp(join(tmpdir(), "ow-ts-real-")));const work = join(root, "work");await mkdir(work);const servers = join(root, "servers.json");@@ -157,7 +158,9 @@ for (const database of ["sqlite", "postgres"]) {});await h.setConnection({coworker: "worker",- id: "test",+ // Connections are harness-wide; a provider cannot be retargeted by+ // changing the legacy coworker field on the same connection ID.+ id: "test-anthropic",label: "Test",provider: "anthropic",apiKey: "fixture-only",