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.
This commit is contained in:
2026-10-09 02:47:56 +09:00
parent f9d4c97f1e
commit 717ff2555f
3 changed files with 40 additions and 34 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,26 +139,34 @@ impl worker::WorkspaceClient for ConfigRouterClient {
Ok(response) Ok(response)
} }
} }
fn config_interface(path: &str) -> String { fn config_interface(path: &str) -> Value {
// Use the published contextual interface identity, not a model-managed validator. // Exact contextual reference published by the current config Object.
let hex = path json!({"scope": path, "name": "yoi.workspace-config/node/v1"})
.bytes()
.map(|byte| format!("{byte:02x}"))
.collect::<String>();
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 inspect_published_interface(runtime, path, &config_interface(path)).await;
.discover(path.into(), 0, true) }
.await async fn inspect_published_interface(
.unwrap() runtime: &worker::wip::WipRuntime,
.content path: &str,
.unwrap(); 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!( assert!(
observed.contains(&config_interface(path)), inspected["interfaces"]
"interface must come from live discovery: {observed}" .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( async fn config_call(
runtime: &worker::wip::WipRuntime, runtime: &worker::wip::WipRuntime,
@@ -167,9 +175,12 @@ async fn config_call(
args: Value, args: Value,
) -> std::result::Result<agen::tool::ToolOutput, agen::tool::ToolError> { ) -> std::result::Result<agen::tool::ToolOutput, agen::tool::ToolError> {
runtime runtime
.call( .invoke(
path.into(), path.into(),
config_interface(path), wip_protocol::InterfaceReference {
scope: path.into(),
name: "yoi.workspace-config/node/v1".into(),
},
operation.into(), operation.into(),
args, args,
agen::tool::ToolExecutionContext::direct(), agen::tool::ToolExecutionContext::direct(),
@@ -183,23 +194,16 @@ async fn catalog_call(
base: &str, base: &str,
operation: &str, operation: &str,
) -> Value { ) -> Value {
let hex = path // Live catalog publication contextualizes the Interface to this Object.
.bytes() let reference = json!({"scope": path, "name": base});
.map(|byte| format!("{byte:02x}")) inspect_published_interface(runtime, path, &reference).await;
.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 let output = runtime
.call( .invoke(
path.into(), path.into(),
interface, wip_protocol::InterfaceReference {
scope: path.into(),
name: base.into(),
},
operation.into(), operation.into(),
json!({}), json!({}),
agen::tool::ToolExecutionContext::direct(), agen::tool::ToolExecutionContext::direct(),
@@ -635,7 +639,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