Files
settled-reach/server/tests/integration/mod.rs
T
jpmschweitzerandClaude Opus 4.6 6ed8d11502 feat(simulation): Sprint 19 — 7 server systems
Protocol handshake (#555): HandshakeMessage as first IPC frame,
HandshakeState resource, forward-compatible input handling.

State serialization (#96): serialize_npc_to_frozen/deserialize with
full D-024 axis coverage (10 new optional fields on NpcSaveState).

Scope tags (#98): ScopeTagKind enum, ScopePinned marker, automatic
assignment from KnowledgeGraph and RelationshipGraph.

Timestamp eviction (#97): LastInteractionTick, SimSpacePressure,
BinaryHeap LRU eviction respecting ScopePinned entities.

Save/load (#553): save_to_file/load_from_file via MessagePack,
SaveGame/LoadGame IPC commands, SaveLoadResultWire on snapshot.

Test infrastructure (#200): Layer 3 integration test entry point,
three-layer architecture documented per D-030.

Information boundary tests (#272): 4 negative tests proving no
passive KG leakage, LOS fog holds, tier boundary holds, save
isolation per NPC.

1063 tests passing, 0 failures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 12:13:03 +01:00

61 lines
3.0 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//! Layer 3 integration test entry point (D-030, ticket #200).
//!
//! ## Three-layer test architecture (D-030 sub-decision 3)
//!
//! ```text
//! Layer 1 — Fixture-based serialization (FAST, run on every edit)
//! Scope: Pure unit tests. No ECS world. No subprocess.
//! Tools: Rust #[test] + data structures directly.
//! Speed: <1ms each.
//! Files: tests/serialization.rs, tests/information_boundaries.rs (Layer 1 tests),
//! #[cfg(test)] mod tests within src/ modules
//!
//! Layer 2 — Mock subprocess / minimal ECS world (MEDIUM, run on every PR)
//! Scope: Minimal bevy App or World. Real systems, no real subprocess.
//! IPC roundtrip over Unix socket without spawning the binary.
//! Tools: bevy_ecs World + Schedule, or LocalBridge with in-process simulation.
//! Speed: 1ms100ms each.
//! Files: tests/bridge_ipc.rs, tests/bridge_tcp.rs,
//! tests/information_boundaries.rs (Layer 2 tests),
//! tests/determinism.rs, tests/movement.rs, tests/smoke.rs
//!
//! Layer 3 — Real subprocess integration (SLOW, run daily / pre-merge)
//! Scope: Full binary spawned as a child process. No mocks. Real IPC.
//! Exercises the complete path: spawn → handshake → tick → snapshot.
//! Tools: std::process::Command, TcpStream.
//! Speed: 1s15s each (process startup dominates).
//! Files: tests/layer3.rs, tests/integration/ (this module)
//! ```
//!
//! ## Layer 3 test guidelines
//!
//! - Always set a deadline for server startup (`LISTEN_TIMEOUT`).
//! - Always kill the child process in teardown (even on test failure — use a
//! RAII guard or drop the handle at end of test).
//! - Use `--port 0` to get a kernel-assigned port; parse `LISTENING:{port}` from
//! stdout to obtain the actual port.
//! - Serialize `PlayerInput` via `rmp_serde`, frame with `bridge::framing::write_framed`.
//! - Deserialize `ObserverSnapshot` via `rmp_serde` after `bridge::framing::read_framed`.
//!
//! Spec reference: D-030 (testability architecture), D-020 (subprocess IPC protocol)
// ---------------------------------------------------------------------------
// Stub: Layer 3 startup smoke test
// ---------------------------------------------------------------------------
/// Placeholder for future Layer 3 tests that require full subprocess setup.
///
/// Non-blocking tests that exercise the simulation binary end-to-end live in
/// `tests/layer3.rs`. This module is the organisational entry point for tests
/// that exercise multi-message Layer 3 scenarios (multi-tick sequences,
/// save/load roundtrip over IPC, protocol version negotiation).
///
/// See `tests/layer3.rs::server_subprocess_sends_snapshot_on_connect` for the
/// canonical Layer 3 pattern.
#[test]
fn layer3_module_entry_point_placeholder() {
// This test exists to verify the integration module compiles and is
// discovered by cargo test. Real Layer 3 scenario tests replace this.
// D-030 Layer 3 stubs are acceptable until the IPC handshake (#555) lands.
}