Skip to content

Commit 00103bf

Browse files
author
DavidQ
committed
Level 18.3 Contract Stabilization (Overlay Slice)
- Stabilized overlay APIs - Locked selectors/providers - Removed unstable surfaces
1 parent e2cb100 commit 00103bf

7 files changed

Lines changed: 99 additions & 21 deletions

docs/dev/CODEX_COMMANDS.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ MODEL: GPT-5.3-codex
22
REASONING: high
33

44
COMMAND:
5-
Apply boundary enforcement rules to overlay runtime:
6-
- Remove cross-layer leakage
7-
- Enforce engine/shared separation
8-
- Validate imports
5+
- Identify overlay public APIs
6+
- Freeze contracts
7+
- Remove unstable/internal exposure
8+
- Validate tests
99

10-
Output ZIP to:
11-
<project folder>/tmp/BUILD_PR_LEVEL_18_2_BOUNDARY_HARDENING_OVERLAY_SLICE.zip
10+
Output:
11+
<project folder>/tmp/BUILD_PR_LEVEL_18_3_CONTRACT_STABILIZATION_OVERLAY_SLICE.zip

docs/dev/COMMIT_COMMENT.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Level 18.2 Boundary Hardening (Overlay Slice)
1+
Level 18.3 Contract Stabilization (Overlay Slice)
22

3-
- Enforced layer boundaries in overlay runtime
4-
- Removed cross-layer leakage
5-
- Maintained test pass status
3+
- Stabilized overlay APIs
4+
- Locked selectors/providers
5+
- Removed unstable surfaces
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
[ ] overlay tests pass
2-
[ ] no regressions
3-
[ ] boundaries enforced
1+
[ ] contracts documented
2+
[ ] no breaking changes
3+
[ ] tests pass

docs/dev/roadmaps/MASTER_ROADMAP_HIGH_LEVEL.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -734,10 +734,10 @@
734734
- [ ] remove accidental coupling
735735

736736
### Track C — Contract Stabilization
737-
- [ ] finalize engine public APIs
738-
- [ ] finalize shared contracts
737+
- [.] finalize engine public APIs
738+
- [.] finalize shared contracts
739739
- [ ] ensure selectors/providers are stable
740-
- [ ] remove unstable or experimental surfaces
740+
- [.] remove unstable or experimental surfaces
741741

742742
### Track D — Codebase Consistency
743743
- [ ] single class per file enforcement
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# BUILD PR LEVEL 18.3 — Contract Stabilization (Overlay Slice)
2+
3+
Purpose:
4+
Stabilize overlay runtime public contracts (APIs, selectors, providers).
5+
6+
Scope:
7+
- Overlay runtime only
8+
- No new features
9+
10+
Validation:
11+
- Contracts documented
12+
- Tests pass without change

samples/phase-17/shared/overlayGameplayRuntime.js

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,7 +1273,7 @@ function writeOverlayRuntimeSyncSnapshot(container, snapshot) {
12731273
}
12741274
}
12751275

