Skip to content

Commit d552548

Browse files
committed
Add static validation gates before Playwright launch to prevent wasted browser startup and repeated deterministic failures - PR_26146_027-static-validation-before-playwright-launch
1 parent b8252bc commit d552548

11 files changed

Lines changed: 1001 additions & 252 deletions

docs/dev/reports/playwright_structure_audit.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Playwright Structure Audit
22

3-
Generated: 2026-05-26T18:07:59.062Z
3+
Generated: 2026-05-26T18:17:13.687Z
44
Status: PASS
55

66
## Lane Directories
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Static Validation Report
2+
3+
Generated: 2026-05-26
4+
PR: PR_26146_027-static-validation-before-playwright-launch
5+
6+
## Summary
7+
8+
Status: PASS
9+
Prevented launches: 0
10+
Fast-fail reasons: none
11+
12+
## Static Validation Runs
13+
14+
| Command | Status | Browser Launch | Reason |
15+
| --- | --- | --- | --- |
16+
| `npm run test:playwright:static` | PASS | No | Required first validation pass. Ran structure audit and lane runner static checks without starting Playwright. |
17+
| `PLAYWRIGHT_BROWSERS_PATH=0 node ./scripts/run-targeted-test-lanes.mjs --lanes integration,tool-runtime` | PASS | Yes, after static pass | Re-ran the same static gate inside the lane runner before affected Playwright lanes started. |
18+
19+
## Checks
20+
21+
| Check | Status | Details |
22+
| --- | --- | --- |
23+
| test placement validation | PASS | Covered by `docs/dev/reports/playwright_structure_audit.md`. |
24+
| lane ownership validation | PASS | Playwright specs are separated under tools, games, integration, and optional engine ownership buckets. |
25+
| invalid filename detection | PASS | No game-specific spec/helper filenames remain in generic reusable tool/helper locations. |
26+
| invalid lane target detection | PASS | Selected lanes target existing files under their expected lane directories. |
27+
| missing fixture detection | PASS | Workspace contract fixture path exists; selected affected lanes use explicit repo/game fixtures. |
28+
| missing import detection | PASS | Relative imports in Playwright specs and shared helpers resolve. |
29+
| Windows quoting hazard detection | PASS | Tool-runtime grep pipe is passed as a literal Node argv value. |
30+
| duplicate lane registration detection | PASS | No duplicate npm `test:lane:*` registrations were found. |
31+
| invalid grep pattern detection | PASS | No empty or malformed grep patterns were found. |
32+
33+
## Fast-Fail Behavior
34+
35+
- Deterministic structural failures would stop before Playwright CLI invocation.
36+
- Browser startup is blocked when lane targets, imports, fixtures, placement, registration, or quoting checks fail.
37+
- Workspace V2 is not launched by static validation.
38+
- No automatic retries are performed for deterministic setup failures.
39+
40+
## Runtime Savings Observations
41+
42+
- Static validation ran before any browser work.
43+
- Affected lanes were run together through one Node lane-runner process.
44+
- Tool-runtime now combines Preview Generator V2 and Collision Inspector V2 in one Playwright CLI invocation.
45+
- Workspace contract, engine/src, samples, and full samples smoke were skipped because they were outside the affected surface.
Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Testing Lane Execution Report
22

33
Generated: 2026-05-26
4-
PR: PR_26146_026-playwright-structure-enforcement-and-fast-fail-routing
4+
PR: PR_26146_027-static-validation-before-playwright-launch
55

66
## Summary
77

@@ -13,49 +13,40 @@ SKIP: 3
1313
## Full Samples Smoke
1414

1515
Status: SKIP
16-
Reason: This PR changes Playwright structure enforcement, preflight validation, runner routing, and test placement only. No sample JSON, shared sample loader, or sample framework files were changed.
16+
Reason: This PR changes static validation, structural preflight routing, and targeted lane execution only. No sample JSON, shared sample loader, or sample framework files were changed.
1717

1818
## Executed and Skipped Lanes
1919

2020
| Lane / Check | Status | Executed/Skipped Reason | Affected Surface | Evidence |
2121
| --- | --- | --- | --- | --- |
22-
| playwright-structure-preflight | PASS | Executed first because structural enforcement now gates expensive Playwright lanes. | Playwright lane ownership, file placement, imports, fixture documentation | `npm run test:lanes:preflight` passed and wrote `docs/dev/reports/playwright_structure_audit.md`. |
23-
| integration | PASS | Executed because `GameIndexPreviewManifestResolution.spec.mjs` moved from `games/` to `integration/` and the lane target changed. | Game index preview manifest handoff | `PLAYWRIGHT_BROWSERS_PATH=0 npm run test:lane:integration`; preflight passed, focused Pong handoff subset 3 passed. |
24-
| tool-runtime | PASS | Executed because runner preflight and Windows-safe Playwright argv handling changed. | Asset Manager V2, Preview Generator V2, Collision Inspector V2 runtime tests | `PLAYWRIGHT_BROWSERS_PATH=0 npm run test:lane:tool-runtime`; preflight passed, Asset Manager focused subset 5 passed, Preview Generator 7 passed, Collision Inspector 4 passed. |
25-
| workspace-contract | SKIP | Skipped because `npm run test:workspace-v2` compatibility was preserved and Workspace V2 wiring was not changed. | Workspace Manager V2 contract/lifecycle behavior | Not run. |
22+
| static-validation | PASS | Executed first to prove deterministic checks run before browser startup. | Placement, ownership, filenames, lane targets, fixtures, imports, grep, quoting, duplicate registrations | `npm run test:playwright:static` passed and wrote `docs/dev/reports/static_validation_report.md`. |
23+
| tool-runtime | PASS | Executed because runner static validation and Playwright invocation behavior changed. | Asset Manager V2, Preview Generator V2, Collision Inspector V2 runtime tests | `PLAYWRIGHT_BROWSERS_PATH=0 node ./scripts/run-targeted-test-lanes.mjs --lanes integration,tool-runtime`; Asset Manager focused subset 5 passed, Preview Generator and Collision Inspector combined run 11 passed. |
24+
| integration | PASS | Executed because the integration lane target remains part of the affected Playwright routing surface. | Game index preview manifest handoff | Same combined runner command; focused Pong handoff subset 3 passed. |
25+
| workspace-contract | SKIP | Skipped because static validation does not require Workspace V2 launch and Workspace V2 wiring was not changed. | Workspace Manager V2 contract/lifecycle behavior | Not run. |
2626
| engine-src | SKIP | Skipped because no `src/`, engine Playwright, or node engine lane targets changed. | src/ engine/shared runtime behavior | Not run. |
2727
| samples | SKIP | Skipped because samples are on-request or affected-sample only and this PR did not impact samples. | On-request samples lane | Not run. |
2828

