Skip to content

Commit 5ccfdc8

Browse files
committed
Fix Objects role/type split and render asset save validation - PR_26161_005-objects-role-type-save-fix
1 parent f415e11 commit 5ccfdc8

8 files changed

Lines changed: 622 additions & 6960 deletions

File tree

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,18 @@
11
# git status --short
2-
M docs_build/dev/reports/codex_changed_files.txt
3-
M docs_build/dev/reports/codex_review.diff
4-
M docs_build/dev/reports/coverage_changed_js_guardrail.txt
5-
M docs_build/dev/reports/db-object-model-contract-report.md
6-
M docs_build/dev/reports/object-render-asset-handoff-report.md
7-
M docs_build/dev/reports/objects-beta-rebuild-report.md
2+
M docs_build/dev/reports/coverage_changed_js_guardrail.txt
83
M docs_build/dev/reports/playwright_v8_coverage_report.txt
9-
M src/dev-runtime/guest-seeds/tool-metadata-inventory.js
10-
M src/engine/object-model/objectModelRegistry.js
11-
M tests/engine/ObjectModelContract.test.mjs
124
M tests/playwright/tools/ObjectsTool.spec.mjs
13-
M tests/playwright/tools/RootToolsFutureState.spec.mjs
14-
M tests/playwright/tools/ToolboxAdminMetadataSsot.spec.mjs
15-
M tests/playwright/tools/ToolboxRoutePages.spec.mjs
165
M toolbox/objects/index.html
176
M toolbox/objects/objects.js
18-
?? docs_build/dev/reports/objects-table-input-wireframe-report.md
7+
?? docs_build/dev/reports/objects-role-type-save-fix-report.md
198

209
# git ls-files --others --exclude-standard
21-
docs_build/dev/reports/objects-table-input-wireframe-report.md
10+
docs_build/dev/reports/objects-role-type-save-fix-report.md
2211

2312
# git diff --stat
24-
docs_build/dev/reports/codex_changed_files.txt | 46 +-
25-
docs_build/dev/reports/codex_review.diff | 4838 +++++++-------------
26-
.../dev/reports/coverage_changed_js_guardrail.txt | 7 +-
27-
.../dev/reports/db-object-model-contract-report.md | 10 +-
28-
.../reports/object-render-asset-handoff-report.md | 6 +-
29-
.../dev/reports/objects-beta-rebuild-report.md | 8 +-
30-
.../dev/reports/playwright_v8_coverage_report.txt | 28 +-
31-
.../guest-seeds/tool-metadata-inventory.js | 16 +-
32-
src/engine/object-model/objectModelRegistry.js | 2 +-
33-
tests/engine/ObjectModelContract.test.mjs | 40 +-
34-
tests/playwright/tools/ObjectsTool.spec.mjs | 210 +-
35-
.../playwright/tools/RootToolsFutureState.spec.mjs | 4 +-
36-
.../tools/ToolboxAdminMetadataSsot.spec.mjs | 36 +-
37-
tests/playwright/tools/ToolboxRoutePages.spec.mjs | 20 +-
38-
toolbox/objects/index.html | 104 +-
39-
toolbox/objects/objects.js | 617 ++-
40-
16 files changed, 2429 insertions(+), 3563 deletions(-)
13+
.../dev/reports/coverage_changed_js_guardrail.txt | 6 +-
14+
.../dev/reports/playwright_v8_coverage_report.txt | 13 +-
15+
tests/playwright/tools/ObjectsTool.spec.mjs | 32 +++--
16+
toolbox/objects/index.html | 8 +-
17+
toolbox/objects/objects.js | 142 ++++++++++++---------
18+
5 files changed, 111 insertions(+), 90 deletions(-)

docs_build/dev/reports/codex_review.diff

Lines changed: 437 additions & 6839 deletions
Large diffs are not rendered by default.

docs_build/dev/reports/coverage_changed_js_guardrail.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@ Source: Playwright/Chromium built-in V8 coverage from the active Playwright run.
77

