feat: migrate protocol and HTTP to structured interface references

T-20: identify interfaces by exact scope/name pairs; add optional opaque scope_ref metadata and separate shape validation from path-dependent scope compatibility. Preserve call error precedence, strict JSON, validators and transport boundaries. Mechanically migrate consumers and document API/wire compatibility and deferred lifecycle semantics.

Validation: cargo fmt --all --check; git diff --check; cargo check --workspace --all-targets; cargo test -p wip-protocol -p wip-http; cargo test --workspace (221 passing tests including doctests); cargo test --workspace --all-targets; nix develop --command cargo clippy --workspace --all-targets -- -D warnings; RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps. All pass. cargo/rustc 1.95.0; development-shell Clippy/rustc 1.97.1.
This commit is contained in:
2026-10-07 18:29:51 +09:00
parent bf5fa54f44
commit 8ecc307fc9
34 changed files with 2124 additions and 263 deletions
+21
View File
@@ -26,6 +26,27 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}
```
## Interface references and scope identity
Every interface reference is encoded as an exact JSON object with required
`scope` and `name` strings, for example `{"scope":"/github","name":"issue.read"}`.
This applies to `Object.interfaces` elements, fetch request/response `interface`,
and call `interface.reference`. Scope must be a canonical absolute Worldspace
path and name must be nonempty. Legacy opaque strings, short-form strings,
relative scopes, missing fields, and extra members are rejected. Unicode, `::`,
and `#` in names remain literal data; comparison uses decoded field values,
independent of JSON member order and escapes. HTTP endpoint prefixes do not
change Worldspace scope.
Fetch responses and call interface targets additionally carry optional
`scope_ref`, an opaque string copied from the scope Object's `ref` observation.
It is not base64 and is not part of interface identity. Absent values are omitted;
null and nonstring values are rejected. Descriptor-independent call metadata
validates reference shape, but leaves scope ancestry and identity preconditions
to the Host's `InterfaceMismatch` check, preserving protocol error precedence.
Invalid success responses remain client-local `InvalidResponse` errors; protocol
error envelopes and transport failures retain their existing classification.
See the [API documentation](https://docs.rs/wip-http) for codec and failure-boundary details.
Licensed under either of Apache-2.0 or MIT at your option.