From 717ff2555f06075814fe8abd9414e689bad684ad Mon Sep 17 00:00:00 2001 From: Hare Date: Fri, 9 Oct 2026 02:47:56 +0900 Subject: [PATCH] fix: migrate server config test helpers to WIP object API T-729 validation prerequisite approved in Ticket seq7. Preserve Backend authority, attachment, mutation, stale observation and unknown-outcome assertions using public Tree, path-centered Inspect and structured InterfaceReference Invoke. No production API expansion. Validation: cargo test -p yoi-workspace-server --lib workspace_config_integration (12 passed); git diff --check HEAD. --- Cargo.lock | 1 + crates/workspace-server/Cargo.toml | 1 + .../src/server_workspace_config_wip_tests.rs | 72 ++++++++++--------- 3 files changed, 40 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 649153ef5..f64b67e06 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6766,6 +6766,7 @@ dependencies = [ "uuid", "webauthn-authenticator-rs", "webauthn-rs", + "wip-protocol", "workdir", "worker", "worker-runtime", diff --git a/crates/workspace-server/Cargo.toml b/crates/workspace-server/Cargo.toml index 1f5f4f66a..7b50a34cf 100644 --- a/crates/workspace-server/Cargo.toml +++ b/crates/workspace-server/Cargo.toml @@ -56,6 +56,7 @@ zeroize.workspace = true webauthn-rs = { workspace = true } [dev-dependencies] +wip-protocol.workspace = true agen.workspace = true tempfile.workspace = true tools.workspace = true diff --git a/crates/workspace-server/src/server_workspace_config_wip_tests.rs b/crates/workspace-server/src/server_workspace_config_wip_tests.rs index c0df1d1a5..d2afdb7e7 100644 --- a/crates/workspace-server/src/server_workspace_config_wip_tests.rs +++ b/crates/workspace-server/src/server_workspace_config_wip_tests.rs @@ -139,26 +139,34 @@ impl worker::WorkspaceClient for ConfigRouterClient { Ok(response) } } -fn config_interface(path: &str) -> String { - // Use the published contextual interface identity, not a model-managed validator. - let hex = path - .bytes() - .map(|byte| format!("{byte:02x}")) - .collect::(); - format!("yoi.workspace-config/node/v1/@/{hex}") +fn config_interface(path: &str) -> Value { + // Exact contextual reference published by the current config Object. + json!({"scope": path, "name": "yoi.workspace-config/node/v1"}) } async fn config_discover(runtime: &worker::wip::WipRuntime, path: &str) { - let observed = runtime - .discover(path.into(), 0, true) - .await - .unwrap() - .content - .unwrap(); + inspect_published_interface(runtime, path, &config_interface(path)).await; +} +async fn inspect_published_interface( + runtime: &worker::wip::WipRuntime, + path: &str, + expected: &Value, +) { + let tree = runtime.tree(path.into(), 0, true).await.unwrap(); + let tree: Value = serde_json::from_str(tree.content.as_deref().unwrap()).unwrap(); + assert_eq!( + tree["path"], path, + "Object must come from live Tree: {tree}" + ); + let inspected = runtime.inspect(path.into(), true).await.unwrap(); + let inspected: Value = serde_json::from_str(inspected.content.as_deref().unwrap()).unwrap(); assert!( - observed.contains(&config_interface(path)), - "interface must come from live discovery: {observed}" + inspected["interfaces"] + .as_array() + .unwrap() + .iter() + .any(|interface| &interface["reference"] == expected), + "interface must come from live path-centered Inspect: {inspected}" ); - runtime.inspect(config_interface(path), true).await.unwrap(); } async fn config_call( runtime: &worker::wip::WipRuntime, @@ -167,9 +175,12 @@ async fn config_call( args: Value, ) -> std::result::Result { runtime - .call( + .invoke( path.into(), - config_interface(path), + wip_protocol::InterfaceReference { + scope: path.into(), + name: "yoi.workspace-config/node/v1".into(), + }, operation.into(), args, agen::tool::ToolExecutionContext::direct(), @@ -183,23 +194,16 @@ async fn catalog_call( base: &str, operation: &str, ) -> Value { - let hex = path - .bytes() - .map(|byte| format!("{byte:02x}")) - .collect::(); - let interface = format!("{base}/@/{hex}"); - let discovered = runtime - .discover(path.into(), 0, true) - .await - .unwrap() - .content - .unwrap(); - assert!(discovered.contains(&interface), "{discovered}"); - runtime.inspect(interface.clone(), true).await.unwrap(); + // Live catalog publication contextualizes the Interface to this Object. + let reference = json!({"scope": path, "name": base}); + inspect_published_interface(runtime, path, &reference).await; let output = runtime - .call( + .invoke( path.into(), - interface, + wip_protocol::InterfaceReference { + scope: path.into(), + name: base.into(), + }, operation.into(), json!({}), agen::tool::ToolExecutionContext::direct(), @@ -635,7 +639,7 @@ async fn assert_config_production_http_adapter( assert_config_catalog(&wip, &attached).await; config_discover(&wip, "/workspace-config/main.dcdl").await; let main_interface = wip - .inspect(config_interface("/workspace-config/main.dcdl"), true) + .inspect("/workspace-config/main.dcdl".into(), true) .await .unwrap() .content