88
Changed runtime JS files considered:
99
(0%) src/dev-runtime/guest-seeds/tool-metadata-inventory.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
10-
(0%) src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
1110
(67%) src/engine/object-model/objectModelRegistry.js - executed lines 139/139; executed functions 4/6
12-
(70%) src/engine/object-model/objectDefinitionValidator.js - executed lines 360/360; executed functions 16/23
13-
(75%) src/engine/object-model/objectDefinitionSchema.js - executed lines 58/58; executed functions 3/4
14-
(95%) toolbox/objects/objects.js - executed lines 741/741; executed functions 84/88
11+
(94%) toolbox/objects/objects.js - executed lines 762/762; executed functions 80/85
1512

1613
Guardrail warnings:
1714
(0%) src/dev-runtime/guest-seeds/tool-metadata-inventory.js - WARNING: changed runtime JS file missing from coverage; advisory only
18-
(0%) src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js - WARNING: changed runtime JS file missing from coverage; advisory only
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# PR_26161_005 Objects Role Type Save Fix Report
2+
3+
## Branch Guard
4+
5+
- Current branch: `main`
6+
- Expected branch: `main`
7+
- Local branches found: `main`
8+
- Branch validation before edits: PASS
9+
10+
## Source Of Truth
11+
12+
- `docs_build/dev/PROJECT_INSTRUCTIONS.md` was read before execution.
13+
- `docs_build/pr/PR_26161_005-objects-role-type-save-fix/BUILD_PR.md` was not present.
14+
- `docs_build/pr/BUILD_PR.md` was stale and unrelated.
15+
- Execution used the user-provided PR_26161_005 request as the active BUILD source.
16+
17+
## Requirement Checklist
18+
19+
- PASS: Kept Objects as a clickable `Wireframe` tool; no metadata status change was made.
20+
- PASS: Removed the visible `Type` column and dropdown from the Objects table.
21+
- PASS: Kept `Role` as the broad creator-facing category with `Hero`, `Enemy`, `Projectile`, `Platform`, `Wall`, `Collectible`, `Hazard`, `Goal`, `Spawner`, `UI`, and `Custom`.
22+
- PASS: Derived the hidden internal object-model family from Role for the shared validator instead of asking creators to choose overlapping Type values.
23+
- PASS: Preserved inline table editing, `Cancel`, `Edit`, `Trash`, Add-disabled-while-editing, and sprite preview behavior.
24+
- PASS: Fixed edit save for existing Sprite objects by carrying the linked sprite asset through the edit row.
25+
- PASS: Sprite render rows create or resolve a real shared sprite asset before entering the saved table.
26+
- PASS: `None` render rows save without requiring a Render Asset.
27+
- PASS: Saved Sprite rows validate with a linked asset; missing Sprite asset is allowed only during pre-handoff row validation.
28+
- PASS: Added no sample JSON alignment, auth behavior, production DB behavior, or unrelated tool rewrites.
29+
30+
## Implementation Evidence
31+
32+
- `toolbox/objects/index.html` now shows table columns `Name`, `Role`, `State`, `Render`, `Traits`, `Render Asset`, and `Actions`.
33+
- `toolbox/objects/objects.js` adds Role-to-internal-family derivation and removes the visible Type option flow.
34+
- `toolbox/objects/objects.js` preserves an existing Sprite asset key/preview path during edit mode and validates Sprite rows after asset handoff.
35+
- `tests/playwright/tools/ObjectsTool.spec.mjs` verifies no Type column/dropdown, no Object Types panel, Role choices, Add disable, None-render save, Sprite create/resolve, edit-save without handoff error, and Toolbox click-through.
36+
37+
## Validation
38+
39+
- PASS: `node --check toolbox/objects/objects.js`
40+
- PASS: `node --check tests/playwright/tools/ObjectsTool.spec.mjs`
41+
- PASS: `node --check tests/engine/ObjectModelContract.test.mjs`
42+
- PASS: HTML restriction check for `toolbox/objects/index.html`
43+
- PASS: targeted Type-control scan found no visible Objects Type controls; only `Render Type` remains.
44+
- PASS: `node tests/engine/ObjectModelContract.test.mjs`
45+
- PASS: `npx playwright test tests/playwright/tools/ObjectsTool.spec.mjs --workers=1 --reporter=line` (4 passed)
46+
- PASS: `git diff --check`
47+
48+
## Playwright V8 Coverage
49+
50+
- PASS: `docs_build/dev/reports/playwright_v8_coverage_report.txt` was regenerated by targeted Objects Playwright.
51+
- Changed Objects runtime JavaScript coverage: `(94%) toolbox/objects/objects.js - executed lines 762/762; executed functions 80/85`.
52+
- WARN: The coverage helper also reports prior-HEAD changed files such as `src/dev-runtime/guest-seeds/tool-metadata-inventory.js` and `src/engine/object-model/objectModelRegistry.js`; those files are not modified by PR_005 and are advisory for this PR.
53+
54+
## Skipped Lanes
55+
56+
- SKIP: Full samples validation. Safe to skip because no sample JSON, sample manifests, sample launch paths, or engine runtime behavior changed.
57+
- SKIP: Toolbox/Admin metadata Playwright. Safe to skip because PR_005 did not change tool metadata; Objects clickability as wireframe is covered by targeted Objects Playwright.
58+
- SKIP: Sprite Editor launch/handoff Playwright. Safe to skip because no Sprite Editor route or context contract files changed; Objects still uses the existing Sprite Editor URL contract.
59+
- SKIP: Production DB/auth/persistence validation. Safe to skip because the change only uses existing mock-adapter/shared asset contracts and adds no auth, production DB, or persistence behavior.
60+
61+
## Manual Notes
62+
63+
- Role is now the only creator-facing category field in the Objects table.
64+
- The internal object model type remains present only as derived data required by the shared validator.
65+
- Behavior/physics configuration remains out of scope and belongs to a later rules/physics/events PR.

