fix: migrate dependent server WIP tests to public object tools

Dependent test compilation exposed removed discover, opaque Interface strings and private call usage. Select structured references from actual path Inspect and invoke through the public WIP 0.2.0 API.

Validation: complete Workspace Server suite (691 unit + 11 CLI), Server API 83 tests including generated artifact freshness, root cargo check and SDK resolution verification passed.
This commit is contained in:
2026-10-09 02:22:18 +09:00
parent 37a13e3566
commit 6445999120
3 changed files with 22 additions and 64 deletions
Generated
+1
View File
@@ -6766,6 +6766,7 @@ dependencies = [
"uuid", "uuid",
"webauthn-authenticator-rs", "webauthn-authenticator-rs",
"webauthn-rs", "webauthn-rs",
"wip-protocol",
"workdir", "workdir",
"worker", "worker",
"worker-runtime", "worker-runtime",
+1
View File
@@ -56,6 +56,7 @@ zeroize.workspace = true
webauthn-rs = { workspace = true } webauthn-rs = { workspace = true }
[dev-dependencies] [dev-dependencies]
wip-protocol.workspace = true
agen.workspace = true agen.workspace = true
tempfile.workspace = true tempfile.workspace = true
tools.workspace = true tools.workspace = true
@@ -139,73 +139,29 @@ impl worker::WorkspaceClient for ConfigRouterClient {
Ok(response) Ok(response)
} }
} }
fn config_interface(path: &str) -> String { async fn inspected_interface(runtime: &worker::wip::WipRuntime, path: &str, refresh: bool) -> wip_protocol::InterfaceReference {
// Use the published contextual interface identity, not a model-managed validator. let inspected = runtime.inspect(path.into(),refresh).await.unwrap();
let hex = path let value: Value = serde_json::from_str(inspected.content.as_deref().unwrap()).unwrap();
.bytes() assert_eq!(value["path"], path);
.map(|byte| format!("{byte:02x}")) let reference = &value["interfaces"][0]["reference"];
.collect::<String>(); wip_protocol::InterfaceReference { scope:reference["scope"].as_str().unwrap().into(), name:reference["name"].as_str().unwrap().into() }
format!("yoi.workspace-config/node/v1/@/{hex}")
} }
async fn config_discover(runtime: &worker::wip::WipRuntime, path: &str) { async fn config_discover(runtime: &worker::wip::WipRuntime, path: &str) {
let observed = runtime runtime.tree(path.into(),0,true).await.unwrap();
.discover(path.into(), 0, true) let reference = inspected_interface(runtime,path,true).await;
.await assert_eq!(reference.scope,path);
.unwrap() assert_eq!(reference.name,"yoi.workspace-config/node/v1");
.content
.unwrap();
assert!(
observed.contains(&config_interface(path)),
"interface must come from live discovery: {observed}"
);
runtime.inspect(config_interface(path), true).await.unwrap();
} }
async fn config_call( async fn config_call(runtime: &worker::wip::WipRuntime, path: &str, operation: &str, args: Value) -> std::result::Result<agen::tool::ToolOutput, agen::tool::ToolError> {
runtime: &worker::wip::WipRuntime, let interface = inspected_interface(runtime,path,false).await;
path: &str, runtime.invoke(path.into(),interface,operation.into(),args,agen::tool::ToolExecutionContext::direct()).await
operation: &str,
args: Value,
) -> std::result::Result<agen::tool::ToolOutput, agen::tool::ToolError> {
runtime
.call(
path.into(),
config_interface(path),
operation.into(),
args,
agen::tool::ToolExecutionContext::direct(),
)
.await
} }
async fn catalog_call(runtime: &worker::wip::WipRuntime, path: &str, base: &str, operation: &str) -> Value {
async fn catalog_call( runtime.tree(path.into(),0,true).await.unwrap();
runtime: &worker::wip::WipRuntime, let interface = inspected_interface(runtime,path,true).await;
path: &str, assert_eq!(interface.scope,path);
base: &str, assert_eq!(interface.name,base);
operation: &str, let output = runtime.invoke(path.into(),interface,operation.into(),json!({}),agen::tool::ToolExecutionContext::direct()).await.unwrap();
) -> Value {
let hex = path
.bytes()
.map(|byte| format!("{byte:02x}"))
.collect::<String>();
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();
let output = runtime
.call(
path.into(),
interface,
operation.into(),
json!({}),
agen::tool::ToolExecutionContext::direct(),
)
.await
.unwrap();
serde_json::from_str(output.content.as_deref().unwrap()).unwrap() serde_json::from_str(output.content.as_deref().unwrap()).unwrap()
} }
@@ -635,7 +591,7 @@ async fn assert_config_production_http_adapter(
assert_config_catalog(&wip, &attached).await; assert_config_catalog(&wip, &attached).await;
config_discover(&wip, "/workspace-config/main.dcdl").await; config_discover(&wip, "/workspace-config/main.dcdl").await;
let main_interface = wip let main_interface = wip
.inspect(config_interface("/workspace-config/main.dcdl"), true) .inspect("/workspace-config/main.dcdl".into(), true)
.await .await
.unwrap() .unwrap()
.content .content