Skip to content

Module 5: Game Hosting Architecture (backend) - #8

Merged
MohanEhab merged 3 commits into
mainfrom
feature/module-05-game-hosting-architecture
Jul 11, 2026
Merged

Module 5: Game Hosting Architecture (backend)#8
MohanEhab merged 3 commits into
mainfrom
feature/module-05-game-hosting-architecture

Conversation

@MohanEhab

Copy link
Copy Markdown
Contributor

Summary

  • Adds the Module 5 GameHost plugin-contract layer: a typed IGameDefinition<TState,TCommand,TPlayerView> contract, a non-generic host adapter, a TryResolve(slug, engineVersion) registry, an allow-listed System.Text.Json codec with a checksummed byte envelope, a PCG32-v1 deterministic RNG, a size/budget/redaction invoker boundary, and a catalog/engine-compatibility validator.
  • Deletes the three orphaned, unimplemented legacy stubs (IGameEngine.cs, GameSession.cs, and the old IGameRegistry.cs contract) they replace.
  • Backend-only: no EF entity/migration, no public route, no frontend change. Module 4's game-library UI is untouched.

What changed

  • feat: GameHost domain contracts (envelopes, RNG, error codes) + removal of legacy stubs
  • feat: GameHost application services (codec, registry, invoker, catalog validator) + DI/Program.cs wiring with startup fail-fast on duplicate/mismatched catalog entries
  • test: 177 unit + 12 integration tests (189/189 passing), including a two-process golden-vector determinism proof and a Stopwatch benchmark

Tests

  • dotnet test --filter "FullyQualifiedName~GameHost": 189/189 passed (177 unit + 12 integration)
  • Full solution: 589/589 unit, 231/231 non-skipped integration passed (52 skipped — pre-existing real-Postgres group, unrelated to this module)
  • Two independently launched dotnet test processes produced byte-identical golden-vector SHA-256 hashes (10/10 vectors)
  • GameHostBenchmarkTests: p95 = 0.0293 ms (budget < 25 ms), max single command 12.1803 ms (soft budget ≤ 100 ms)
  • check-contract-drift.mjs: DRIFT=0 (no new route/frontend surface)

Security/docs

  • --security=asvs-lite backend review complete: zero unwaived Critical/High/Medium findings. 3 deferred non-blocking findings (M05-001 Low, M05-002/M05-003 Info) — see SimPle.Project/docs/security/audits/module-05-game-hosting-architecture.md.
  • Module docs (api-reference.md, technical-flow.md, testing-report.md) are in the companion SimPle.Project PR.

Risks/deferred

  • In-process isolation for hostile plugins is an explicit non-goal (documented residual risk); the soft/hard timing budgets, two-process determinism check, and code review are the only guards.
  • Zero product game engines are registered in Phase 1 (Array.Empty<IHostedGameDefinition>() in Program.cs) — intentional, valid state.
  • Match lifecycle, persistence, AI, rating/stats, matchmaking, and presence/chat are explicitly out of scope, owned by Modules 6–10.

@MohanEhab
MohanEhab merged commit fcacd93 into main Jul 11, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant