Prove the consumer ingress at every gate it names

Twenty-three tests: the three Delvehold negative proofs (an ordinary
strategic wave cannot select an externally controlled mirror through
opportunities, adjacency, the cover, or a hand-built opportunity; a malformed,
oversize, stale, or structurally broken batch commits nothing; a consumer's
transfer into a Ghostlight subject is refused on the unbound endpoint while
the owner's identical transfer commits), the inbound-bytes-to-receipt run with
its journal replay, idempotent resubmission and key conflict, the capability
pairing, the confinement rows, the phase rule in both directions, the shared
decode bound, the transport gates on the new route, and replay equality with a
prior-schema store refused.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-05 03:52:53 +02:00
commit b4d1943585
3 changed files with 1390 additions and 1 deletions

View file

@ -2377,6 +2377,43 @@ mod tests {
}
}
/// The consumer door's two transport gates, the same two
/// `/cultnet/snapshot` established. Everything past them belongs to
/// `world::consumer`, which is tested there.
#[tokio::test]
async fn a_non_loopback_peer_is_forbidden_and_a_wrong_content_type_is_unsupported() {
let fixture = fixture().await;
let request = |peer: &str, content_type: &str| {
Request::builder()
.method("POST")
.uri("/cultnet/world-patch")
.extension(ConnectInfo(peer.parse::<SocketAddr>().unwrap()))
.header(header::CONTENT_TYPE, content_type)
.body(Body::from(Vec::new()))
.unwrap()
};
let remote = api_router(fixture.state.clone())
.oneshot(request("192.0.2.9:39001", "application/msgpack"))
.await
.unwrap();
assert_eq!(remote.status(), StatusCode::FORBIDDEN);
let wrong_media = api_router(fixture.state.clone())
.oneshot(request("127.0.0.1:39001", "application/json"))
.await
.unwrap();
assert_eq!(wrong_media.status(), StatusCode::UNSUPPORTED_MEDIA_TYPE);
// A loopback peer with the right media type reaches the ingress, which
// refuses an empty frame with a receipt rather than a status.
let admitted = api_router(fixture.state.clone())
.oneshot(request("127.0.0.1:39001", "application/msgpack"))
.await
.unwrap();
assert_eq!(admitted.status(), StatusCode::OK);
}
#[tokio::test]
async fn http_route_probe_bypasses_provider_and_enforces_exact_admission() {
let mut fixture = fixture().await;

File diff suppressed because it is too large Load diff

View file

@ -469,7 +469,7 @@ fn verify_commitments_are_future(
Ok(())
}
fn verify_state_shape(state: &WorldState) -> Result<(), JournalError> {
pub(super) fn verify_state_shape(state: &WorldState) -> Result<(), JournalError> {
if state.schema != STATE_SCHEMA {
return Err(JournalError::Corrupt("invalid state schema".into()));
}