undef-engine 2026-03-26
Game audit remediation, NPC improvements, PhaseEngine rollback, extensive test coverage
75 files · 7,277+ · 1,792-

PhaseEngine hook rollback and games_loaded ping

3 files changed
  • _phase_engine.py Hook exception handling standardized across all hook types; rollback now includes Pydantic private attrs; fixed kwargs leak
  • test_ping_route.py 72-line test for /api/ping including games_loaded field
  • test_ping_route.py Updated ping route tests
  • PhaseEngine hook exceptions now handled consistently across all hook types. Rollback corrected to include Pydantic private attrs that were previously missed. /api/ping health response now includes games_loaded count. instantiate behavioral
    1 file
    • _phase_engine.py

out_of_spec NPC and faux_facts category-aware lies

2 files changed
  • npc_actions.py Category-aware lie generation in faux_facts NPC
  • npc_actions.py New out_of_spec NPC support
  • faux_facts NPC updated to generate category-aware lies rather than generic false statements. out_of_spec NPC handler added as a new game type with full NPC action support. instantiate behavioral
    1 file
    • npc_actions.py

Typed action payload models

1 file changed
  • payloads.py New module: typed Pydantic payload models for undef_character action payloads
  • Added payloads.py to undef_character with typed Pydantic models for all action payload types, replacing untyped dict access throughout the game’s hooks. instantiate behavioral
    1 file
    • payloads.py

Game audit remediation: NPC handlers and config fixes

6 files changed
  • npc_actions.py NPC handlers registered for hot_potato_heist
  • npc_actions.py NPC handlers registered for liars_hand
  • npc_actions.py Handlers for join_team, volunteer_spymaster, give_clue, guess
  • npc_actions.py Shims added for cipher/redaction NPC actions
  • lifecycle.py Restructured from hooks_class.py to standard flow/hooks/ pattern
  • lifecycle.py Fixed level kwarg renamed to character_level to avoid structlog reserved key conflict
  • Game audit 2026 identified 33 items across 18 games. 29 are now resolved. Key fixes: NPC handlers registered for hot_potato_heist, liars_hand, cipher; PDQ frontend registry key fixed; hasattr guards removed in TP NPC submission check (typed attributes used directly); dial_in restructured to standard hooks/ directory pattern. remediate behavioral
    4 files
    • npc_actions.py
    • npc_actions.py
    • npc_actions.py
    • lifecycle.py

React hook extractions

2 files changed
  • useLobbyActions.ts isHost and currentPlayers moved to useLobbyActions hook return
  • App.tsx useTokenRefresh and useSessionRestoration extracted
  • useLobbyActions hook now returns isHost and currentPlayers instead of them living in component state. useTokenRefresh and useSessionRestoration extracted from App.tsx as standalone hooks. decouple internal
    1 file
    • App.tsx

In-memory sliding window fallback for WebSocket rate limiter

1 file changed
  • rate_limiting.py Added in-memory sliding window as fallback when Redis backend unavailable; added ws_ratelimit_redis_fallback counter metric
  • WebSocket rate limiter now falls back to an in-memory sliding window implementation when Redis is unavailable, rather than failing open. Added ws_ratelimit_redis_fallback counter metric to track fallback activations. harden behavioral
    1 file
    • rate_limiting.py

Game documentation: NPC patterns, primitives guide, anatomy, checklist

5 files changed
  • NPC_PATTERNS.md Three strategy tiers and NPC testing guide
  • WHICH_PRIMITIVE.md Decision table for 35 engine primitives including Scoreboard, Deck/Hand/Pile, ActivityStack
  • GAME_ANATOMY.md Required/optional files guide with GamePluginBase examples
  • NEW_GAME_CHECKLIST.md 11 gate criteria and verification commands
  • game-audit-2026.md 18 games, 8-criterion rubric, 33-item remediation backlog; updated post-remediation showing 29/33 resolved, 13/18 fully compliant
  • Comprehensive game development docs: NPC_PATTERNS.md with three tier patterns and testing guide; WHICH_PRIMITIVE.md decision table for all 35 engine primitives; GAME_ANATOMY.md with canonical reference game (reaction) annotations; NEW_GAME_CHECKLIST.md with 11 gate criteria; game-audit-2026.md tracking remediation progress. specify internal
    5 files
    • NPC_PATTERNS.md
    • WHICH_PRIMITIVE.md
    • GAME_ANATOMY.md
    • NEW_GAME_CHECKLIST.md
    • game-audit-2026.md

Massive test coverage expansion

6 files changed
  • test_engine.py 53-line engine phase tests
  • test_post_lock.py 14-line post-lock tests
  • test_rate_limiting.py 59-line rate limiting tests
  • test_schemas.py 505-line schema tests
  • test_server_defaults.py 368-line server defaults tests
  • test_factory.py 37-line storage factory tests
  • Added thousands of unit tests across NPC handlers (cipher, TP, reaction, warp, PDQ, liars_hand, hot_potato_heist, sinky_boat, out_of_spec), game hooks (debate_club, peer_review, sick_day, swarm_think, vote_blind, dice_roll), engine primitives, session rehydration, server defaults, and exception hierarchy. Hollow exception assertions replaced with behavioral checks. qualify internal
    2 files
    • test_schemas.py
    • test_server_defaults.py