Repository navigation
v0.32.0
No schema change: x-schema-version stays 1.17. Three new errors
(E-CARD-ID-DUP, E-STEP-ID-DUP, E-EXERCISE-ID-DUP) can turn content red
that carries a duplicate id; measured over the ten content repositories there
is none. The structural layer no longer reads files, so no schema file lands
in a consumer's build and validateLesson runs in a browser.
Card, step and exercise ids are unique within a lesson (engine#202)
Three new errors check what the schema's descriptions have always said:
E-CARD-ID-DUP, E-STEP-ID-DUP and E-EXERCISE-ID-DUP, one error per
duplicated id, with the id and its 1-based positions in params. Card ids,
step ids and exercise ids are three separate namespaces: a step and its own
exercise may share an id, as most content does. validateLesson and
validateLessonRules (the /rules entry) both report them.
Why: no engine rule checked it, while the reference app rejects such a lesson
at error level. A lesson with two cards of one id passed every content
repository's gate, and a from_cards matching then silently lost the earlier
card (cards are looked up by id, the later one wins). The template's advisory
audit checked it outside CI only.
A new error can turn valid content red. Measured with this build over the 631
lessons on origin/main of the ten content repositories: 0 hits; a seeded
duplicate in a real lesson is found in all three namespaces.
No schema file in a consumer's build, and validateLesson runs in a browser (engine#203)
The structural layer read schema/*.json at run time through
new URL(../schema/${fileName}, import.meta.url) and node:fs. Vite turns
such a URL into a lookup over every file in schema/ and copied all of them
into every build that imported the package root, parse-only builds included,
and a browser could not run validateLesson at all (no file system). The two
schemas are now a generated module, src/schemas.generated.ts (make sync-types writes it, sync-types-check guards it), without their annotation
keywords (description, title, $comment), which never change what a schema
accepts; a test compiles both forms and compares their verdicts on every
conformance fixture and on negative probes. The JSON files stay the authored
source and still ship.
Measured with Vite 8.3.0 (the reference app's version), one import per build:
| Import | JS before | JS after | Schema files before | after |
|---|---|---|---|---|
parseLesson from the root |
30,482 B | 30,482 B | 146,976 B (3 files) | none |
| the root, nothing used | 670 B | 670 B | 146,976 B (3 files) | none |
validateLesson from the root |
151,294 B | 158,704 B | 146,976 B (3 files) | none |
validateLessonRules from /rules |
19,334 B | 19,334 B | none | none |
The node:fs / node:url build warnings are gone (2 before, 0 after), and the
built validateLesson now validates in a browser-like run, where it threw a
TypeError before.