Validation: Rules Engine and Authoritative RNG Contract
Окружение#
| Параметр | Фактическое значение |
|---|---|
| Дата проверки | 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 |
| External primary source | Questing Beast — Knave, accessed 2026-07-25, Knave 1.0 |
Результаты по критериям#
| ID | Проверка | Ожидалось | Получено | Evidence | Результат |
|---|---|---|---|---|---|
| AC-01 | Complete roll evidence | Every registered roll-producing command has raw/formula/modifier/rule version and a stored event reference | Both check and attack accepted one fixed server roll; exact raw 17, modifier 2, total 19, difficulty, success, formula, rules version and source matched worked literals; each non-empty event ID resolved from the log by command ID |
prototype/rules-engine.verification.test.ts, first test; E-008 |
pass |
| AC-02 | Server RNG authority | Client/LLM result cannot become canonical | Payload with fabricated raw: 20/success: true returned schema_invalid, with 0 RNG calls and 0 events; a valid command stored controlled server raw 4 and source: "server" |
Same test file, second test; E-008 |
pass |
| AC-03 | Invalid command ordering | 100% labelled invalid fixtures stop before RNG/mutation |
All 3 labelled invalid inputs returned schema_invalid; each had 0 RNG calls, 0 events and unchanged state hash |
Same test file, third test; E-001, E-008 |
pass |
| AC-04 | Idempotency | Duplicate command appends/applies no second effect | Second identical command returned duplicate with original event ID and unchanged accepted-state hash; event count stayed 1 and RNG calls stayed 1 |
Same test file, fourth test; E-002–E-004, E-008 |
pass |
| AC-05 | Expected state version | Stale command fails before RNG/event/state mutation | Expected version 1 against current 0 returned version_conflict with state version 0; RNG calls/event count stayed 0 and state hash was unchanged |
Same test file, fifth test; E-002, E-003, E-008 |
pass |
| AC-06 | Attributed original profile | Attribution present; executable design genre-neutral and unbranded | Shared quick-kit 0.1.0 profile matched Knave 1e/Ben Milton/CC BY 4.0/official URL attribution, original abilities and d20 rule; executable fields contained no Knave/D&D branding |
Same test file, sixth test; E-005, E-006, E-008 |
pass |
Команды проверки#
From the repository root:
node --version
node --test RnD/technical/2026-07-25-rules-engine-authoritative-rng/prototype/rules-engine.verification.test.ts
npm run typecheck
Fresh observed result:
v24.14.0
tests 6
pass 6
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.
Ошибки и нестабильность#
- The first Node.js
v24.14.0executable run failed withERR_UNSUPPORTED_TYPESCRIPT_SYNTAX:FixedRandomSourceused a TypeScript constructor parameter property that built-in strip mode cannot erase. It was replaced by an ordinary field plus constructor assignment. The rerun passed all six tests. - The earlier manifest-only suite’s
2pass /5TODO result is retained inRESEARCH.mdas historical pre-registration evidence, not current behavior. - No flaky, failed, skipped or TODO cases occurred in the final run.
- Mechanical balance and RNG distribution were not measured.
Воспроизводимость#
The final suite is deterministic: fixed RNG values are explicit, fixtures are committed JSON, and every case creates fresh in-memory state/event storage. The behavior suite and root compiler were rerun after the erasable-syntax fix and produced the results above. No independent machine/OS repetition, production entropy source or durable store was exercised.
Финальный исход#
- Outcome:
pass - Обоснование: all pre-registered AC-01–AC-06 behaviors are executable and pass in the recorded environment; the shared profile is the sole attributed/original source and root strict TypeScript compilation passes.
- Что результат не доказывает: randomness quality, cryptographic fairness, distributed transactionality/idempotency, actual concurrent-writer safety, mechanical balance, fun, latency, throughput or production readiness.