RnD · Линия доказательств Technical R&D
Каталог и оглавление
TECH.DOC RnD/technical/2026-07-25-game-contract-canonical-state/VALIDATION.md raw.md ->

Validation: Game Contract and Canonical State Boundary

Окружение#

Параметр Фактическое значение
Дата проверки 2026-07-25
Commit Git snapshot not used: concurrent uncommitted work is present; base HEAD observed as 68582c97cb6b51804532cbd021290f07f4f74fa5
OS и hardware macOS 26.4 (25E246), arm64
Runtime Node.js v24.14.0, built-in TypeScript strip mode, no experimental flag
Compiler Root TypeScript 7.0.2 through npm run typecheck
Внешние сервисы none
Входные данные Shared synthetic fixtures loaded by loadFixtureBundle(), including authoritative game-contract.json

Результаты по критериям#

ID Проверка Ожидалось Получено Evidence Результат
AC-01 Schema-invalid commands before mutation 100% labelled invalid fixtures stop before RNG/commit and leave state/event evidence unchanged All 6 labelled invalid payloads returned schema_invalid; RNG calls 0, event count 0, state hash unchanged and state version 0 in every case prototype/game-contract.verification.test.ts, first test; E-008 pass
AC-02 LLM mutation capability Forbidden mutation output cannot change canonical state or stored event Narrator mutated its projection and returned an extra statePatch; initial canonical state stayed unchanged, accepted state equalled authoritative event replay, HP was not -999, and exactly one stored event matched the returned event Same test file, second test; E-006, E-008 pass
AC-03 Versioned executable schema Valid fixture accepted; missing, ill-typed and unsupported versions rejected structurally Valid 1.0.0 bundle accepted; missing contractVersion and numeric stateVersion rejected; unsupported contract/state 999.0.0 each returned a schema_const issue at /game/contractVersion and /game/stateVersion Same test file, two AC-03 tests; E-007E-009 pass
AC-04 Visibility projections 0 unauthorized facts in registered adversarial participant projections Exact fact allow-lists matched for Juno, Mara and Pax; GM-only and other-branch facts were absent until scope permitted them; public visibility followed the explicit known-by rule Same test file, final test; E-008 pass

Команды проверки#

From the repository root:

node --version
node --test RnD/technical/2026-07-25-game-contract-canonical-state/prototype/game-contract.verification.test.ts
npm run typecheck

Fresh observed result:

v24.14.0
tests 5
pass 5
fail 0
cancelled 0
skipped 0
todo 0

> tsc --project tsconfig.json --noEmit
exit 0

The Node command uses built-in TypeScript strip mode; no --experimental-strip-types flag is required on the recorded runtime.

Ошибки и нестабильность#

  • Historical stub execution on Node.js v22.14.0 first failed with ERR_UNKNOWN_FILE_EXTENSION; that environment and TODO-only result are retained in RESEARCH.md but do not describe the final run.
  • The first root typecheck rejected a direct NarrationResult object literal with the deliberately forbidden extra statePatch. The fixture now returns an inferred structural value, preserving the malicious runtime field while satisfying the adapter’s declared result type. Final root typecheck passes.
  • An intermediate AC-03 characterization showed that unsupported 999.0.0 versions were accepted. Supported-version validation was added to the shared implementation; the final tests assert exact structured rejection paths and codes.
  • No flaky, skipped or TODO tests occurred in the final run.

Воспроизводимость#

The final suite is deterministic: fixtures are committed JSON, every case uses fresh in-memory state/event storage, and RNG behavior is fixed where needed. The final command was rerun locally after the shared version fix and produced the result above. No independent machine/OS repetition or production-service run has occurred.

Финальный исход#

  • Outcome: pass
  • Обоснование: all pre-registered AC-01–AC-04 behaviors are executable and pass in the recorded environment; root strict TypeScript compilation also passes.
  • Что результат не доказывает: production reliability, durable or multi-process concurrency, migration behavior beyond the current supported version, downstream UI/retrieval/TTS/image privacy, or production readiness.