Skip to content

Commit 9eea1ad

Browse files
committed
Add shared object-model contract for DB-backed tool migration - PR_26161_002-db-object-model-contract
1 parent 3948507 commit 9eea1ad

13 files changed

Lines changed: 2069 additions & 1044 deletions
Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
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
2+
M docs_build/dev/reports/coverage_changed_js_guardrail.txt
53
M docs_build/dev/reports/playwright_v8_coverage_report.txt
6-
M src/dev-runtime/guest-seeds/tool-metadata-inventory.js
7-
M tests/playwright/tools/RootToolsFutureState.spec.mjs
8-
M tests/playwright/tools/ToolboxAdminMetadataSsot.spec.mjs
4+
M tests/playwright/tools/ObjectsTool.spec.mjs
95
M toolbox/objects/index.html
10-
?? docs_build/dev/reports/objects-beta-rebuild-report.md
11-
?? tests/playwright/tools/ObjectsTool.spec.mjs
12-
?? toolbox/objects/objects.js
6+
M toolbox/objects/objects.js
7+
?? docs_build/dev/reports/db-object-model-contract-report.md
8+
?? src/engine/object-model/
9+
?? tests/engine/ObjectModelContract.test.mjs
1310

1411
# git ls-files --others --exclude-standard
15-
docs_build/dev/reports/objects-beta-rebuild-report.md
16-
tests/playwright/tools/ObjectsTool.spec.mjs
17-
toolbox/objects/objects.js
12+
docs_build/dev/reports/db-object-model-contract-report.md
13+
src/engine/object-model/index.js
14+
src/engine/object-model/objectDefinitionSchema.js
15+
src/engine/object-model/objectDefinitionValidator.js
16+
src/engine/object-model/objectModelRegistry.js
17+
tests/engine/ObjectModelContract.test.mjs
1818

1919
# git diff --stat
20-
docs_build/dev/reports/codex_changed_files.txt | 35 +++--
21-
docs_build/dev/reports/codex_review.diff | Bin 101630 -> 49857 bytes
22-
.../dev/reports/coverage_changed_js_guardrail.txt | 6 +-
23-
.../dev/reports/playwright_v8_coverage_report.txt | 19 +--
24-
.../guest-seeds/tool-metadata-inventory.js | 24 +--
25-
.../playwright/tools/RootToolsFutureState.spec.mjs | 14 +-
26-
.../tools/ToolboxAdminMetadataSsot.spec.mjs | 10 +-
27-
toolbox/objects/index.html | 174 ++++++++++++++++++++-
28-
8 files changed, 224 insertions(+), 58 deletions(-)
20+
.../dev/reports/coverage_changed_js_guardrail.txt | 6 +-
21+
.../dev/reports/playwright_v8_coverage_report.txt | 34 ++--
22+
tests/playwright/tools/ObjectsTool.spec.mjs | 7 +
23+
toolbox/objects/index.html | 15 +-
24+
toolbox/objects/objects.js | 179 +++++++++++++++++----
25+
5 files changed, 185 insertions(+), 56 deletions(-)

docs_build/dev/reports/codex_review.diff

Lines changed: 1091 additions & 967 deletions
Large diffs are not rendered by default.

docs_build/dev/reports/coverage_changed_js_guardrail.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ 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-
(95%) toolbox/objects/objects.js - executed lines 365/365; executed functions 38/40
10+
(67%) src/engine/object-model/objectModelRegistry.js - executed lines 146/146; executed functions 4/6
11+
(70%) src/engine/object-model/objectDefinitionValidator.js - executed lines 269/269; executed functions 14/20
12+
(75%) src/engine/object-model/objectDefinitionSchema.js - executed lines 44/44; executed functions 3/4
13+
(94%) toolbox/objects/objects.js - executed lines 466/466; executed functions 58/62
14+
(100%) src/engine/object-model/index.js - executed lines 29/29; executed functions 1/1
1115

