Skip to content

Commit 824c681

Browse files
feat(pipeline): enforce JSON schemas for all stage artifacts
docs: mark P1.3 complete and queue final schema follow-ups
1 parent 2ef012a commit 824c681

17 files changed

+706
-25
lines changed

package-lock.json

Lines changed: 102 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
]
5151
},
5252
"dependencies": {
53+
"ajv": "^8.17.1",
54+
"ajv-formats": "^3.0.1",
5355
"marked": "^16.3.0",
5456
"normalize-package-data": "^8.0.0",
5557
"npm-check-updates": "^18.3.0",

pipeline-refactor-roadmap.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ This document captures the long-term improvements we want to implement in the mo
1717
| ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------ |
1818
| P1.1 | Describe the full stage graph (inputs/outputs, side-effects) in a machine-readable config ([stage graph](pipeline/stage-graph.json)) ✅ Completed Sep 2025 | none | S |
1919
| P1.2 | Introduce a lightweight orchestrator (Node CLI) that reads the config and runs stages with structured logging | P1.1 | M |
20-
| P1.3 | Add JSON-schema validation for every stage boundary (modules.stage.\* files) | P1.1 | M |
20+
| P1.3 | Add JSON-schema validation for every stage boundary (modules.stage.\* files) ([schemas](pipeline/schemas)) ✅ Completed Sep 2025 | P1.1 | M |
2121
| P1.4 | Provide a skip/only mechanism for partial runs (e.g. `--only=checks`) | P1.2 | S |
22+
| P1.5 | Define schemas for published outputs (`modules.json`, `modules.min.json`, `stats.json`) and enforce validation in release packaging | P1.3 | M |
23+
| P1.6 | Consolidate shared schema definitions (shared `$defs` / generator) to keep stage contracts in sync | P1.3 | S |
2224

2325
### 2. Runtime & Codebase Consolidation
2426

@@ -74,15 +76,16 @@ These topics sit adjacent to the pipeline work but should stay visible while pri
7476

7577
## Execution Strategy
7678

77-
1. **Foundation first**: Complete P1.3 and P5.1 to ensure we fully understand the existing pipeline and keep stage contracts safe while refactoring.
79+
1. **Foundation first**: Focus on P5.1 to visualize the current architecture now that P1.3 is in place.
7880
2. **Consolidate utilities** (P2.1) before migrating Python scripts so we can share code and avoid duplicated logic.
7981
3. **Migrate in slices**: Move `get_modules` first (lower risk) and keep Python fallbacks until the TS version is proven stable. Follow with `check_modules` in feature flags (`--checks=legacy|ts`).
8082
4. **Add tests alongside migrations** to prevent regressions and make future refactors safer.
8183
5. **Keep communication tight** via roadmap review meetings or async updates in GitHub Discussions.
8284

8385
## Next Concrete Steps
8486

85-
1. Create issues for P1.3 and P5.1 and assign initial owners.
86-
2. Prepare a small sample dataset to validate the staging files while we work on schema validation.
87+
1. Create an issue for P5.1 and assign an initial owner.
88+
2. Prepare a small sample dataset to validate the staging files against the new schemas.
89+
3. File follow-up issues for P1.5 and P1.6 (final artifact schemas + shared definitions) and slot them after P5.1.
8790

8891
Feel free to adjust priorities, rename tasks, or add new items. This roadmap is meant to stay alive—update it as soon as we learn something new during implementation.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://magicmirror.builders/schemas/modules.stage.1.json",
4+
"title": "Modules Stage 1",
5+
"type": "object",
6+
"required": ["lastUpdate", "modules"],
7+
"properties": {
8+
"lastUpdate": {
9+
"type": "string",
10+
"format": "date-time"
11+
},
12+
"modules": {
13+
"type": "array",
14+
"items": {
15+
"$ref": "#/$defs/module"
16+
}
17+
}
18+
},
19+
"additionalProperties": false,
20+
"$defs": {
21+
"module": {
22+
"type": "object",
23+
"required": [
24+
"name",
25+
"category",
26+
"url",
27+
"id",
28+
"maintainer",
29+
"description",
30+
"issues"
31+
],
32+
"properties": {
33+
"name": {
34+
"type": "string",
35+
"minLength": 1
36+
},
37+
"category": {
38+
"type": "string",
39+
"minLength": 1
40+
},
41+
"url": {
42+
"type": "string",
43+
"format": "uri"
44+
},
45+
"id": {
46+
"type": "string",
47+
"minLength": 1
48+
},
49+
"maintainer": {
50+
"type": "string",
51+
"minLength": 1
52+
},
53+
"maintainerURL": {
54+
"type": "string"
55+
},
56+
"description": {
57+
"type": "string"
58+
},
59+
"issues": {
60+
"type": "array",
61+
"items": {
62+
"type": "string"
63+
}
64+
},
65+
"outdated": {
66+
"type": "string"
67+
}
68+
},
69+
"additionalProperties": true
70+
}
71+
}
72+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://magicmirror.builders/schemas/modules.stage.2.json",
4+
"title": "Modules Stage 2",
5+
"type": "array",
6+
"items": {
7+
"$ref": "#/$defs/module"
8+
},
9+
"$defs": {
10+
"module": {
11+
"type": "object",
12+
"required": [
13+
"name",
14+
"category",
15+
"url",
16+
"id",
17+
"maintainer",
18+
"description",
19+
"issues"
20+
],
21+
"properties": {
22+
"name": {
23+
"type": "string",
24+
"minLength": 1
25+
},
26+
"category": {
27+
"type": "string",
28+
"minLength": 1
29+
},
30+
"url": {
31+
"type": "string",
32+
"format": "uri"
33+
},
34+
"id": {
35+
"type": "string",
36+
"minLength": 1
37+
},
38+
"maintainer": {
39+
"type": "string",
40+
"minLength": 1
41+
},
42+
"maintainerURL": {
43+
"type": "string"
44+
},
45+
"description": {
46+
"type": "string"
47+
},
48+
"issues": {
49+
"type": "array",
50+
"items": {
51+
"type": "string"
52+
}
53+
},
54+
"outdated": {
55+
"type": "string"
56+
},
57+
"stars": {
58+
"type": "integer",
59+
"minimum": 0
60+
},
61+
"license": {
62+
"type": "string"
63+
},
64+
"hasGithubIssues": {
65+
"type": "boolean"
66+
},
67+
"isArchived": {
68+
"type": "boolean"
69+
}
70+
},
71+
"additionalProperties": true
72+
}
73+
}
74+
}

0 commit comments

Comments
 (0)