|
| 1 | +# BUILD_PR_LEVEL_12_2_AUTHORITATIVE_SERVER_RUNTIME |
| 2 | + |
| 3 | +## Purpose |
| 4 | +Implement the first authoritative server runtime slice on top of Level 12.1 transport/session contracts with no engine API breakage. |
| 5 | + |
| 6 | +## Scope |
| 7 | +Primary target files: |
| 8 | +- `src/engine/network/AuthoritativeServerRuntime.js` |
| 9 | +- `src/engine/network/AuthoritativeInputIngestionContract.js` |
| 10 | +- `src/engine/network/index.js` |
| 11 | +- `tests/final/MultiplayerNetworkingStack.test.mjs` |
| 12 | +- `docs/pr/LEVEL_12_2_AUTHORITATIVE_SERVER_RUNTIME_CONTRACTS.md` |
| 13 | + |
| 14 | +Allowed nearby reads: |
| 15 | +- `src/engine/network/TransportContract.js` |
| 16 | +- `src/engine/network/SessionLifecycleContract.js` |
| 17 | +- `src/engine/network/HandshakeSimulator.js` |
| 18 | +- `src/engine/network/HostServerBootstrap.js` |
| 19 | +- `docs/pr/LEVEL_12_1_REAL_NETWORK_FOUNDATION_CONTRACTS.md` |
| 20 | + |
| 21 | +## Required implementation |
| 22 | +- Add an authoritative server runtime contract with an isolated tick loop that can run independently of gameplay code. |
| 23 | +- Add a client input ingestion contract that validates and normalizes input envelopes before queueing. |
| 24 | +- Enforce server-owned state boundaries so only server runtime code mutates authoritative state snapshots. |
| 25 | +- Keep handshake simulation compatible and testable with Level 12.1 foundations. |
| 26 | +- Export new runtime/contract symbols additively from `src/engine/network/index.js` only. |
| 27 | +- Extend `tests/final/MultiplayerNetworkingStack.test.mjs` with focused assertions for: |
| 28 | + - runtime loop start/step/stop behavior |
| 29 | + - input ingestion acceptance and rejection paths |
| 30 | + - server ownership boundary protection |
| 31 | + - existing handshake simulation still passing |
| 32 | + |
| 33 | +## Acceptance criteria |
| 34 | +- Server runtime contract documented and implemented. |
| 35 | +- Input ingestion contract documented and implemented. |
| 36 | +- Authoritative ownership boundaries are enforced by runtime behavior and tests. |
| 37 | +- No existing engine network exports are removed or renamed. |
| 38 | +- Existing handshake simulation remains green. |
| 39 | + |
| 40 | +## Validation |
| 41 | +Run only: |
| 42 | +- `node --check src/engine/network/AuthoritativeServerRuntime.js` |
| 43 | +- `node --check src/engine/network/AuthoritativeInputIngestionContract.js` |
| 44 | +- `node --input-type=module -e "import('./tests/final/MultiplayerNetworkingStack.test.mjs').then(async ({ run }) => { await run(); console.log('PASS MultiplayerNetworkingStack'); })"` |
| 45 | +- `node --input-type=module -e "import('./tests/production/EnginePublicBarrelImports.test.mjs').then(async ({ run }) => { await run(); console.log('PASS EnginePublicBarrelImports'); })"` |
| 46 | + |
| 47 | +## Non-goals |
| 48 | +- no replication implementation |
| 49 | +- no gameplay coupling |
| 50 | +- no UI/debug expansion |
| 51 | +- no engine core API redesign |
| 52 | +- no repo-wide cleanup or unrelated refactor |
| 53 | + |
| 54 | +## Working tree rule |
| 55 | +If the tree is already dirty, ignore unrelated files and modify only the scoped files for this PR purpose. |
0 commit comments