refactor(simulation): PR #137 review — audit override + regression tests + docs

Addresses Tyre, Hoshe, and lead review comments on PR #137:

- **Audit doc amendment** (Tyre E1 / Hoshe H1 / Lead): add "Lead override
  (2026-04-21)" section at top of docs/architecture/sprint-37-878-audit.md.
  Rewrites the conclusion to "DECISION: STRIP" with the cascade-based
  rationale. Preserves the original audit body as the pre-override record.

- **Regression tests** (Lead 2a-2b / Hoshe H2 / H3): add POSITIVE
  assertions of the new uniform behavior so silent reintroduction fails.
  - `phase2_container_verb_labels_uniform_regardless_of_player_state` —
    two trials (empty KG, POI-bearing KG) assert container verb labels
    equal Phase-1 defaults.
  - `monologue_pool_selection_uniform_no_archetype_key` — two observers
    with divergent MonologueState both draw from OBSERVE_NPC_LINES.

- **Decision record amendments** (Lead 3 / Tyre S2): D-032, D-035, and
  D-057 amended with Phase 6 deferral wording. "Retired pending Phase 6,
  not deferred with scaffolding." Reintroduction gate: a confirmed
  Phase 6 character-model design.

- **types.rs doc fixes** (Tyre S1 / Hoshe H5): StartupMessage protocol-
  flow comment updated to reflect no-version handshake (D-192).
  ObserverSnapshot version-history block grows a "Sprint 37 wire-format
  shifts" section documenting D-192 + #878 schema drops.

- **observer/tests.rs:944 comment** (Hoshe H6): rewritten to cite
  cascade rationale instead of the stale D-032-SUPERSEDED premise.

- **tests/run-atlas-determinism exit** (Hoshe H7): exit 0 when EXIT_CODE=2
  (venv/DB missing = skip, not fail). Preserves skip semantics for
  tests/run-all on machines without the Python venv.

Follow-up tickets filed:
- #895 (server, low): expand check-systems-db-stamp GENERATOR_SOURCES
  to cover gemma_naming.py + naming_core.py (Tyre S3).
- #896 (planning, low): add CLAUDE.md carveout for server wiki writes
  closing coverage gates (Tyre S4 / Hoshe H8).

H4 investigation: v01_integration_playthrough.rs was not the only E2E
handshake→tick→snapshot test; coverage preserved by bridge_ipc.rs,
bridge_tcp.rs, and game_loop.rs (the latter is pre-existing-broken
per #885). No replacement test needed.

1142/1142 lib tests pass. cargo clippy -- -D warnings clean.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-22 10:09:35 +02:00
co-authored by Claude Opus 4.6
parent 8f46048a75
commit b86bb00a55
7 changed files with 356 additions and 19 deletions
+13 -6
View File
@@ -23,12 +23,11 @@ pub struct HandshakeMessage {}
/// Startup message sent by the client after receiving HandshakeMessage (#175).
/// Contains the world seed for deterministic simulation (D-010, D-029).
///
/// Protocol flow:
/// Protocol flow (D-192: no version field, no validation step):
/// 1. Server sends HandshakeMessage (server → client)
/// 2. Client validates protocol_version
/// 3. Client sends StartupMessage (client → server)
/// 4. Server reads world_seed, initializes SimRng
/// 5. Normal tick loop begins
/// 2. Client sends StartupMessage (client → server)
/// 3. Server reads world_seed, initializes SimRng
/// 4. Normal tick loop begins
///
/// Wire format: MessagePack, same 4-byte length-prefixed framing.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
@@ -65,13 +64,21 @@ pub struct StartupMessage {
/// sim_errors (#85, structured error reporting to client).
/// v18 adds: debug_response (#580, debug console server — command/response wire).
/// v19 adds: current_ticker (#591). (character_archetype on StartupMessage was
/// added in #587 and removed in Sprint 37 per D-032 purge / cascade cleanup.)
/// added in #587 and removed in Sprint 37 — see "Sprint 37 wire-format shifts" below.)
/// v20 adds: settings_response (#627, SQLite settings IPC).
/// v21 adds: economy_snapshot (#822, D-181 7-signal snapshot per queried system),
/// EconStateQuery PlayerAction variant (#822).
/// v22 adds: bookmark_catalog (#614, D-115/D-117 CK3-style bookmark system),
/// RequestBookmarkCatalog + ConfirmBookmark PlayerAction variants (#614).
/// v23 removes: conversation_events, conversation_ended (D-078 scrapped per R-012).
/// Sprint 37 wire-format shifts (no snapshot-version bump needed — PROTOCOL_VERSION lockstep gone):
/// - D-192 (#874): `PROTOCOL_VERSION` field removed from `HandshakeMessage`. The
/// handshake is now an empty marker ("server ready"); there is no negotiated
/// version field on the wire. Genuine schema drift surfaces as MessagePack
/// missing-field errors downstream — that is the intended signal per D-192.
/// - #878 (cascade cleanup): `character_archetype` field removed from
/// `StartupMessage`. This protocol break rides the D-192 drop.
///
/// Future fields: ambient sound events, HUD state (D-020 expansion).
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ObserverSnapshot {