1276-
export function synchronizeOverlayGameplayRuntimeState(runtime, context = {}) {
1276+
function synchronizeOverlayGameplayRuntimeState(runtime, context = {}) {
12771277
if (!runtime) {
12781278
return null;
12791279
}
@@ -1739,7 +1739,7 @@ export function setOverlayGameplayRuntimeExtensions(runtime, runtimeExtensions)
17391739
return true;
17401740
}
17411741

1742-
export function isOverlayGameplayRuntimeVisible(runtime) {
1742+
function isOverlayGameplayRuntimeVisible(runtime) {
17431743
return runtime?.interactionVisible !== false;
17441744
}
17451745

@@ -1752,7 +1752,7 @@ export function setOverlayGameplayRuntimeVisible(runtime, visible) {
17521752
return true;
17531753
}
17541754

1755-
export function setOverlayGameplayRuntimePreferenceStorageKey(runtime, preferenceStorageKey, { loadExisting = true } = {}) {
1755+
function setOverlayGameplayRuntimePreferenceStorageKey(runtime, preferenceStorageKey, { loadExisting = true } = {}) {
17561756
if (!runtime) {
17571757
return false;
17581758
}
@@ -1850,7 +1850,7 @@ export function setOverlayGameplayRuntimeKeybindProfile(runtime, { id = '', cycl
18501850
return true;
18511851
}
18521852

1853-
export function getOverlayGameplayRuntimePreferencesSnapshot(runtime) {
1853+
function getOverlayGameplayRuntimePreferencesSnapshot(runtime) {
18541854
if (!runtime) {
18551855
return Object.freeze({
18561856
visibility: true,
@@ -1952,7 +1952,7 @@ export function saveOverlayGameplayRuntimePreferences(runtime, options = {}) {
19521952
return writeOverlayRuntimePreferencePayloadToStorage(preferenceStorageKey, payload, storage);
19531953
}
19541954

1955-
export function loadOverlayGameplayRuntimePreferences(runtime, options = {}) {
1955+
function loadOverlayGameplayRuntimePreferences(runtime, options = {}) {
19561956
if (!runtime) {
19571957
return false;
19581958
}
@@ -2873,3 +2873,30 @@ export function renderOverlayGameplayRuntime(runtime, context = {}) {
28732873
}
28742874
return invoked;
28752875
}
2876+
2877+
export const OVERLAY_GAMEPLAY_RUNTIME_PUBLIC_API_NAMES = Object.freeze([
2878+
'applyOverlayGameplayRuntimePreset',
2879+
'createOverlayGameplayRuntime',
2880+
'enqueueOverlayGameplayRuntimeSyncEvent',
2881+
'exportOverlayGameplayRuntimeProfile',
2882+
'exportOverlayGameplayRuntimeSharePackage',
2883+
'getOverlayGameplayRuntimeCompositionSnapshot',
2884+
'getOverlayGameplayRuntimeDefaultPresets',
2885+
'getOverlayGameplayRuntimeInteractionSnapshot',
2886+
'getOverlayGameplayRuntimePresetLibrary',
2887+
'importOverlayGameplayRuntimeProfile',
2888+
'importOverlayGameplayRuntimeSharePackage',
2889+
'renderOverlayGameplayRuntime',
2890+
'resolveOverlayGameplayRuntimeInputAction',
2891+
'saveOverlayGameplayRuntimePreferences',
2892+
'setOverlayGameplayRuntimeAdaptiveUiRules',
2893+
'setOverlayGameplayRuntimeContextInputMap',
2894+
'setOverlayGameplayRuntimeExtensions',
2895+
'setOverlayGameplayRuntimeKeybindProfile',
2896+
'setOverlayGameplayRuntimePresetLibrary',
2897+
'setOverlayGameplayRuntimeVisible',
2898+
'stepOverlayGameplayRuntime',
2899+
'stepOverlayGameplayRuntimeControls',
2900+
'stepOverlayGameplayRuntimeGestures',
2901+
'stepOverlayGameplayRuntimePointerInteractions',
2902+
]);

tests/runtime/Phase19OverlayExpansionFramework.test.mjs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Phase19OverlayExpansionFramework.test.mjs
66
*/
77
import assert from 'node:assert/strict';
88
import { readFileSync } from 'node:fs';
9+
import * as overlayRuntimeModule from '../../samples/phase-17/shared/overlayGameplayRuntime.js';
910
import { LEVEL17_OVERLAY_CYCLE_KEY } from '../../samples/phase-17/shared/overlayCycleInput.js';
1011
import {
1112
isOverlayRuntimeCycleModifierActive,
@@ -98,6 +99,16 @@ function assertOverlayRuntimeSliceUsesSharedFiniteNumberHelper() {
9899
false,
99100
'Overlay runtime slice should not keep a local duplicate JSON-clone helper.'
100101
);
102+
assert.equal(
103+
runtimeSource.includes('export function synchronizeOverlayGameplayRuntimeState('),
104+
false,
105+
'Overlay runtime slice contract should not expose internal synchronization mutators directly.'
106+
);
107+
assert.equal(
108+
runtimeSource.includes('export function getOverlayGameplayRuntimePreferencesSnapshot('),
109+
false,
110+
'Overlay runtime slice contract should not expose internal preference snapshot helpers directly.'
111+
);
101112
assert.equal(
102113
importSpecifiers.some((specifier) => specifier.startsWith('/src/engine/')),
103114
false,
@@ -110,6 +121,33 @@ function assertOverlayRuntimeSliceUsesSharedFiniteNumberHelper() {
110121
);
111122
}
112123

124+
function assertOverlayRuntimePublicApiContractFrozen() {
125+
const exportedKeys = Object.keys(overlayRuntimeModule).sort();
126+
const contractNames = [...overlayRuntimeModule.OVERLAY_GAMEPLAY_RUNTIME_PUBLIC_API_NAMES].sort();
127+
const expectedExportedKeys = [...contractNames, 'OVERLAY_GAMEPLAY_RUNTIME_PUBLIC_API_NAMES'].sort();
128+
129+
assert.deepEqual(
130+
exportedKeys,
131+
expectedExportedKeys,
132+
'Overlay runtime module export surface should match the frozen public API contract exactly.'
133+
);
134+
assert.equal(
135+
Object.isFrozen(overlayRuntimeModule.OVERLAY_GAMEPLAY_RUNTIME_PUBLIC_API_NAMES),
136+
true,
137+
'Overlay runtime public API name contract should be immutable.'
138+
);
139+
assert.equal(
140+
overlayRuntimeModule.OVERLAY_GAMEPLAY_RUNTIME_PUBLIC_API_NAMES.includes('synchronizeOverlayGameplayRuntimeState'),
141+
false,
142+
'Internal synchronization helpers should be excluded from the public API contract.'
143+
);
144+
assert.equal(
145+
overlayRuntimeModule.OVERLAY_GAMEPLAY_RUNTIME_PUBLIC_API_NAMES.includes('getOverlayGameplayRuntimePreferencesSnapshot'),
146+
false,
147+
'Internal preference snapshot helpers should be excluded from the public API contract.'
148+
);
149+
}
150+
113151
function assertExpansionRegistrationAndCompatibility() {
114152
const counters = { step: 0, render: 0 };
115153
const framework = createPhase19OverlayExpansionFramework();
@@ -1250,6 +1288,7 @@ function assertOverlaySharePackageExportImportCompatibility() {
12501288

12511289
export function run() {
12521290
assertOverlayRuntimeSliceUsesSharedFiniteNumberHelper();
1291+
assertOverlayRuntimePublicApiContractFrozen();
12531292
assertExpansionRegistrationAndCompatibility();
12541293
assertExtensionLifecycleMutations();
12551294
assertDynamicPanelSizingCapability();

0 commit comments

Comments
 (0)