1216
Guardrail warnings:
1317
(0%) src/dev-runtime/guest-seeds/tool-metadata-inventory.js - WARNING: changed runtime JS file missing from coverage; advisory only
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# PR_26161_002-db-object-model-contract Report
2+
3+
## Branch Guard
4+
5+
- Current branch: `main`
6+
- Expected branch: `main`
7+
- Local branches found: `main`
8+
- Branch validation: PASS
9+
10+
## Scope Checklist
11+
12+
- PASS: Read `docs_build/dev/PROJECT_INSTRUCTIONS.md` before BUILD execution.
13+
- PASS: Added shared object-model contract files under `src/engine/object-model/`.
14+
- PASS: Added object body/type registry for `Static`, `Dynamic`, `Collectible`, `Hazard`, and `Goal`.
15+
- PASS: Added trait registry for `movable`, `damageable`, `killable`, `playerControlled`, `bounces`, `collides`, `scores`, `collectible`, `hazard`, and `goal`.
16+
- PASS: Added object definition schema and validator for manifest/config-driven object definitions.
17+
- PASS: Validator returns visible, actionable issue objects with `code`, `path`, `message`, and `action`.
18+
- PASS: Validator rejects legacy names such as `objectStatic`, `objectDynamic`, and `objectKillable`; no legacy class hierarchy was restored.
19+
- PASS: Wired `toolbox/objects` to consume the shared object-model registry and validator instead of page-local type metadata.
20+
- PASS: Objects remains focused on static/dynamic paddle + ball MVP setup and visible diagnostics.
21+
- PASS: Theme V2 restrictions preserved; no inline CSS, inline JS, script blocks, style blocks, or inline event handlers were added.
22+
- PASS: No persistence, auth, sample JSON alignment, DB write behavior, or new engine runtime behavior was added.
23+
- PASS: No Toolbox/Admin metadata was changed in this PR.
24+
25+
## Implementation Evidence
26+
27+
- `src/engine/object-model/objectModelRegistry.js` owns the shared object body/type registry and trait registry.
28+
- `src/engine/object-model/objectDefinitionSchema.js` owns the object definition schema metadata.
29+
- `src/engine/object-model/objectDefinitionValidator.js` validates definitions, rejects unknown fields/types/traits, rejects duplicate traits, and preserves incoming payloads without mutation.
30+
- `src/engine/object-model/index.js` exports the shared contract.
31+
- `toolbox/objects/objects.js` imports the shared registry/validator, renders object type and trait basics from the registry, derives MVP traits for draft rows, and validates draft/list definitions through the shared validator.
32+
- `tests/engine/ObjectModelContract.test.mjs` covers registry membership, schema enum alignment, valid payload cloning/no mutation, actionable invalid diagnostics, and legacy type rejection.
33+
- `tests/playwright/tools/ObjectsTool.spec.mjs` now verifies shared trait registry visibility and trait-backed MVP seeded output.
34+
35+
## Validation
36+
37+
- PASS: `node --check src\engine\object-model\objectModelRegistry.js`
38+
- PASS: `node --check src\engine\object-model\objectDefinitionSchema.js`
39+
- PASS: `node --check src\engine\object-model\objectDefinitionValidator.js`
40+
- PASS: `node --check src\engine\object-model\index.js`
41+
- PASS: `node --check toolbox\objects\objects.js`
42+
- PASS: `node --check tests\engine\ObjectModelContract.test.mjs`
43+
- PASS: `node --check tests\playwright\tools\ObjectsTool.spec.mjs`
44+
- PASS: `node .\scripts\run-node-test-files.mjs tests\engine\ObjectModelContract.test.mjs`
45+
- PASS: `npx playwright test tests/playwright/tools/ObjectsTool.spec.mjs`
46+
- PASS: `Select-String -Path toolbox\objects\index.html -Pattern '<style\b','\son[a-z]+\s*=','<script(?![^>]*\bsrc=)'` returned no matches.
47+
- PASS: `git diff --check`
48+
49+
Note: an initial Playwright invocation used a Windows backslash path and returned `No tests found`; the corrected forward-slash path above matched and passed both targeted Objects tests.
50+
51+
## Playwright V8 Coverage
52+
53+
- PASS: `docs_build/dev/reports/playwright_v8_coverage_report.txt` was regenerated by the targeted Objects Playwright run.
54+
- PASS: Changed PR_002 runtime JS covered by Playwright V8:
55+
- `src/engine/object-model/index.js`
56+
- `src/engine/object-model/objectDefinitionSchema.js`
57+
- `src/engine/object-model/objectDefinitionValidator.js`
58+
- `src/engine/object-model/objectModelRegistry.js`
59+
- `toolbox/objects/objects.js`
60+
- WARN: The coverage helper also reported `src/dev-runtime/guest-seeds/tool-metadata-inventory.js` from its HEAD-change detection path. That file is not modified in this PR working diff, and no Toolbox/Admin metadata behavior was changed here.
61+
62+
## Skipped Lanes
63+
64+
- SKIP: Full samples validation. Safe to skip because this PR does not touch sample JSON, sample launch flows, or sample runtime contracts.
65+
- SKIP: Toolbox/Admin metadata Playwright. Safe to skip because no tool metadata file changed in this PR.
66+
- SKIP: Broad engine/runtime suites. Safe to skip because the new object-model module is an authoring contract and validator only; runtime object instantiation and parser behavior were not changed.
67+
- SKIP: Auth, persistence, and DB adapter tests. Safe to skip because this PR adds no persistence/auth behavior and performs no DB writes.
68+
69+
## Manual Notes
70+
71+
- Objects still uses the First-Class Tool V2 surface and Theme V2 CSS.
72+
- Object type choices and visible type/trait registry lists are generated from `src/engine/object-model/`.
73+
- The MVP seeded path remains in-memory only and validates as ready with a Dynamic paddle, Dynamic ball, and Static boundary.

