Standardize unimplemented API failures

This commit is contained in:
2026-08-08 11:44:46 +02:00
parent 3179d7a57d
commit d3f5e27f52
41 changed files with 1875 additions and 1608 deletions

View File

@@ -254,6 +254,27 @@ must have their real values. Never return plausible defaults such as `false`,
zero, an empty collection, or a nil UUID: those could make translated tests pass
for the wrong reason.
The failure contract lives in `libremetaverse-types` and every API crate exposes
it as `crate::Error`:
- synchronous fallible members return `Err(NotImplemented::new(CSHARP_ID))`;
async members do the same when first polled and start no work first;
- a stream-producing operation returns the typed error before exposing a
stream; an intrinsically infallible stream factory uses `unimplemented_api!`
instead of returning an empty stream;
- callback registration and stored-trait construction fail before retaining the
callback/object; generated callbacks are never silent no-ops;
- infallible constructors, accessors, operators, and trait methods call
`unimplemented_api!(CSHARP_ID)`, whose panic marker is distinct from every
typed domain error;
- constants, enum discriminants, flags, and inert public fields use their real
catalog values/layout. Generated shims do not derive `Default` unless the
reviewed API explicitly defines that behavior.
`python3 tools/generate_rust_mapping.py --check` scans every generated shim and
rejects `Default` derives, plausible false/zero/empty/nil returns, and any
function body that lacks the standardized typed error or panic mechanism.
The signature gate is complete only when:
- the metadata catalog reports 100% public type/member mapping coverage for all