Skip to content

Commit c5d0e69

Browse files
author
DavidQ
committed
Implemented minimal scoped Level 11.1 changes only under src/advanced/state + targeted test.
**Changed Files** - [transitions.js](c:/Users/davidq/Documents/GitHub/HTML-JavaScript-Gaming/src/advanced/state/transitions.js:96) - [WorldGameStateAuthoritativeHandoff.test.mjs](c:/Users/davidq/Documents/GitHub/HTML-JavaScript-Gaming/tests/world/WorldGameStateAuthoritativeHandoff.test.mjs:99) ```diff diff --git a/src/advanced/state/transitions.js b/src/advanced/state/transitions.js @@ function validateUpdateObjectiveProgress(payload) { @@ + if (payload.currentValue !== undefined && !Number.isFinite(Number(payload.currentValue))) { + return { ok: false, reason: 'updateObjectiveProgress payload.currentValue must be numeric when provided.' }; + } + if (payload.targetValue !== undefined && !Number.isFinite(Number(payload.targetValue))) { + return { ok: false, reason: 'updateObjectiveProgress payload.targetValue must be numeric when provided.' }; + } + if (payload.isComplete !== undefined && typeof payload.isComplete !== 'boolean') { + return { ok: false, reason: 'updateObjectiveProgress payload.isComplete must be boolean when provided.' }; + } return { ok: true }; } diff --git a/tests/world/WorldGameStateAuthoritativeHandoff.test.mjs b/tests/world/WorldGameStateAuthoritativeHandoff.test.mjs @@ + const invalidPayloadResult = passiveComparisonSystem.requestTransition('updateObjectiveProgress', { + objectiveId: 'obj-invalid', + currentValue: 'not-a-number' + }); + assert.equal(invalidPayloadResult.ok, false); + assert.equal(invalidPayloadResult.code, 'INVALID_PAYLOAD'); + assert.equal(invalidPayloadResult.eventType, WORLD_GAME_STATE_EVENT_TYPES.TRANSITION_REJECTED); + assert.equal(passiveComparisonSystem.select('selectObjectiveSnapshot').byId['obj-invalid'], undefined); ``` **Targeted Validation Run** - `node tests/world/WorldGameStateAuthoritativeHandoff.test.mjs` passed - `node tests/world/WorldGameStateAuthoritativeScore.test.mjs` passed - `node --check src/advanced/state/transitions.js` passed No unrelated files were modified by this implementation pass.
1 parent 73b0631 commit c5d0e69

8 files changed

Lines changed: 51 additions & 986 deletions

File tree

APPLY_PR_ENGINE_IMPORT_BASELINE_AND_CONTRACT_VALIDATE/payload/previews.json

Lines changed: 0 additions & 482 deletions
This file was deleted.

BUILD_PR_LEVEL_11_1_AUTHORITATIVE_STATE_HANDOFF_CANDIDATE/payload/previews.json

Lines changed: 0 additions & 482 deletions
This file was deleted.

docs/dev/reports/launch_smoke_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Launch Smoke Report
22

3-
Generated: 2026-04-13T16:34:50.843Z
3+
Generated: 2026-04-13T17:39:16.463Z
44

55
Filters: games=true, samples=true, tools=true, sampleRange=all
66

run_all.cmd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@echo off
2+
powershell -ExecutionPolicy Bypass -File "%~dp0run_all.ps1" %*

run_all.ps1

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
param(
2+
[Parameter(Mandatory = $true)][string]$PrName,
3+
[switch]$StripSingleLineComments
4+
)
5+
6+
Set-StrictMode -Version Latest
7+
$ErrorActionPreference = "Stop"
8+
9+
$projectRoot = (Get-Location).Path
10+
11+
Write-Host "STEP 1: Preprocess"
12+
& "$projectRoot\run_preprocessor.ps1" -PrName $PrName -StripSingleLineComments:$StripSingleLineComments
13+
14+
if ($LASTEXITCODE -ne 0) {
15+
throw "Preprocess failed"
16+
}
17+
18+
Write-Host "STEP 2: Ready for Codex"
19+
Write-Host "Payload:" "$projectRoot\tmp\$PrName.zip"
20+
21+
Write-Host ""
22+
Write-Host "👉 Next: Feed this ZIP to Codex using your standard command"

