feat(simulation): Sprint 18 server — 9 systems (#95 #91 #115 #242 #244 #248 #249 #256 #337) #66

Closed
jpmschweitzer wants to merge 0 commits from server into main
Owner

Summary

Sprint 18: Touch — all 9 server tickets implemented and tested (1064 tests, 0 failures).

New systems:

  • Background tier state machines — schedule/mood/relationships/job tick once per game-minute (#95, D-026)
  • NPC vision — symmetric shadowcasting for Active-tier NPCs + NpcMemory with zone inference (#115, D-011)
  • NPC player-awareness — PlayerAwareness tracks LOS duration, suspicion, routine deviation (#244)
  • Skill system & combat flag — SkillSet + CombatCapability marker (#91, D-024)
  • Social propagation — three-order trust ripple (100%/40%/20%) with cycle prevention (#249, D-029)
  • Examine mechanic — character-filtered observation text + KG DirectObservation write (#242)
  • Character pressure framework — exposure/institutional/relationship pressures in snapshot HUD (#248)
  • Save state data model — SaveStateV1 with MessagePack roundtrip tests (#256)
  • Tell state wiring — DerivedTellState confirmed in ObserverSnapshot with integration tests (#337)

Protocol: v13 → v14 (examine_result + character_pressure fields)

Test plan

  • 1064 Rust tests pass (cargo test, full suite)
  • Protocol fixtures regenerated for v14
  • Golden test updated
  • Fact-ID hook validates 44 references against 73 canonical facts
## Summary Sprint 18: Touch — all 9 server tickets implemented and tested (1064 tests, 0 failures). **New systems:** - Background tier state machines — schedule/mood/relationships/job tick once per game-minute (#95, D-026) - NPC vision — symmetric shadowcasting for Active-tier NPCs + NpcMemory with zone inference (#115, D-011) - NPC player-awareness — PlayerAwareness tracks LOS duration, suspicion, routine deviation (#244) - Skill system & combat flag — SkillSet + CombatCapability marker (#91, D-024) - Social propagation — three-order trust ripple (100%/40%/20%) with cycle prevention (#249, D-029) - Examine mechanic — character-filtered observation text + KG DirectObservation write (#242) - Character pressure framework — exposure/institutional/relationship pressures in snapshot HUD (#248) - Save state data model — SaveStateV1 with MessagePack roundtrip tests (#256) - Tell state wiring — DerivedTellState confirmed in ObserverSnapshot with integration tests (#337) **Protocol:** v13 → v14 (examine_result + character_pressure fields) ## Test plan - [x] 1064 Rust tests pass (cargo test, full suite) - [x] Protocol fixtures regenerated for v14 - [x] Golden test updated - [x] Fact-ID hook validates 44 references against 73 canonical facts
jpmschweitzer added 3 commits 2026-02-25 09:51:56 +01:00
Background tier state machines (#95), NPC vision (#115), player-
awareness behavior (#244), skill system & combat flag (#91), social
propagation (#249), examine mechanic (#242), character pressure
framework (#248), save state data model (#256), tell state wiring
(#337). Protocol version bumped 13→14 for examine_result and
character_pressure snapshot fields.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Regenerated MsgPack fixtures for protocol v14 (examine_result and
character_pressure fields). Updated golden test, serialization
assertions, and cross-language fixture generator.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
Owner

Review: server -> main — PR #66

Hoshe (Code Quality): REQUEST_CHANGES

Nine systems with strong test coverage and consistent D-010 determinism. Two concrete bugs.

# File Severity Issue
1 server/src/npc/vision.rs:144-147 warning Entities at NPC's own tile iterated twice (entities_in_range + entities_at). BTreeSet deduplicates but wastes work and is fragile. No test for non-NPC entity on same tile.
2 server/src/simulation/pressure.rs:182 warning who_knows_full_scan (documented as "not per-tick") called every 10 ticks. O(N) over all edges — acceptable at v0.1 scale but violates the method's own contract. Document or add reverse index.
3 server/src/npc/generate.rs:272 suggestion format\!("Routine schedule") — Clippy lint. Use .to_string().
4 server/src/npc/vision.rs:265 suggestion Hardcoded 10 instead of TICKS_PER_GAME_MINUTE.
5 server/src/npc/relationships.rs:299-303 suggestion Comments say "~15%" but code does 2/10 = 20%. Pick one.
6 server/src/simulation/pressure.rs:88 suggestion total() floor-truncation not documented.
7 server/src/simulation/input.rs:40-48 suggestion Dropped inputs silently warn — no test for drop-at-capacity.
8 server/src/npc/awareness.rs:74 suggestion suspicion_level is i16 but range 0–100. u8 would enforce invariant.

Tyre (Architecture): REQUEST_CHANGES

Solid sprint with clean ECS decomposition. Two issues warrant changes.

# File Severity Issue
1 server/src/content/spawn.rs:103-226 warning Content-spawned NPCs missing NpcVisionState, NpcMemory, PlayerAwareness components. Vision/awareness systems silently skip them. generate_npc() inserts these but spawn_npc() does not.
2 server/src/bridge/types.rs:41 warning Protocol version doc comment says "Current: 13" but constant is 14. Stale.
3 server/src/simulation/pressure.rs:181-186 suggestion Call site doesn't document why O(N) per-interval is acceptable despite method's warning.
4 server/src/simulation/save_state.rs:29-33 suggestion NpcMemory not in the deferred list. Document whether reset-on-load is intentional.

Verdict: CHANGES REQUESTED

Key issues: content-spawned NPCs missing components (silent no-op), vision duplicate iteration, stale protocol version comment.

## Review: server -> main — PR #66 ### Hoshe (Code Quality): REQUEST_CHANGES Nine systems with strong test coverage and consistent D-010 determinism. Two concrete bugs. | # | File | Severity | Issue | |---|------|----------|-------| | 1 | `server/src/npc/vision.rs:144-147` | warning | Entities at NPC's own tile iterated twice (`entities_in_range` + `entities_at`). BTreeSet deduplicates but wastes work and is fragile. No test for non-NPC entity on same tile. | | 2 | `server/src/simulation/pressure.rs:182` | warning | `who_knows_full_scan` (documented as "not per-tick") called every 10 ticks. O(N) over all edges — acceptable at v0.1 scale but violates the method's own contract. Document or add reverse index. | | 3 | `server/src/npc/generate.rs:272` | suggestion | `format\!("Routine schedule")` — Clippy lint. Use `.to_string()`. | | 4 | `server/src/npc/vision.rs:265` | suggestion | Hardcoded `10` instead of `TICKS_PER_GAME_MINUTE`. | | 5 | `server/src/npc/relationships.rs:299-303` | suggestion | Comments say "~15%" but code does 2/10 = 20%. Pick one. | | 6 | `server/src/simulation/pressure.rs:88` | suggestion | `total()` floor-truncation not documented. | | 7 | `server/src/simulation/input.rs:40-48` | suggestion | Dropped inputs silently warn — no test for drop-at-capacity. | | 8 | `server/src/npc/awareness.rs:74` | suggestion | `suspicion_level` is `i16` but range 0–100. `u8` would enforce invariant. | ### Tyre (Architecture): REQUEST_CHANGES Solid sprint with clean ECS decomposition. Two issues warrant changes. | # | File | Severity | Issue | |---|------|----------|-------| | 1 | `server/src/content/spawn.rs:103-226` | warning | Content-spawned NPCs missing `NpcVisionState`, `NpcMemory`, `PlayerAwareness` components. Vision/awareness systems silently skip them. `generate_npc()` inserts these but `spawn_npc()` does not. | | 2 | `server/src/bridge/types.rs:41` | warning | Protocol version doc comment says "Current: 13" but constant is 14. Stale. | | 3 | `server/src/simulation/pressure.rs:181-186` | suggestion | Call site doesn't document why O(N) per-interval is acceptable despite method's warning. | | 4 | `server/src/simulation/save_state.rs:29-33` | suggestion | `NpcMemory` not in the deferred list. Document whether reset-on-load is intentional. | ### Verdict: CHANGES REQUESTED Key issues: content-spawned NPCs missing components (silent no-op), vision duplicate iteration, stale protocol version comment.
jpmschweitzer added 1 commit 2026-02-25 10:04:25 +01:00
- vision.rs: deduplicate own-tile entity iteration, add same-tile test
- spawn.rs: add NpcVisionState, NpcMemory, PlayerAwareness to content-
  spawned NPCs (matching generate_npc)
- pressure.rs: update who_knows_full_scan doc to reflect actual call
  frequency, document O(N) acceptability at call site
- types.rs: fix stale protocol version comment (13→14)
- generate.rs: format!() → .to_string() (clippy)
- vision.rs: hardcoded 10 → TICKS_PER_GAME_MINUTE
- relationships.rs: fix comment "15%" → "20%" to match code
- pressure.rs: document total() floor-truncation
- save_state.rs: document NpcMemory exclusion as intentional

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
Owner

Review Round 2: server -> main — PR #66

Hoshe (Code Quality): APPROVE

All 4 round 1 warnings confirmed fixed:

  1. Vision dedup — Single-pass with self-exclusion. Test added.
  2. who_knows_full_scan — Both sides documented.
  3. Content-spawn componentsNpcVisionState, NpcMemory, PlayerAwareness inserted with parity comment.
  4. Protocol version — Updated to 14.
# File Severity Issue
1 relationships.rs:367 suggestion Docstring says 15%, code does 20%.
2 input.rs suggestion Drop-at-capacity test still missing.

Tyre (Architecture): APPROVE

All issues resolved. Component insertion correct. NpcMemory reset-on-load documented as intentional.

# File Severity Issue
1 spawn.rs suggestion Test doesn't assert the 3 new components.

Verdict: APPROVED

Ready to merge.

## Review Round 2: server -> main — PR #66 ### Hoshe (Code Quality): APPROVE All 4 round 1 warnings confirmed fixed: 1. **Vision dedup** — Single-pass with self-exclusion. Test added. 2. **`who_knows_full_scan`** — Both sides documented. 3. **Content-spawn components** — `NpcVisionState`, `NpcMemory`, `PlayerAwareness` inserted with parity comment. 4. **Protocol version** — Updated to 14. | # | File | Severity | Issue | |---|------|----------|-------| | 1 | `relationships.rs:367` | suggestion | Docstring says 15%, code does 20%. | | 2 | `input.rs` | suggestion | Drop-at-capacity test still missing. | ### Tyre (Architecture): APPROVE All issues resolved. Component insertion correct. NpcMemory reset-on-load documented as intentional. | # | File | Severity | Issue | |---|------|----------|-------| | 1 | `spawn.rs` | suggestion | Test doesn't assert the 3 new components. | ### Verdict: APPROVED Ready to merge.
jpmschweitzer closed this pull request 2026-02-25 10:09:36 +01:00

Pull request closed

This pull request cannot be reopened because the branch was deleted.
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jpmschweitzer/settled-reach#66