7979- Do not expand scope beyond the PR
8080- Do not modify ` start_of_day ` folders unless requested
8181
82+ ## RULE PRECEDENCE
83+
84+ Newer appended sections override earlier overlapping rules.
85+
86+ When rules overlap, use the most specific current section as authoritative.
87+
88+ ## FILE SCOPE GUARD
89+
90+ Allowed change scope is PR-specific.
91+
92+ Unless a PR states otherwise, keep changes limited to:
93+ - ` tools/preview-generator-v2/* `
94+ - ` common/* `
95+ - ` docs/dev/reports/* `
96+
97+ Do not modify unrelated files.
98+
8299## OUTPUT RULES
83100
84101ChatGPT MUST output ONLY:
@@ -110,23 +127,38 @@ Example:
110127
111128## PLAYWRIGHT VALIDATION REQUIREMENT
112129
113- Every PR must include a clear Playwright section.
130+ Every PR must state:
114131
115- The Playwright section must state:
116- - what Playwright validates
117- - expected pass behavior
118- - expected fail behavior
119- - whether Playwright is impacted
132+ ` Playwright impacted: Yes/No `
133+
134+ Playwright impacted is Yes when the PR changes:
135+ - tool runtime behavior
136+ - UI controls or interactions
137+ - workspace or toolState flows
138+ - capture or rendering paths
139+
140+ If Playwright impacted is Yes:
141+ - ` npm run test:workspace-v2 ` must pass.
142+ - the Playwright section must state what behavior is validated
143+ - the Playwright section must state expected pass behavior
144+ - the Playwright section must state expected fail behavior
145+
146+ If Playwright impacted is No:
147+ - include ` No Playwright impact. This PR is docs/workflow only. `
148+ - for pure refactors, justify why behavior is unchanged
149+
150+ Playwright is not required for:
151+ - docs-only PRs
152+ - naming/formatting-only PRs
153+ - pure refactors with no behavior change, when justified
120154
121155Default Playwright command:
122156
123157` npm run test:workspace-v2 `
124158
125159Playwright is the required validation gate for Workspace V2 and toolState work.
126160
127- If Playwright is not impacted, say so explicitly:
128-
129- ` No Playwright impact. This PR is docs/workflow only. `
161+ The full samples smoke test rule remains separate and runs only when broadly impacted.
130162
131163## CODEX REVIEW DIFF REQUIREMENT
132164
@@ -173,7 +205,7 @@ Current sample validation rule:
173205
174206If the user says ` NEXT ` :
175207
176- 1 . Look for the highest completed or referenced PR in the session .
208+ 1 . Look for the highest completed or referenced PR in the conversation .
1772092 . Increment to the next logical PR using the current PR naming standard.
1782103 . If sequence is unclear, STOP and ask for clarification.
179211
@@ -387,23 +419,6 @@ Every tool completion PR must include:
387419- Playwright result
388420- manual validation steps
389421
390- ## PLAYWRIGHT TOOL COVERAGE RULES
391-
392- Playwright should validate:
393- - Workspace lifecycle
394- - reset/load/export/import
395- - palette baseline
396- - valid toolState payload render
397- - invalid toolState payload rejection
398- - no payload mutation
399- - active tool state integrity
400- - no reliance on sample JSON during tool completion
401-
402- When tool-level Playwright exists:
403- - tool completion audit should align to Playwright results
404- - failures must identify tool name
405- - reports must clearly show PASS/FAIL per tool
406-
407422## CODEX ANTI-PATTERN GUARD
408423
409424These rules are mandatory for every Codex BUILD execution:
@@ -507,15 +522,20 @@ Never allow `<script>` blocks inside HTML files.
507522
508523Never allow ` <style> ` blocks inside HTML files.
509524
525+ HTML must not contain inline event handlers such as ` onclick ` , ` onchange ` , ` oninput ` , ` onsubmit ` , or similar.
526+
510527All JavaScript must be external.
511528
512529All CSS must be external.
513530
514- ## TOOL ARCHITECTURE STANDARDS
531+ Event wiring must live in external JavaScript classes or modules.
532+
533+ ## SEPARATION OF CONCERNS
515534
516535- One class per file.
517536- One control or section per class.
518- - App/root class is coordinator only and must not own DOM logic or business logic.
537+ - App/root class coordinates only and must not own DOM logic or business logic.
538+ - Controls do not reach into other controls directly.
519539- No ` tools/shared ` dependency is allowed.
520540- Shared UI behavior must use reusable classes.
521541- Do not duplicate shared UI behavior logic across controls or tools.
@@ -562,52 +582,13 @@ No PR is complete with:
562582- Capture failures must log the mode, target, and underlying error.
563583- Rendering tools must not claim OK when fallback or partial capture occurred.
564584
565- ## SEPARATION OF CONCERNS CONTRACT
566-
567- - One class per file.
568- - One control or section per class.
569- - App/root class coordinates only.
570- - Controls do not reach into other controls directly.
571- - Shared behavior must use reusable classes.
572-
573- ## TESTING DEPTH REQUIREMENT
574-
575- - Playwright must validate meaningful behavior, not just page load.
576- - Tests should cover state transitions, failure states, and edge cases when impacted.
577-
578585## BATCH OPERATION RULES
579586
580587- Batch operations must log per item.
581588- One failed item must not stop the batch unless the failure is global.
582589- Summary must include written, failed, skipped, and warnings.
583590
584- ## DEFINITION OF DONE PLAYWRIGHT CONTRACT
585-
586- Playwright MUST pass when the PR changes:
587- - tool runtime behavior
588- - UI controls or interactions
589- - workspace or toolState flows
590- - capture or rendering paths
591-
592- Playwright is NOT required when the PR is:
593- - docs-only
594- - naming/formatting-only
595- - a pure refactor with no behavior change, when that no-behavior-change claim is justified
596-
597- Each PR must state:
598-
599- ` Playwright impacted: Yes/No `
600-
601- If Playwright impacted is Yes:
602- - ` npm run test:workspace-v2 ` must pass.
603-
604- If Playwright impacted is No:
605- - include ` No Playwright impact. This PR is docs/workflow only. `
606-
607- Keep the full samples smoke test rule unchanged:
608- - full samples smoke test runs only when broadly impacted.
609-
610- ## PLAYWRIGHT COVERAGE DEPTH REQUIREMENT
591+ ## PLAYWRIGHT DEPTH AND COVERAGE REQUIREMENT
611592
612593Playwright must validate behavior, not just page load.
613594
@@ -622,12 +603,20 @@ Playwright tests must not be limited to page loads without error.
622603
623604Each PR must state what behavior is being validated.
624605
625- Do NOT require:
626- - full feature coverage
627- - 100% code coverage
628- - performance requirements
606+ Playwright should validate these tool behaviors when applicable:
607+ - Workspace lifecycle
608+ - reset/load/export/import
609+ - palette baseline
610+ - valid toolState payload render
611+ - invalid toolState payload rejection
612+ - no payload mutation
613+ - active toolState integrity
614+ - no reliance on sample JSON during tool completion
629615
630- ## CODE COVERAGE CONTRACT
616+ When tool-level Playwright exists:
617+ - tool completion audit should align to Playwright results
618+ - failures must identify tool name
619+ - reports must clearly show PASS/FAIL per tool
631620
632621When runtime JavaScript changes, Codex must produce a Playwright V8 coverage report.
633622
@@ -639,7 +628,10 @@ Coverage report lines must start with coverage percentage in this format:
639628
640629Coverage is advisory unless a PR explicitly defines thresholds.
641630
642- Do not require 100% coverage.
631+ Do NOT require:
632+ - full feature coverage
633+ - 100% code coverage
634+ - performance requirements
643635
644636## CODEX ZIP RETURN CONTRACT
645637
@@ -653,12 +645,6 @@ ChatGPT must not claim code review was completed unless it inspected uploaded so
653645
654646Pattern-based or process-based review must be labeled as such.
655647
656- ## HTML INLINE HANDLER RESTRICTION
657-
658- HTML must not contain inline event handlers such as ` onclick ` , ` onchange ` , ` oninput ` , ` onsubmit ` , or similar.
659-
660- Event wiring must live in external JavaScript classes or modules.
661-
662648## FIRST-CLASS TOOL REGISTRATION RULE
663649
664650New first-class tools must include registry, index, and NAV wiring where applicable.
0 commit comments