swactor/crates/provisioning/tests/plugin_conformance.rs
Zachery Aaron Shores-Chmielewski 9ea17edec1 test(provisioning): stateful conformance kit for reconciler and plugins
Replace pointwise scenario testing with a reusable conformance kit in
tests/common: a deterministic trace harness (input alphabet, seeded
generator, naive shrinker), an invariant oracle covering twenty black-box
guarantees (identity, correlation, dead-hold, attempt-fact ownership,
quiescence no-op, monotonic generation, fair convergence, bounded
replacement), and a fair-scheduler tail asserting eventual reconciliation.

Three conformance levels run the same battery:
- FakeBackend: the reference in-memory substrate (256 seeds x 2 modes)
- PluginBackendAdapter over FakePlugin: seam contracts plus the battery
- ProcessPlugin: real child processes, faults as real signals/errors;
  "no double-create" and "converged leaks nothing" verified by counting
  live PIDs (16 seeds)

Also documents two seam findings the battery surfaced: ProvisionPlugin
cannot express ambiguity (kit convention: AMBIGUOUS_FAULT_MARKER error
reclassified by the adapter; definite classification leaks provider
resources) and spawn_effect closures form a spawner Arc cycle that leaks
backends under queue-based spawners (kit breaks it at harness drop).
2026-08-14 19:21:46 +04:00

25 lines
694 B
Rust

//! Plugin-level conformance: the kit's reference in-memory plugin runs
//! the seam contracts and the full trace battery through the real
//! `PluginBackendAdapter` — one conformance level below the fake
//! backend, still without leaving the crate.
mod common;
use common::{assert_plugin_contracts, run_trace_battery, FakePlugin, PluginBackendAdapter};
#[test]
fn in_memory_plugin_passes_seam_contracts() {
let mut plugin = FakePlugin::default();
assert_plugin_contracts(&mut plugin);
}
#[test]
fn in_memory_plugin_battery_holds_invariants_and_converges() {
run_trace_battery(
|| PluginBackendAdapter::new(FakePlugin::default()),
256,
64,
);
}