docs_build/dev/reports/playwright_v8_coverage_report.txt

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@ Exercised tool entry points detected:
1818

1919
Changed runtime JS files covered:
2020
(0%) src/dev-runtime/guest-seeds/tool-metadata-inventory.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
21-
(0%) src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js - WARNING: changed runtime JS file was not collected by Playwright V8 coverage; advisory only
2221
(67%) src/engine/object-model/objectModelRegistry.js - executed lines 139/139; executed functions 4/6
23-
(70%) src/engine/object-model/objectDefinitionValidator.js - executed lines 360/360; executed functions 16/23
24-
(75%) src/engine/object-model/objectDefinitionSchema.js - executed lines 58/58; executed functions 3/4
25-
(95%) toolbox/objects/objects.js - executed lines 741/741; executed functions 84/88
22+
(94%) toolbox/objects/objects.js - executed lines 762/762; executed functions 80/85
2623

2724
Files with executed line/function counts where available:
2825
(33%) src/engine/api/toolbox-votes-api-client.js - executed lines 46/46; executed functions 2/6
@@ -36,23 +33,19 @@ Files with executed line/function counts where available:
3633
(75%) src/engine/object-model/objectDefinitionSchema.js - executed lines 58/58; executed functions 3/4
3734
(77%) toolbox/tools-page-accordions.js - executed lines 965/965; executed functions 79/103
3835
(86%) toolbox/tool-registry-api-client.js - executed lines 152/152; executed functions 24/28
39-
(95%) toolbox/objects/objects.js - executed lines 741/741; executed functions 84/88
36+
(94%) toolbox/objects/objects.js - executed lines 762/762; executed functions 80/85
4037
(100%) src/engine/object-model/index.js - executed lines 29/29; executed functions 1/1
4138
(100%) toolbox/project-workspace/project-workspace-api-client.js - executed lines 12/12; executed functions 2/2
4239

4340
Uncovered or low-coverage changed JS files:
4441
(0%) src/dev-runtime/guest-seeds/tool-metadata-inventory.js - WARNING: uncovered changed runtime JS file; advisory only
45-
(0%) src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js - WARNING: uncovered changed runtime JS file; advisory only
4642