docs_build/dev/reports/playwright_v8_coverage_report.txt

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,40 @@ Note: entry percentages use function coverage when available, otherwise line cov
1212
Note: coverage entries are aggregated across every page/tool where coverageReporter.start(page) and coverageReporter.stop(page) ran.
1313

1414
Exercised tool entry points detected:
15-
(88%) Toolbox Index - exercised 4 runtime JS files
15+
(88%) Toolbox Index - exercised 2 runtime JS files
1616
(0%) Tool Template V2 - not exercised by this Playwright run
17-
(74%) Theme V2 Shared JS - exercised 2 runtime JS files
17+
(59%) Theme V2 Shared JS - exercised 2 runtime JS files
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-
(95%) toolbox/objects/objects.js - executed lines 365/365; executed functions 38/40
21+
(67%) src/engine/object-model/objectModelRegistry.js - executed lines 146/146; executed functions 4/6
22+
(70%) src/engine/object-model/objectDefinitionValidator.js - executed lines 269/269; executed functions 14/20
23+
(75%) src/engine/object-model/objectDefinitionSchema.js - executed lines 44/44; executed functions 3/4
24+
(94%) toolbox/objects/objects.js - executed lines 466/466; executed functions 58/62
25+
(100%) src/engine/object-model/index.js - executed lines 29/29; executed functions 1/1
2226

2327
Files with executed line/function counts where available:
24-
(38%) src/engine/api/session-api-client.js - executed lines 34/34; executed functions 3/8
25-
(50%) src/engine/api/toolbox-votes-api-client.js - executed lines 46/46; executed functions 3/6
26-
(53%) src/engine/api/server-api-client.js - executed lines 159/159; executed functions 10/19
28+
(36%) src/engine/api/server-api-client.js - executed lines 159/159; executed functions 5/14
29+
(58%) assets/theme-v2/js/gamefoundry-partials.js - executed lines 603/603; executed functions 30/52
2730
(64%) assets/theme-v2/js/tool-display-mode.js - executed lines 209/209; executed functions 9/14
28-
(77%) assets/theme-v2/js/gamefoundry-partials.js - executed lines 603/603; executed functions 43/56
29-
(78%) admin/tool-votes.js - executed lines 406/406; executed functions 43/55
30-
(84%) toolbox/tools-page-accordions.js - executed lines 965/965; executed functions 92/109
31-
(89%) toolbox/tool-registry-api-client.js - executed lines 152/152; executed functions 25/28
32-
(95%) toolbox/objects/objects.js - executed lines 365/365; executed functions 38/40
33-
(100%) toolbox/project-workspace/project-workspace-api-client.js - executed lines 12/12; executed functions 2/2
31+
(67%) src/engine/object-model/objectModelRegistry.js - executed lines 146/146; executed functions 4/6
32+
(70%) src/engine/object-model/objectDefinitionValidator.js - executed lines 269/269; executed functions 14/20
33+
(75%) src/engine/object-model/objectDefinitionSchema.js - executed lines 44/44; executed functions 3/4
34+
(75%) toolbox/tool-registry-api-client.js - executed lines 152/152; executed functions 21/28
35+
(94%) toolbox/objects/objects.js - executed lines 466/466; executed functions 58/62
36+
(100%) src/engine/object-model/index.js - executed lines 29/29; executed functions 1/1
3437

3538
Uncovered or low-coverage changed JS files:
3639
(0%) src/dev-runtime/guest-seeds/tool-metadata-inventory.js - WARNING: uncovered changed runtime JS file; advisory only
3740

