Add JSON schemas, data validator, and first CE1 content

Introduces a generic JSON-Schema-subset validator in GDScript
(scripts/data/schema_validator.gd) used both by `make validate-data`
and, later, by ExerciseEngine at load time, plus semantic_checks.gd
for cross-field constraints a schema can't express (answer index
bounds, at least one faulty token in sentence correction, word count
matching between a dictation's target_text and its annotations).

Schemas cover rule, exercise (dispatched per type: multiple_choice,
sentence_correction), dictation, curriculum, and save (save.schema.json
is not yet wired into validate-data; saves live in user://, handled
at the Profiles/Saves step).

First draft content for the CE1 "accord_adjectif" rule (one rule, two
multiple-choice exercises, one sentence correction, one dictation,
one curriculum entry) exercises the full pipeline end to end and
seeds docs/review/content-review.md, regenerated by the new
tools/generate_content_review.py (`make content-review`).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Denis Defolie
2026-10-11 16:47:28 +02:00
parent a1f749de40
commit d057c8ee77
31 changed files with 938 additions and 35 deletions
View File
@@ -0,0 +1,8 @@
{
"level": "CE1",
"region_id": "foret_des_accords",
"chapter_id": "accords_groupe_nominal",
"title": "Les accords dans le groupe nominal",
"rule_ids": ["regle_accord_adjectif"],
"review_status": "draft"
}
View File
@@ -0,0 +1,18 @@
{
"id": "ce1_accord_adjectif_dictee_01",
"level": "CE1",
"domain": "grammaire",
"rule_ids": ["regle_accord_adjectif"],
"difficulty": 1,
"target_text": "Les petits chats dorment.",
"words": [
{ "text": "Les", "expects_capital": true },
{ "text": "petits", "rule_id": "regle_accord_adjectif" },
{ "text": "chats" },
{ "text": "dorment." }
],
"audio_id": "ce1_accord_adjectif_dictee_01",
"audio_provisional": true,
"accepted_variants": [],
"review_status": "draft"
}
View File
@@ -0,0 +1,25 @@
{
"id": "ce1_accord_adjectif_correction_01",
"level": "CE1",
"domain": "grammaire",
"skill": "accord_groupe_nominal",
"rule_id": "regle_accord_adjectif",
"difficulty": 2,
"type": "sentence_correction",
"instruction": "Touche le mot qui contient une erreur, puis corrige-le.",
"tokens": [
{ "text": "Les", "correct": true },
{
"text": "petit",
"correct": false,
"expected": "petits",
"rule_id": "regle_accord_adjectif"
},
{ "text": "chiens", "correct": true },
{ "text": "courent.", "correct": true }
],
"hint": "Le determinant « les » indique un pluriel.",
"explanation": "L'adjectif « petit » s'accorde avec le nom « chiens », qui est au pluriel : il faut ecrire « petits ».",
"review_tags": ["pluriel", "accord_adjectif"],
"review_status": "draft"
}
@@ -0,0 +1,17 @@
{
"id": "ce1_accord_adjectif_qcm_01",
"level": "CE1",
"domain": "grammaire",
"skill": "accord_groupe_nominal",
"rule_id": "regle_accord_adjectif",
"difficulty": 1,
"type": "multiple_choice",
"instruction": "Choisis le bon groupe de mots.",
"question": "Les ... chiens jouent.",
"answers": ["petit", "petits", "petite"],
"correct_answer": 1,
"hint": "Observe le determinant « les » et le nom « chiens ».",
"explanation": "Le groupe nominal est au pluriel. L'adjectif prend ici la marque du pluriel.",
"review_tags": ["pluriel", "accord_adjectif"],
"review_status": "draft"
}
@@ -0,0 +1,17 @@
{
"id": "ce1_accord_adjectif_qcm_02",
"level": "CE1",
"domain": "grammaire",
"skill": "accord_groupe_nominal",
"rule_id": "regle_accord_adjectif",
"difficulty": 1,
"type": "multiple_choice",
"instruction": "Choisis le bon groupe de mots.",
"question": "La ... maison est jolie.",
"answers": ["petit", "petite", "petites"],
"correct_answer": 1,
"hint": "Observe le determinant « la » et le nom « maison ».",
"explanation": "Le nom « maison » est feminin singulier. L'adjectif prend donc la marque du feminin.",
"review_tags": ["feminin", "accord_adjectif"],
"review_status": "draft"
}
View File
+9
View File
@@ -0,0 +1,9 @@
{
"rule_id": "regle_accord_adjectif",
"level": "CE1",
"domain": "grammaire",
"skill": "accord_groupe_nominal",
"statement": "Quand un adjectif accompagne un nom, il s'accorde avec ce nom en genre et en nombre.",
"example": "Un petit chien. Une petite chienne. Des petits chiens. Des petites chiennes.",
"review_status": "draft"
}
+24
View File
@@ -0,0 +1,24 @@
{
"type": "object",
"required": [
"level",
"region_id",
"chapter_id",
"title",
"rule_ids",
"review_status"
],
"additionalProperties": false,
"properties": {
"level": { "type": "string", "enum": ["CE1", "CE2"] },
"region_id": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
"chapter_id": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
"title": { "type": "string", "minLength": 1 },
"rule_ids": {
"type": "array",
"minItems": 1,
"items": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" }
},
"review_status": { "type": "string", "enum": ["draft", "validated"] }
}
}
+47
View File
@@ -0,0 +1,47 @@
{
"type": "object",
"required": [
"id",
"level",
"domain",
"rule_ids",
"difficulty",
"target_text",
"words",
"audio_id",
"audio_provisional",
"accepted_variants",
"review_status"
],
"additionalProperties": false,
"properties": {
"id": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
"level": { "type": "string", "enum": ["CE1", "CE2"] },
"domain": { "type": "string", "enum": ["grammaire", "orthographe"] },
"rule_ids": {
"type": "array",
"minItems": 1,
"items": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" }
},
"difficulty": { "type": "integer", "minimum": 1, "maximum": 3 },
"target_text": { "type": "string", "minLength": 1 },
"words": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"required": ["text"],
"additionalProperties": false,
"properties": {
"text": { "type": "string", "minLength": 1 },
"rule_id": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
"expects_capital": { "type": "boolean" }
}
}
},
"audio_id": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
"audio_provisional": { "type": "boolean" },
"accepted_variants": { "type": "array", "items": { "type": "string" } },
"review_status": { "type": "string", "enum": ["draft", "validated"] }
}
}
@@ -0,0 +1,43 @@
{
"type": "object",
"required": [
"id",
"level",
"domain",
"skill",
"rule_id",
"difficulty",
"type",
"instruction",
"question",
"answers",
"correct_answer",
"hint",
"explanation",
"review_tags",
"review_status"
],
"additionalProperties": false,
"properties": {
"id": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
"level": { "type": "string", "enum": ["CE1", "CE2"] },
"domain": { "type": "string", "enum": ["grammaire", "orthographe"] },
"skill": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
"rule_id": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
"difficulty": { "type": "integer", "minimum": 1, "maximum": 3 },
"type": { "type": "string", "const": "multiple_choice" },
"instruction": { "type": "string", "minLength": 1 },
"question": { "type": "string", "minLength": 1 },
"answers": {
"type": "array",
"minItems": 2,
"maxItems": 6,
"items": { "type": "string", "minLength": 1 }
},
"correct_answer": { "type": "integer", "minimum": 0 },
"hint": { "type": "string", "minLength": 1 },
"explanation": { "type": "string", "minLength": 1 },
"review_tags": { "type": "array", "items": { "type": "string" } },
"review_status": { "type": "string", "enum": ["draft", "validated"] }
}
}
@@ -0,0 +1,48 @@
{
"type": "object",
"required": [
"id",
"level",
"domain",
"skill",
"rule_id",
"difficulty",
"type",
"instruction",
"tokens",
"hint",
"explanation",
"review_tags",
"review_status"
],
"additionalProperties": false,
"properties": {
"id": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
"level": { "type": "string", "enum": ["CE1", "CE2"] },
"domain": { "type": "string", "enum": ["grammaire", "orthographe"] },
"skill": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
"rule_id": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
"difficulty": { "type": "integer", "minimum": 1, "maximum": 3 },
"type": { "type": "string", "const": "sentence_correction" },
"instruction": { "type": "string", "minLength": 1 },
"tokens": {
"type": "array",
"minItems": 2,
"items": {
"type": "object",
"required": ["text", "correct"],
"additionalProperties": false,
"properties": {
"text": { "type": "string", "minLength": 1 },
"correct": { "type": "boolean" },
"expected": { "type": "string", "minLength": 1 },
"rule_id": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" }
}
}
},
"hint": { "type": "string", "minLength": 1 },
"explanation": { "type": "string", "minLength": 1 },
"review_tags": { "type": "array", "items": { "type": "string" } },
"review_status": { "type": "string", "enum": ["draft", "validated"] }
}
}
+22
View File
@@ -0,0 +1,22 @@
{
"type": "object",
"required": [
"rule_id",
"level",
"domain",
"skill",
"statement",
"example",
"review_status"
],
"additionalProperties": false,
"properties": {
"rule_id": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
"level": { "type": "string", "enum": ["CE1", "CE2"] },
"domain": { "type": "string", "enum": ["grammaire", "orthographe"] },
"skill": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
"statement": { "type": "string", "minLength": 1 },
"example": { "type": "string", "minLength": 1 },
"review_status": { "type": "string", "enum": ["draft", "validated"] }
}
}
+32
View File
@@ -0,0 +1,32 @@
{
"type": "object",
"required": [
"schema_version",
"profile_id",
"display_name",
"school_level",
"session_count",
"unlocked_regions",
"skills",
"rewards"
],
"additionalProperties": false,
"properties": {
"schema_version": { "type": "integer", "minimum": 1 },
"profile_id": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" },
"display_name": { "type": "string", "minLength": 1 },
"school_level": { "type": "string", "enum": ["CE1", "CE2"] },
"session_count": { "type": "integer", "minimum": 0 },
"unlocked_regions": { "type": "array", "items": { "type": "string" } },
"skills": { "type": "object" },
"rewards": {
"type": "object",
"required": ["stars", "items"],
"additionalProperties": false,
"properties": {
"stars": { "type": "integer", "minimum": 0 },
"items": { "type": "array", "items": { "type": "string" } }
}
}
}
}