4743
Changed JS files considered:
4844
(0%) src/dev-runtime/guest-seeds/tool-metadata-inventory.js - changed JS file not collected as browser runtime coverage
49-
(0%) src/dev-runtime/persistence/tool-repositories/assets-mock-repository.js - changed JS file not collected as browser runtime coverage
5045
(0%) tests/engine/ObjectModelContract.test.mjs - changed JS file not collected as browser runtime coverage
5146
(0%) tests/playwright/tools/ObjectsTool.spec.mjs - changed JS file not collected as browser runtime coverage
5247
(0%) tests/playwright/tools/RootToolsFutureState.spec.mjs - changed JS file not collected as browser runtime coverage
5348
(0%) tests/playwright/tools/ToolboxAdminMetadataSsot.spec.mjs - changed JS file not collected as browser runtime coverage
5449
(0%) tests/playwright/tools/ToolboxRoutePages.spec.mjs - changed JS file not collected as browser runtime coverage
5550
(67%) src/engine/object-model/objectModelRegistry.js - changed JS file with browser V8 coverage
56-
(70%) src/engine/object-model/objectDefinitionValidator.js - changed JS file with browser V8 coverage
57-
(75%) src/engine/object-model/objectDefinitionSchema.js - changed JS file with browser V8 coverage
58-
(95%) toolbox/objects/objects.js - changed JS file with browser V8 coverage
51+
(94%) toolbox/objects/objects.js - changed JS file with browser V8 coverage

tests/playwright/tools/ObjectsTool.spec.mjs

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,8 @@ async function expectNoPageFailures(failures) {
6868
expect(failures.consoleErrors).toEqual([]);
6969
}
7070

