test(public-api): exercise scoped lifetimes across real HTTP

Construct example calls from fetched structured identity and scope_ref. Add exhaustive public DTO coverage and a transactional external-style provider over TCP to exercise root/self scopes, equal names in distinct scopes, optional and stale refs, deletion/republication, visibility, validator precedence and non-retry of unknown outcomes.

Validation: cargo test -p wip-public-api-example (9 DTO/example tests, 4 real TCP conformance tests); Nix clippy --all-targets -D warnings.
This commit is contained in:
2026-10-08 03:56:24 +09:00
parent a7186173b4
commit fc52d72a01
5 changed files with 622 additions and 14 deletions
@@ -258,6 +258,40 @@ fn assert_schema_neutral(value: &Value) {
}
}
#[test]
fn scoped_dtos_keep_identity_binding_and_validators_separate() {
// Exact literals/destructuring guard the public Rust contract, including
// omission of refs rather than requiring a fabricated identity.
let reference = wip_protocol::InterfaceReference {
scope: "/article-service".into(),
name: "catalog::read#raw".into(),
};
let request = wip_protocol::FetchInterfaceRequest {
interface: reference.clone(),
};
request.validate().unwrap();
let wip_protocol::FetchInterfaceResponse {
interface,
scope_ref,
descriptor,
validator,
} = wip_protocol::FetchInterfaceResponse {
interface: reference.clone(),
scope_ref: None,
descriptor: CatalogDefinition::descriptor(),
validator: None,
};
let target = wip_protocol::InterfaceTarget {
reference: interface,
scope_ref,
validator,
};
assert_eq!(target.reference, reference);
assert!(target.scope_ref.is_none());
assert!(target.validator.is_none());
assert_eq!(descriptor.format, INTERFACE_FORMAT_V1);
}
fn root_reference(name: &str) -> wip_protocol::InterfaceReference {
wip_protocol::InterfaceReference {
scope: "/".into(),