feat(example): restore virtual workspace conformance
This commit is contained in:
@@ -2,9 +2,12 @@
|
||||
|
||||
Rust building blocks for the Web Interface Protocol (WIP).
|
||||
|
||||
The repository currently provides a transport-independent protocol model, a
|
||||
Rust interface-authoring facade, and a request-scoped host runtime. HTTP and
|
||||
other transport bindings are intentionally outside the supported slice.
|
||||
The repository is a resolver-3 virtual Cargo workspace whose packages all live
|
||||
under `crates/*`. It provides a transport-independent protocol model, a Rust
|
||||
interface-authoring facade, a request-scoped host runtime, and a private
|
||||
public-API conformance consumer. The repository root is not itself a package.
|
||||
HTTP and other transport bindings are intentionally outside the supported
|
||||
slice.
|
||||
|
||||
## Crate graph and responsibilities
|
||||
|
||||
@@ -36,19 +39,25 @@ or application traits.
|
||||
|
||||
## End-to-end example
|
||||
|
||||
[`src/lib.rs`](src/lib.rs) is the complete public-API example and
|
||||
[`src/main.rs`](src/main.rs) runs it. It demonstrates all of the following:
|
||||
[`crates/wip-public-api-example/src/lib.rs`](crates/wip-public-api-example/src/lib.rs)
|
||||
is the complete public-API example and
|
||||
[`crates/wip-public-api-example/src/main.rs`](crates/wip-public-api-example/src/main.rs)
|
||||
runs it. It demonstrates all of the following:
|
||||
|
||||
1. public application DTOs derived as `WipType` records and unions;
|
||||
1. public application DTOs derived as `WipType` records, enums, and unions,
|
||||
including canonical entry paths and schema-opaque JSON;
|
||||
2. two public traits declared with `#[wip::interface]`;
|
||||
3. a private host struct implementing both traits;
|
||||
4. explicit publication of both interfaces on one object;
|
||||
5. registry observation and validation of generated descriptors;
|
||||
6. calls made with interface references, operation names, and `Value` arguments;
|
||||
4. explicit publication of both interfaces as an ordered set on one object;
|
||||
5. separate observation of opaque interface references, descriptors, and
|
||||
descriptor validators;
|
||||
6. calls qualified by `target.path`, object validator, interface reference and
|
||||
validator, operation, and schema-neutral `Value` arguments;
|
||||
7. validated result values decoded back to the typed application result;
|
||||
8. independent dispatch of the same `status` operation name on both interfaces;
|
||||
9. a domain rejection returned as data and a backend failure returned as a host
|
||||
error.
|
||||
9. distinct domain rejection, host/backend failure, `PermissionDenied`, stale
|
||||
validator recovery, interface membership, and lookup failure codes; and
|
||||
10. canonical failure precedence when several request fields are invalid.
|
||||
|
||||
Run it inside the development shell:
|
||||
|
||||
@@ -57,10 +66,16 @@ nix develop
|
||||
cargo run --package wip-public-api-example
|
||||
```
|
||||
|
||||
The normal integration test is in [`tests/end_to_end.rs`](tests/end_to_end.rs).
|
||||
Unit tests beside the example additionally cover every host dispatch failure,
|
||||
invalid arguments and results, interface membership, validators, and
|
||||
same-named operations.
|
||||
The public-only conformance suite is in
|
||||
[`crates/wip-public-api-example/tests/end_to_end.rs`](crates/wip-public-api-example/tests/end_to_end.rs).
|
||||
It covers canonical object/descriptor shape, ordered interfaces,
|
||||
schema-neutral record/enum/union/entry/JSON values, fully qualified calls, and
|
||||
the distinct domain, host, authorization, validator-recovery, and interface
|
||||
failure classes. Exhaustive public type construction and matching make legacy
|
||||
ObjectId, descriptor `name`, and semantic `Value` variants compile-time
|
||||
regressions. Unit tests in the public crates additionally cover every host
|
||||
dispatch failure, invalid arguments and results, interface membership,
|
||||
validators, and same-named operations.
|
||||
|
||||
## Interface authoring
|
||||
|
||||
@@ -208,10 +223,14 @@ nix develop
|
||||
cargo fmt --all -- --check
|
||||
cargo check --workspace --all-targets
|
||||
cargo test --workspace --all-targets
|
||||
cargo test --workspace --doc
|
||||
cargo clippy --workspace --all-targets -- -D warnings
|
||||
RUSTDOCFLAGS='-D warnings' cargo doc --workspace --no-deps
|
||||
cargo run --package wip-public-api-example
|
||||
git diff --check
|
||||
```
|
||||
|
||||
`cargo test --workspace --all-targets` includes the public example integration
|
||||
test, runtime failure tests, and `trybuild` compile-fail suites. Run
|
||||
`cargo test --workspace --doc` when validating the checked rustdoc examples
|
||||
separately.
|
||||
`cargo test --workspace --all-targets` includes the public-only conformance
|
||||
consumer, runtime failure tests, and `trybuild` compile-fail suites. The separate
|
||||
doctest, rustdoc, executable, and whitespace checks are all required acceptance
|
||||
steps.
|
||||
|
||||
Reference in New Issue
Block a user