Skip to content

Commit 8ecbbde

Browse files
author
DavidQ
committed
Derive Workspace Manager tool tile sample counts from matching sample JSON files - PR 11.72
1 parent 92617d8 commit 8ecbbde

5 files changed

Lines changed: 174 additions & 34 deletions

docs/dev/codex_commands.md

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,8 @@
1-
# Codex Command — PR 11.71
1+
# Codex Commands - PR 11.72
22

33
Model: GPT-5.4
44
Reasoning: high
55

6-
```text
7-
Implement PR 11.71 exactly as documented.
8-
9-
Add scripts/PS/audit-sample-json-lockdown.ps1.
10-
11-
Requirements:
12-
- Executable PowerShell only; no markdown/prose in the .ps1 file.
13-
- Must run from repo root.
14-
- Recursively scan samples/** sample leaf folders.
15-
- Count all JSON files under samples/**.
16-
- Determine referenced JSON files by scanning sample JS files for JSON filenames.
17-
- Report:
18-
- JSON files scanned
19-
- Referenced
20-
- Missing reference
21-
- Palette-only sample folders
22-
- Default mode: summary counts only.
23-
- -Details mode: dump missing reference paths and palette-only paths.
24-
- -Ci mode: exit 1 when Missing reference > 0, otherwise exit 0.
25-
- Keep generated CSV at docs/dev/reports/sample_json_lockdown_audit.csv.
26-
- Do not modify sample runtime code.
27-
- Do not modify roadmap text except status marker only if execution-backed.
28-
- Use targeted validation only; do not run full sample suite.
29-
30-
After implementation, run:
31-
./scripts/PS/audit-sample-json-lockdown.ps1
32-
./scripts/PS/audit-sample-json-lockdown.ps1 -Details
33-
./scripts/PS/audit-sample-json-lockdown.ps1 -Ci
34-
35-
If -Ci fails because current repo still has missing references, document that expected blocker in docs/dev/reports/PR_11_71_validation.md and do not hide it.
36-
37-
Return repo-structured ZIP at tmp/PR_11_71_SAMPLE_JSON_LOCKDOWN.zip.
6+
```powershell
7+
codex --model gpt-5.4 --reasoning high "Run BUILD_PR for docs/pr/PR_11_72_WORKSPACE_MANAGER_TOOL_TILE_JSON_COUNTS.md. Implement only the scoped Workspace Manager tool tile sample-count fix. Derive Samples (##) from matching sample JSON files under samples/**. Palette Browser / Manager must count all palette JSON files and show the real count, not a stale/static number. Do not hardcode counts. Do not create fallback/default data. Produce the required evidence report and package the changed files into <project folder>/tmp/PR_11_72_WORKSPACE_MANAGER_TOOL_TILE_JSON_COUNTS.zip."
388
```

docs/dev/commit_comment.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Add CI-safe sample JSON lockdown audit with palette-only visibility - PR 11.71
1+
Derive Workspace Manager tool tile sample counts from matching sample JSON files - PR 11.72
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# PR 11.72 Expected Evidence
2+
3+
Codex must fill the final evidence report after implementation.
4+
5+
Required result:
6+
- Palette JSON filesystem count equals Palette Browser / Manager tile `Samples (##)` count.
7+
- Full sample suite skipped because this is targeted Workspace Manager/tile-count logic only.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# PR 11.72 Workspace Manager Tool Tile JSON Counts
2+
3+
## Files Changed
4+
- `tools/renderToolsIndex.js`
5+
- `docs/dev/reports/pr_11_72_workspace_manager_tile_json_counts.md`
6+
7+
## Count Source Before
8+
- Source: `samples/metadata/samples.index.metadata.json` tool tagging (`toolsUsed` / `toolHints`) in `loadSampleCountByToolId()`.
9+
- Behavior: counted samples tagged to tools, not matching sample JSON files.
10+
- Palette Browser / Manager count from old source: `12`.
11+
12+
## Count Source After
13+
- Source: sample JSON audit CSV generated from recursive `samples/**` scan.
14+
- Primary: `docs/dev/reports/sample_json_lockdown_audit.csv`
15+
- Fallback: `docs/dev/reports/sample_json_js_reference_audit.csv`
16+
- Behavior: counts matching sample JSON filenames per tool via tool-specific pattern matching.
17+
- Palette Browser / Manager matching includes:
18+
- `*.palette.json`
19+
- `*palette-browser*.json`
20+
- No hardcoded numeric counts.
21+
22+
## Validation
23+
### 1) Palette JSON filesystem count
24+
Command:
25+
```powershell
26+
(Get-ChildItem .\samples -Recurse -File -Filter *.json | Where-Object { $_.Name -match 'palette' }).Count
27+
```
28+
Result: `20`
29+
30+
### 2) Old source count check (before behavior)
31+
Command (metadata-based tool tag count for `palette-browser`):
32+
```text
33+
node -e "..."
34+
```
35+
Result: `12`
36+
37+
### 3) New derived count check (from sample JSON audit paths)
38+
Command (targeted Node verification mirroring new matching rules):
39+
```text
40+
node - (inline script)
41+
```
42+
Result:
43+
- `palette-browser`: `20`
44+
- total sample JSON paths scanned from audit: `66`
45+
46+
### 4) Syntax check
47+
Command:
48+
```text
49+
node --check tools/renderToolsIndex.js
50+
```
51+
Result: PASS
52+
53+
## Palette Tile Count Outcome
54+
- Palette JSON filesystem count: `20`
55+
- Derived Palette Browser / Manager tile count source: `20`
56+
- Expected tile label after render: `Samples (20)`
57+
58+
## Guardrail Confirmation
59+
- No hardcoded count values added.
60+
- No fallback/default sample data added.
61+
- No sample runtime code changes.
62+
63+
## Full Suite
64+
- Full sample suite skipped by scope: this PR changes only tool-tile sample count source logic.
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# PR 11.72 - Workspace Manager Tool Tile JSON Counts
2+
3+
## Purpose
4+
Fix Workspace Manager tool tile `Samples (##)` counts so each tool tile reports the real number of matching sample JSON files.
5+
6+
Known example:
7+
- Palette Browser / Manager currently shows `Samples (12)`.
8+
- Repo contains 20 palette JSON files.
9+
- Tile should show `Samples (20)` when 20 palette JSON files match that tool.
10+
11+
## Scope
12+
- Workspace Manager/tool tile count logic only.
13+
- Count sample JSON files under `samples/**` that match each tool.
14+
- Include palette JSON files in the palette tool count.
15+
- Do not change sample data files unless a count source file requires explicit mapping metadata.
16+
- Do not modify roadmap text except status marker only if execution-backed.
17+
18+
## Required Implementation
19+
Codex must inspect the current Workspace Manager tile-count source and replace any stale/static/partial count source with a derived count based on sample JSON matching.
20+
21+
### Count Rule
22+
For each Workspace Manager tool tile:
23+
1. Determine that tool's JSON match pattern(s).
24+
2. Recursively scan `samples/**` for matching `*.json` files.
25+
3. Set the tile label/count to the matching count.
26+
4. Palette Browser / Manager must count all palette JSON files, including:
27+
- `*.palette.json`
28+
- any existing palette JSON naming convention already used by the repo, if present.
29+
30+
### Expected Palette Result
31+
If the repo currently has 20 palette JSON files, the Palette Browser / Manager tile must display:
32+
33+
```text
34+
Samples (20)
35+
```
36+
37+
## Guardrails
38+
- Do not hardcode the number 20.
39+
- Do not hardcode one-off counts for a specific tile.
40+
- Do not create fallback sample data.
41+
- Do not auto-load hidden/default assets.
42+
- Do not broaden into tool registry refactors.
43+
- Do not modify unrelated tools.
44+
- Preserve current tile layout and names.
45+
46+
## Suggested Search Targets
47+
Look for existing count logic in files related to:
48+
- Workspace Manager
49+
- tool tiles
50+
- sample registry/index metadata
51+
- `Samples (` label text
52+
- palette browser / manager tile config
53+
54+
Suggested repo searches:
55+
56+
```powershell
57+
Select-String -Path .\**\*.js,.\**\*.html,.\**\*.json -Pattern "Samples \(" -ErrorAction SilentlyContinue
58+
Select-String -Path .\**\*.js -Pattern "palette" -ErrorAction SilentlyContinue
59+
Select-String -Path .\**\*.js -Pattern "workspace" -ErrorAction SilentlyContinue
60+
```
61+
62+
## Validation
63+
Run targeted validation only.
64+
65+
Required checks:
66+
1. Count palette JSON files:
67+
68+
```powershell
69+
(Get-ChildItem .\samples -Recurse -File -Filter *.json | Where-Object { $_.Name -match 'palette' }).Count
70+
```
71+
72+
2. Open Workspace Manager.
73+
3. Confirm Palette Browser / Manager tile count equals the palette JSON count.
74+
4. Confirm other tool tile counts still render.
75+
5. Run syntax checks only for changed JS files.
76+
6. Do not run full sample smoke test.
77+
78+
## Evidence Report
79+
Create:
80+
81+
```text
82+
docs/dev/reports/pr_11_72_workspace_manager_tile_json_counts.md
83+
```
84+
85+
Include:
86+
- files changed
87+
- count source before
88+
- count source after
89+
- palette JSON count from filesystem
90+
- observed Palette Browser / Manager tile count
91+
- targeted tests run
92+
- full suite skipped reason
93+
94+
## Acceptance
95+
- Palette tile count is derived from actual matching palette JSON files.
96+
- Palette Browser / Manager shows `Samples (20)` if 20 palette JSON files exist.
97+
- No hardcoded count constants.
98+
- No hidden/default fallback data introduced.
99+
- Targeted validation documented.

0 commit comments

Comments
 (0)