71-
async function fillActiveRow(page, { name, renderType = "None", role, state = "Active", type }) {
71+
async function fillActiveRow(page, { name, renderType = "None", role, state = "Active" }) {
7272
await page.locator("[data-objects-row-name]").fill(name);
73-
await page.locator("[data-objects-row-type]").selectOption(type);
7473
await page.locator("[data-objects-row-role]").selectOption(role);
7574
await page.locator("[data-objects-row-state]").selectOption(state);
7675
await page.locator("[data-objects-row-render-type]").selectOption(renderType);
@@ -83,15 +82,21 @@ test("Objects exposes broad table input without sample-path wording", async ({ p
8382
await expect(page.locator(".tool-workspace")).toBeVisible();
8483
await expect(page.locator("style, [style], script:not([src])")).toHaveCount(0);
8584
await expect(page.locator("main")).not.toContainText(OLD_SAMPLE_PATH_PATTERN);
85+
await expect(page.locator("[data-objects-list-table] th")).toHaveText([
86+
"Name",
87+
"Role",
88+
"State",
89+
"Render",
90+
"Traits",
91+
"Render Asset",
92+
"Actions",
93+
]);
94+
await expect(page.locator("[data-objects-row-type]")).toHaveCount(0);
95+
await expect(page.getByText("Object Types", { exact: true })).toHaveCount(0);
8696
await expect(page.locator("[data-objects-role-basics] li")).toHaveText(ROLE_OPTIONS);
8797
await expect(page.locator("[data-objects-readiness]")).toHaveText("Needs Input");
8898
await expect(page.locator("[data-objects-validation-overlay]")).toBeVisible();
8999
await expect(page.locator("[data-objects-validation-list]")).toContainText("Object row: Add at least one object row.");
90-
await expect(page.locator("[data-objects-type-basics]")).toContainText("Static");
91-
await expect(page.locator("[data-objects-type-basics]")).toContainText("Dynamic");
92-
await expect(page.locator("[data-objects-type-basics]")).toContainText("Collectible");
93-
await expect(page.locator("[data-objects-type-basics]")).toContainText("Hazard");
94-
await expect(page.locator("[data-objects-type-basics]")).toContainText("Goal");
95100
await expect(page.locator("[data-objects-trait-basics]")).toContainText("movable");
96101
await expect(page.locator("[data-objects-trait-basics]")).toContainText("playerControlled");
97102
await expect(page.locator("[data-objects-trait-basics]")).toContainText("collides");
@@ -148,12 +153,14 @@ test("Objects table add disables while active row can cancel, save, edit, and tr
148153
await expect(page.locator("[data-objects-list]")).toContainText("No objects drafted yet.");
149154

150155
await addButton.click();
151-
await fillActiveRow(page, { name: "Hero", role: "Hero", type: "Dynamic" });
156+
await fillActiveRow(page, { name: "Hero", role: "Hero" });
152157
await page.locator("[data-objects-save-row]").click();
153158
await expect(page.locator("[data-objects-log]")).toHaveText("Added Hero.");
154159
await expect(addButton).toBeEnabled();
155160
await expect(page.locator("[data-objects-list]")).toContainText("Hero");
156161
await expect(page.locator("[data-objects-list]")).toContainText("Player Controlled");
162+
await expect(page.locator("[data-objects-list]")).toContainText("None");
163+
await expect(page.locator("[data-objects-validation-list]")).not.toContainText("Render Asset");
157164
await expect(page.locator("[data-objects-edit-row='hero']")).toBeVisible();
158165
await expect(page.locator("[data-objects-trash-row='hero']")).toBeVisible();
159166

@@ -188,7 +195,6 @@ test("Objects table save preserves linked sprite asset create and resolve behavi
188195
name: "Bolt",
189196
renderType: "Sprite",
190197
role: "Projectile",
191-
type: "Dynamic",
192198
});
193199
await expect(page.locator("[data-objects-row-render-asset-preview]")).toHaveText("Links on save");
194200
await page.locator("[data-objects-save-row]").click();
@@ -206,13 +212,19 @@ test("Objects table save preserves linked sprite asset create and resolve behavi
206212
"/toolbox/sprites/index.html?assetKey=sprite_bolt&objectKey=bolt&sourceTool=objects"
207213
);
208214

215+
await page.locator("[data-objects-edit-row='bolt']").click();
216+
await expect(page.locator("[data-objects-row-render-asset-preview]")).toHaveText("sprite_bolt");
217+
await page.locator("[data-objects-save-row]").click();
218+
await expect(page.locator("[data-objects-log]")).toHaveText("Saved Bolt.");
219+
await expect(page.locator("[data-objects-log]")).not.toContainText("Sprite asset handoff blocked");
220+
await expect(page.locator("[data-objects-list]")).toContainText("sprite_bolt");
221+
209222
await page.getByRole("button", { name: "Reset Table" }).click();
210223
await page.getByRole("button", { name: "Add Object" }).click();
211224
await fillActiveRow(page, {
212225
name: "Bolt",
213226
renderType: "Sprite",
214227
role: "Projectile",
215-
type: "Dynamic",
216228
});
217229
await page.locator("[data-objects-save-row]").click();
218230
await expect(page.locator("[data-objects-log]")).toContainText("Added Bolt.");

toolbox/objects/index.html

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<div class="container">
1919
<div class="kicker">Toolbox / Objects</div>
2020
<h1>Objects</h1>
21-
<p class="lede">Define object setup with static and dynamic body types, broad roles, and sprite render assets handed off through shared asset records.</p>
21+
<p class="lede">Define object setup with broad roles and sprite render assets handed off through shared asset records.</p>
2222
</div>
2323
</section>
2424
<section class="section">
@@ -32,7 +32,7 @@ <h2>Objects</h2>
3232
<details class="vertical-accordion" open>
3333
<summary>Object Setup</summary>
3434
<div class="accordion-body content-stack">
35-
<p data-objects-setup-context>Use the table to define object names, body types, roles, state, and optional sprite render handoff.</p>
35+
<p data-objects-setup-context>Use the table to define object names, roles, state, and optional sprite render handoff.</p>
3636
<div class="content-cluster" aria-label="Objects setup actions">
3737
<button class="btn" type="button" data-objects-seed-starter>Seed Starter Objects</button>
3838
<button class="btn" type="button" data-objects-validate>Validate Setup</button>
@@ -87,7 +87,6 @@ <h3>Objects Table</h3>
8787
<thead>
8888
<tr>
8989
<th>Name</th>
90-
<th>Type</th>
9190
<th>Role</th>
9291
<th>State</th>
9392
<th>Render</th>
@@ -139,9 +138,8 @@ <h3 id="objects-validation-title">Missing Object Setup</h3>
139138
</div>
140139
</details>
141140
<details class="vertical-accordion" open>
142-
<summary>Object Types</summary>
141+
<summary>Traits</summary>
143142
<div class="accordion-body content-stack">
144-
<ul data-objects-type-basics></ul>
145143
<ul data-objects-trait-basics></ul>
146144
</div>
147145
</details>

0 commit comments

Comments
 (0)