Skip to content

Commit e6dae94

Browse files
author
DavidQ
committed
PR 8.8: Entity progression dimension (phase vs level)
- Added phase and level fields - Enforced type-based conditional requirements
1 parent c097203 commit e6dae94

4 files changed

Lines changed: 142 additions & 15 deletions

File tree

docs/dev/codex_commands.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ REASONING: medium
33

44
TASK:
55
- Update workspace.schema.json:
6-
- Replace sampleId usage with id
7-
- Add type field requirement
8-
- Ensure entity array structure matches manifest
9-
- Ensure no additionalProperties allowed
6+
- Add phase and level fields
7+
- Add conditional rules:
8+
- sample → phase required, level forbidden
9+
- game → level required, phase forbidden
10+
- Validate manifest against schema
1011
- Do NOT modify runtime
1112
- Do NOT add validators
1213
- Do NOT modify start_of_day

docs/dev/commit_comment.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
PR 8.7: Workspace schema aligned to id/type structure
1+
PR 8.8: Entity progression dimension (phase vs level)
22

3-
- Removed sampleId from schema
4-
- Added id + type requirements
5-
- Enforced strict entity shape
3+
- Added phase and level fields
4+
- Enforced type-based conditional requirements
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# PR 8.8 — Entity Progress Dimension (phase vs level)
2+
3+
## Purpose
4+
Support different progression dimensions per entity type:
5+
- Samples → phase
6+
- Games → level
7+
8+
## Change
9+
10+
### workspace.schema.json
11+
12+
Add optional progression fields with type constraint:
13+
14+
```json
15+
{
16+
"phase": { "type": "string" },
17+
"level": { "type": "string" }
18+
}
19+
```
20+
21+
### Rules
22+
23+
- If type == "sample":
24+
- phase REQUIRED
25+
- level MUST NOT exist
26+
27+
- If type == "game":
28+
- level REQUIRED
29+
- phase MUST NOT exist
30+
31+
- Other types:
32+
- neither required unless defined later
33+
34+
## Enforcement (schema intent)
35+
- Use conditional validation (`if/then`)
36+
- Disallow invalid combinations
37+
38+
## Example
39+
40+
Sample:
41+
```json
42+
{
43+
"id": "0305",
44+
"type": "sample",
45+
"phase": "03",
46+
"tool": "vector-map-editor"
47+
}
48+
```
49+
50+
Game:
51+
```json
52+
{
53+
"id": "game-001",
54+
"type": "game",
55+
"level": "1",
56+
"tool": "engine-runtime"
57+
}
58+
```
59+
60+
## Non-Goals
61+
- no runtime logic
62+
- no validators
63+
64+
## Acceptance
65+
- samples require phase
66+
- games require level
67+
- no mixed usage allowed

tools/schemas/workspace.schema.json

Lines changed: 67 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
"$schema": "https://json-schema.org/draft/2020-12/schema",
33
"$id": "tools/schemas/workspace.schema.json",
44
"type": "object",
5-
"required": ["documentKind", "schema", "version", "samples"],
5+
"required": [
6+
"documentKind",
7+
"schema",
8+
"version",
9+
"samples"
10+
],
611
"additionalProperties": false,
712
"properties": {
813
"documentKind": {
@@ -19,10 +24,13 @@
1924
},
2025
"samples": {
2126
"type": "array",
22-
"uniqueItems": true,
2327
"items": {
2428
"type": "object",
25-
"required": ["id", "type", "tool"],
29+
"required": [
30+
"id",
31+
"type",
32+
"tool"
33+
],
2634
"additionalProperties": false,
2735
"properties": {
2836
"id": {
@@ -31,30 +39,82 @@
3139
},
3240
"type": {
3341
"type": "string",
34-
"minLength": 1
42+
"enum": [
43+
"sample",
44+
"game"
45+
]
3546
},
3647
"phase": {
3748
"type": "string",
3849
"minLength": 1
3950
},
51+
"level": {
52+
"type": "string",
53+
"minLength": 1
54+
},
4055
"tool": {
4156
"type": "string",
4257
"minLength": 1
4358
},
4459
"tools": {
4560
"type": "array",
46-
"uniqueItems": true,
4761
"items": {
4862
"type": "string",
4963
"minLength": 1
50-
}
64+
},
65+
"uniqueItems": true
5166
},
5267
"palette": {
5368
"type": "string",
5469
"minLength": 1
5570
}
5671
},
57-
"description": "id must be unique across samples."
72+
"allOf": [
73+
{
74+
"if": {
75+
"properties": {
76+
"type": {
77+
"const": "sample"
78+
}
79+
},
80+
"required": [
81+
"type"
82+
]
83+
},
84+
"then": {
85+
"required": [
86+
"phase"
87+
],
88+
"not": {
89+
"required": [
90+
"level"
91+
]
92+
}
93+
}
94+
},
95+
{
96+
"if": {
97+
"properties": {
98+
"type": {
99+
"const": "game"
100+
}
101+
},
102+
"required": [
103+
"type"
104+
]
105+
},
106+
"then": {
107+
"required": [
108+
"level"
109+
],
110+
"not": {
111+
"required": [
112+
"phase"
113+
]
114+
}
115+
}
116+
}
117+
]
58118
}
59119
}
60120
}

0 commit comments

Comments
 (0)