Skip to content

Commit 50a609f

Browse files
author
DavidQ
committed
Integrates validation runner with standard workflows, adds exit code handling, and provides pre-commit/CI usage guidance.
BUILD_PR_LEVEL_10_03_VALIDATION_INTEGRATION
1 parent 31c3ce4 commit 50a609f

9 files changed

Lines changed: 106 additions & 17 deletions

.githooks/pre-commit.example.ps1

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[CmdletBinding()]
2+
param()
3+
4+
Set-StrictMode -Version Latest
5+
$ErrorActionPreference = "Stop"
6+
7+
$repoRoot = [System.IO.Path]::GetFullPath((Join-Path $PSScriptRoot ".."))
8+
$validateAllPath = Join-Path $repoRoot "scripts\PS\validate\Validate-All.ps1"
9+
10+
if (-not (Test-Path -LiteralPath $validateAllPath)) {
11+
Write-Host "Pre-commit validation: FAIL"
12+
Write-Host "Reason: Missing validator script at $validateAllPath"
13+
exit 1
14+
}
15+
16+
& $validateAllPath
17+
$exitCode = if ($null -eq $LASTEXITCODE) { 0 } else { [int]$LASTEXITCODE }
18+
19+
if ($exitCode -ne 0) {
20+
Write-Host "Pre-commit validation: FAIL"
21+
Write-Host "Commit aborted. Fix validation errors before committing."
22+
exit $exitCode
23+
}
24+
25+
Write-Host "Pre-commit validation: PASS"
26+
exit 0

docs/dev/CODEX_COMMANDS.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ MODEL: GPT-5.4
22
REASONING: high
33

44
COMMAND:
5-
- create Validate-All.ps1
6-
- call Validate-ScriptStructure.ps1
7-
- output pass/fail summary
5+
- ensure Validate-All.ps1 sets exit codes (0 pass, non-zero fail)
6+
- ensure clear PASS/FAIL output
7+
- add optional pre-commit hook example under .githooks/
8+
- keep validation scripts under scripts/PS/validate/
9+
- do not modify engine/runtime code
10+
- commit format:
11+
description first line
12+
PR name last line
13+
- update roadmap status only

docs/dev/COMMIT_COMMENT.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
Adds runnable validation entry point for all repo validation scripts.
2-
3-
BUILD_PR_LEVEL_10_02_SCRIPT_VALIDATION_RUNNER
1+
Harden Validate-All exit-code behavior, keep clear PASS/FAIL summaries, and add an optional pre-commit hook example under .githooks.
2+
BUILD_PR_LEVEL_10_03_VALIDATION_INTEGRATION

docs/dev/NEXT_COMMAND.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
BUILD_PR_LEVEL_10_03_VALIDATION_INTEGRATION
1+
BUILD_PR_LEVEL_10_04_VALIDATION_EXTENSIONS
Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,20 @@
1-
Adds executable validation runner script.
1+
BUILD_PR_LEVEL_10_03_VALIDATION_INTEGRATION
2+
3+
Scope:
4+
- Validation-lane changes only.
5+
- No engine/runtime/tool code touched.
6+
7+
Implemented:
8+
- Updated `scripts/PS/validate/Validate-All.ps1`:
9+
- explicit `0` exit on PASS
10+
- non-zero exit on failure
11+
- clear PASS/FAIL summary output
12+
- guarded error path with failure summary and reason
13+
- Added optional pre-commit hook example:
14+
- `.githooks/pre-commit.example.ps1`
15+
- calls `scripts/PS/validate/Validate-All.ps1`
16+
- blocks commit on validation failure
17+
18+
Constraints:
19+
- Validation scripts remain under `scripts/PS/validate/`.
20+
- Deployment, engine, and runtime behavior were not modified.
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
[ ] run scripts/PS/validate/Validate-All.ps1
2-
[ ] PASS/FAIL output shown
1+
[x] `scripts/PS/validate/Validate-All.ps1` runs successfully in repo
2+
[x] PASS path returns exit code `0`
3+
[x] failure simulation returns non-zero exit code
4+
[x] clear PASS/FAIL summary output is present
5+
[x] optional `.githooks/pre-commit.example.ps1` calls `Validate-All.ps1`
6+
[x] roadmap updated with status-only change

docs/dev/roadmaps/MASTER_ROADMAP_HIGH_LEVEL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@
550550
- [.] unit coverage aligned to engine/shared/games
551551
- [.] integration coverage aligned to state/replay/rendering/tools
552552
- [x] smoke validation aligned to samples/tools/games
553-
- [ ] fixtures/helpers organization normalized
553+
- [.] fixtures/helpers organization normalized
554554
- [x] move/refactor validation strategy documented
555555
- [x] post-PR acceptance criteria consistently enforced
556556

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# BUILD_PR — LEVEL 10_03 — VALIDATION INTEGRATION
2+
3+
## Objective
4+
Integrate validation runner into standard workflows (pre-commit and CI-ready), and standardize exit codes so failures block bad structure.
5+
6+
## What to Execute
7+
PowerShell:
8+
scripts/PS/validate/Validate-All.ps1
9+
10+
## Expected Behavior
11+
- Returns exit code 0 on PASS
12+
- Returns non-zero on FAIL
13+
- Emits clear PASS/FAIL summary
14+
15+
## Optional Local Hook (example)
16+
PowerShell:
17+
git config core.hooksPath .githooks
18+
19+
Create .githooks/pre-commit that runs:
20+
powershell -NoProfile -ExecutionPolicy Bypass -File scripts/PS/validate/Validate-All.ps1
21+
if ($LASTEXITCODE -ne 0) { exit 1 }
22+
23+
## CI Note
24+
This same script can be called from CI to gate merges.

scripts/PS/validate/Validate-All.ps1

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,29 @@ if (-not (Test-Path -LiteralPath $validatorPath)) {
1111
throw "Missing validation entrypoint: $validatorPath"
1212
}
1313

14-
$global:LASTEXITCODE = 0
15-
if ($Json.IsPresent) {
16-
& $validatorPath -Json
14+
try {
15+
$global:LASTEXITCODE = 0
16+
if ($Json.IsPresent) {
17+
& $validatorPath -Json
18+
}
19+
else {
20+
& $validatorPath
21+
}
1722
}
18-
else {
19-
& $validatorPath
23+
catch {
24+
Write-Host "Validate-All summary: FAIL"
25+
Write-Host "Reason: $($_.Exception.Message)"
26+
exit 1
2027
}
2128

2229
$validatorExitCode = if ($null -eq $LASTEXITCODE) { 0 } else { [int]$LASTEXITCODE }
2330
$summary = if ($validatorExitCode -eq 0) { "PASS" } else { "FAIL" }
24-
Write-Host "Validate-All summary: $summary"
31+
if (-not $Json.IsPresent) {
32+
Write-Host "Validate-All summary: $summary"
33+
}
2534

2635
if ($validatorExitCode -ne 0) {
2736
exit $validatorExitCode
2837
}
38+
39+
exit 0

0 commit comments

Comments
 (0)