3841
Changed JS files considered:
3942
(0%) src/dev-runtime/guest-seeds/tool-metadata-inventory.js - changed JS file not collected as browser runtime coverage
43+
(0%) tests/engine/ObjectModelContract.test.mjs - changed JS file not collected as browser runtime coverage
4044
(0%) tests/playwright/tools/ObjectsTool.spec.mjs - changed JS file not collected as browser runtime coverage
4145
(0%) tests/playwright/tools/RootToolsFutureState.spec.mjs - changed JS file not collected as browser runtime coverage
4246
(0%) tests/playwright/tools/ToolboxAdminMetadataSsot.spec.mjs - changed JS file not collected as browser runtime coverage
43-
(95%) toolbox/objects/objects.js - changed JS file with browser V8 coverage
47+
(67%) src/engine/object-model/objectModelRegistry.js - changed JS file with browser V8 coverage
48+
(70%) src/engine/object-model/objectDefinitionValidator.js - changed JS file with browser V8 coverage
49+
(75%) src/engine/object-model/objectDefinitionSchema.js - changed JS file with browser V8 coverage
50+
(94%) toolbox/objects/objects.js - changed JS file with browser V8 coverage
51+
(100%) src/engine/object-model/index.js - changed JS file with browser V8 coverage

src/engine/object-model/index.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
Toolbox Aid
3+
David Quesenberry
4+
06/10/2026
5+
index.js
6+
*/
7+
8+
export {
9+
OBJECT_MODEL_TRAIT_IDS,
10+
OBJECT_MODEL_TRAIT_LIST,
11+
OBJECT_MODEL_TRAIT_REGISTRY,
12+
OBJECT_MODEL_TYPE_IDS,
13+
OBJECT_MODEL_TYPE_LIST,
14+
OBJECT_MODEL_TYPE_REGISTRY,
15+
getObjectModelTrait,
16+
getObjectModelType,
17+
isObjectModelTrait,
18+
isObjectModelType,
19+
} from "./objectModelRegistry.js";
20+
21+
export {
22+
OBJECT_DEFINITION_SCHEMA,
23+
OBJECT_DEFINITION_SCHEMA_ID,
24+
OBJECT_DEFINITION_SCHEMA_VERSION,
25+
getObjectDefinitionSchema,
26+
} from "./objectDefinitionSchema.js";
27+
28+
export {
29+
OBJECT_DEFINITION_VALIDATION_CODES,
30+
validateObjectDefinition,
31+
validateObjectDefinitionList,
32+
} from "./objectDefinitionValidator.js";
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
Toolbox Aid
3+
David Quesenberry
4+
06/10/2026
5+
objectDefinitionSchema.js
6+
*/
7+
8+
import { OBJECT_MODEL_TRAIT_LIST, OBJECT_MODEL_TYPE_LIST } from "./objectModelRegistry.js";
9+
10+
export const OBJECT_DEFINITION_SCHEMA_ID = "gamefoundrystudio.object-model.definition/1";
11+
export const OBJECT_DEFINITION_SCHEMA_VERSION = 1;
12+
13+
const OBJECT_MODEL_TYPE_ENUM = Object.freeze(OBJECT_MODEL_TYPE_LIST.map((objectType) => objectType.id));
14+
const OBJECT_MODEL_TRAIT_ENUM = Object.freeze(OBJECT_MODEL_TRAIT_LIST.map((trait) => trait.id));
15+
const OBJECT_DEFINITION_STATE_ENUM = Object.freeze(["Active", "Idle", "Disabled"]);
16+
17+
export const OBJECT_DEFINITION_SCHEMA = Object.freeze({
18+
$id: OBJECT_DEFINITION_SCHEMA_ID,
19+
$schema: "https://json-schema.org/draft/2020-12/schema",
20+
additionalProperties: false,
21+
properties: Object.freeze({
22+
behavior: Object.freeze({ type: "string" }),
23+
id: Object.freeze({ minLength: 1, type: "string" }),
24+
interaction: Object.freeze({ type: "string" }),
25+
name: Object.freeze({ minLength: 1, type: "string" }),
26+
role: Object.freeze({ type: "string" }),
27+
state: Object.freeze({ enum: OBJECT_DEFINITION_STATE_ENUM, type: "string" }),
28+
traits: Object.freeze({
29+
items: Object.freeze({
30+
enum: OBJECT_MODEL_TRAIT_ENUM,
31+
type: "string",
32+
}),
33+
type: "array",
34+
uniqueItems: true,
35+
}),
36+
type: Object.freeze({
37+
enum: OBJECT_MODEL_TYPE_ENUM,
38+
type: "string",
39+
}),
40+
}),
41+
required: Object.freeze(["name", "type", "traits"]),
42+
title: "GameFoundryStudio Object Definition",
43+
type: "object",
44+
version: OBJECT_DEFINITION_SCHEMA_VERSION,
45+
});
46+
47+
export function getObjectDefinitionSchema() {
48+
return OBJECT_DEFINITION_SCHEMA;
49+
}

0 commit comments

Comments
 (0)