29-
## Fast-Fail Coverage
29+
## Prevented Launches and Fast-Fail Reasons
3030

31-
- Runner preflight validates selected lane targets before Playwright starts.
32-
- Structural audit validates lane ownership, file placement, missing relative imports, documented game fixtures, and shared helper naming.
33-
- Missing target files, invalid lane targets, invalid empty grep patterns, missing fixtures, or Windows shell quoting hazards fail before browser execution.
34-
- No deterministic setup failures were found in this run, so no lanes were fast-failed.
31+
- Prevented launches: 0 in this validation run because no deterministic static failures were found.
32+
- Fast-fail reasons: none.
33+
- If static validation finds placement, import, fixture, lane target, duplicate registration, grep, or quoting failures, the runner exits before Playwright/browser startup.
3534

36-
## Placement Corrections
35+
## Placement and Helper Cleanup
3736

38-
- `tests/playwright/tools/AsteroidsBackgroundAssetResolution.spec.mjs` -> `tests/playwright/games/AsteroidsBackgroundAssetResolution.spec.mjs`
39-
- `tests/playwright/tools/AsteroidsBeatTiming.spec.mjs` -> `tests/playwright/games/AsteroidsBeatTiming.spec.mjs`
40-
- `tests/playwright/tools/AsteroidsGameSceneCleanup.spec.mjs` -> `tests/playwright/games/AsteroidsGameSceneCleanup.spec.mjs`
41-
- `tests/playwright/tools/AsteroidsShipStateVisuals.spec.mjs` -> `tests/playwright/games/AsteroidsShipStateVisuals.spec.mjs`
42-
- `tests/playwright/games/GameIndexPreviewManifestResolution.spec.mjs` -> `tests/playwright/integration/GameIndexPreviewManifestResolution.spec.mjs`
43-
44-
## Quoting Corrections
45-
46-
- Playwright lane commands invoke `node node_modules/@playwright/test/cli.js` instead of shelling through a platform command wrapper.
47-
- Grep patterns such as `launch guard|temporary UAT context|rejects non-Workspace` are passed as literal argv values on Windows.
48-
- Runner command display quotes shell-sensitive argv values for readability without using shell interpretation for Playwright.
37+
- Existing placement corrections remain enforced in `docs/dev/reports/playwright_structure_audit.md`.
38+
- No additional misplaced tests or game-specific reusable helper names were found.
39+
- `tests/playwright/integration/GameIndexPreviewManifestResolution.spec.mjs` remains the integration-owned handoff target.
4940

5041
## Runtime Savings Observations
5142

52-
- Structural failures now stop before browser boot.
53-
- Unselected lanes are skipped before command construction reaches Playwright execution.
54-
- Workspace contract, engine/src, samples, and full samples smoke were not run because they were outside the affected surface.
55-
- Focused integration validation used the targeted Pong handoff subset instead of broad all-game coverage.
43+
- Static validation ran once as a standalone gate before affected lanes.
44+
- Affected lanes ran together in one Node lane-runner process instead of separate npm launches.
45+
- Preview Generator V2 and Collision Inspector V2 execute through one Playwright CLI invocation.
46+
- Workspace V2, engine/src, samples, and full samples smoke were not started.
5647

5748
## Static Validation
5849

59-
- PASS `node --check scripts/audit-playwright-test-locations.mjs`
6050
- PASS `node --check scripts/run-targeted-test-lanes.mjs`
51+
- PASS `node --check scripts/audit-playwright-test-locations.mjs`
6152
- PASS `node --check tests/playwright/integration/GameIndexPreviewManifestResolution.spec.mjs`

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
"test": "node ./scripts/run-node-tests.mjs",
66
"test:audit:locations": "node ./scripts/audit-playwright-test-locations.mjs",
77
"test:playwright:structure": "node ./scripts/audit-playwright-test-locations.mjs",
8+
"test:playwright:static": "node ./scripts/run-targeted-test-lanes.mjs --static-only",
89
"test:lanes": "node ./scripts/run-targeted-test-lanes.mjs",
9-
"test:lanes:preflight": "node ./scripts/audit-playwright-test-locations.mjs",
10+
"test:lanes:preflight": "node ./scripts/run-targeted-test-lanes.mjs --static-only",
1011
"test:lane:workspace-contract": "node ./scripts/run-targeted-test-lanes.mjs --lane workspace-contract",
1112
"test:lane:tool-runtime": "node ./scripts/run-targeted-test-lanes.mjs --lane tool-runtime",
1213
"test:lane:integration": "node ./scripts/run-targeted-test-lanes.mjs --lane integration",

0 commit comments

Comments
 (0)