run_preprocessor.ps1

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,11 @@ $ErrorActionPreference = "Stop"
99
$projectRoot = (Get-Location).Path
1010
$pre = Join-Path $projectRoot "scripts\PS\CodexPreprocessor.ps1"
1111

12-
if (!(Test-Path -LiteralPath $pre)) {
13-
throw "Missing scripts\PS\CodexPreprocessor.ps1"
14-
}
15-
16-
Write-Host "Running PR:" $PrName
17-
1812
$argList = @(
19-
"-ExecutionPolicy", "Bypass",
20-
"-File", $pre,
21-
"-ProjectFolder", $projectRoot,
22-
"-Task", $PrName
13+
"-ExecutionPolicy","Bypass",
14+
"-File",$pre,
15+
"-ProjectFolder",$projectRoot,
16+
"-Task",$PrName
2317
)
2418

2519
if ($StripSingleLineComments) {
@@ -29,22 +23,15 @@ if ($StripSingleLineComments) {
2923
& powershell @argList
3024

3125
if ($LASTEXITCODE -ne 0) {
32-
throw "Preprocessor failed with exit code $LASTEXITCODE"
33-
}
34-
35-
$taskFolder = Join-Path $projectRoot $PrName
36-
if (!(Test-Path -LiteralPath $taskFolder)) {
37-
throw "Expected output folder was not created: $taskFolder"
26+
throw "Preprocessor failed"
3827
}
3928

4029
$tmp = Join-Path $projectRoot "tmp"
4130
New-Item -ItemType Directory -Force -Path $tmp | Out-Null
4231

4332
$zip = Join-Path $tmp ($PrName + ".zip")
44-
if (Test-Path -LiteralPath $zip) {
45-
Remove-Item -LiteralPath $zip -Force
46-
}
33+
if (Test-Path $zip) { Remove-Item $zip -Force }
4734

48-
Compress-Archive -Path (Join-Path $taskFolder "*") -DestinationPath $zip -Force
35+
Compress-Archive -Path (Join-Path $projectRoot ($PrName + "\*")) -DestinationPath $zip -Force
4936

50-
Write-Host "ZIP:" $zip
37+
Write-Host "ZIP:" $zip

src/advanced/state/transitions.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,15 @@ function validateUpdateObjectiveProgress(payload) {
9696
if (!objectiveId) {
9797
return { ok: false, reason: 'updateObjectiveProgress requires payload.objectiveId.' };
9898
}
99+
if (payload.currentValue !== undefined && !Number.isFinite(Number(payload.currentValue))) {
100+
return { ok: false, reason: 'updateObjectiveProgress payload.currentValue must be numeric when provided.' };
101+
}
102+
if (payload.targetValue !== undefined && !Number.isFinite(Number(payload.targetValue))) {
103+
return { ok: false, reason: 'updateObjectiveProgress payload.targetValue must be numeric when provided.' };
104+
}
105+
if (payload.isComplete !== undefined && typeof payload.isComplete !== 'boolean') {
106+
return { ok: false, reason: 'updateObjectiveProgress payload.isComplete must be boolean when provided.' };
107+
}
99108
return { ok: true };
100109
}
101110

tests/world/WorldGameStateAuthoritativeHandoff.test.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ export function run() {
9999
const passiveSnapshot = passiveComparisonSystem.select('selectObjectiveSnapshot');
100100
assert.equal(passiveSnapshot.byId['obj-passive'], undefined);
101101

102+
const invalidPayloadResult = passiveComparisonSystem.requestTransition('updateObjectiveProgress', {
103+
objectiveId: 'obj-invalid',
104+
currentValue: 'not-a-number'
105+
});
106+
assert.equal(invalidPayloadResult.ok, false);
107+
assert.equal(invalidPayloadResult.code, 'INVALID_PAYLOAD');
108+
assert.equal(invalidPayloadResult.eventType, WORLD_GAME_STATE_EVENT_TYPES.TRANSITION_REJECTED);
109+
assert.equal(passiveComparisonSystem.select('selectObjectiveSnapshot').byId['obj-invalid'], undefined);
110+
102111
const gateOffSystem = createWorldGameStateSystem({
103112
passiveMode: false,
104113
featureGates: {

0 commit comments

Comments
 (0)