From 2af655b8f7dc8a8a58a5c8010d8e836ef9e95708 Mon Sep 17 00:00:00 2001 From: Oleksii-debug Date: Sun, 27 Sep 2026 05:46:00 +0200 Subject: [PATCH 1/2] Pedagogy: discover canonical Gospel node envelopes --- tools/analyze_pedagogical_quality.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tools/analyze_pedagogical_quality.py b/tools/analyze_pedagogical_quality.py index 50d7290b8..58bda5d5b 100755 --- a/tools/analyze_pedagogical_quality.py +++ b/tools/analyze_pedagogical_quality.py @@ -18,6 +18,7 @@ from typing import Any, Iterable, Mapping, Sequence SCHEMA = "CONTENT_NODE_SCHEMA_v1.2" +GOSPEL_SCHEMA = "GW_CANONICAL_NODE_FILESET_v1.2" HINT_KEYS = tuple(f"H{i}" for i in range(1, 8)) BLOCKER = "BLOCKER" WARN = "WARN" @@ -139,6 +140,21 @@ def _discover_json(roots: Sequence[str]) -> list[Path]: return sorted(found, key=lambda p: p.as_posix()) +def _recognized_node_schema(doc: Mapping[str, Any]) -> str | None: + """Return an explicitly supported canonical node-envelope schema. + + LN/PA use CONTENT_NODE_SCHEMA_v1.2 in schema_version. The independently + qualified Gospel corpus uses GW_CANONICAL_NODE_FILESET_v1.2 in schema while + preserving the same pedagogical node fields consumed below. Explicit + recognition prevents unrelated JSON from being silently reclassified. + """ + if doc.get("schema_version") == SCHEMA: + return SCHEMA + if doc.get("schema") == GOSPEL_SCHEMA: + return GOSPEL_SCHEMA + return None + + def _load_schema_nodes(paths: Iterable[Path]) -> tuple[list[NodeRecord], int, Counter[str]]: records: list[NodeRecord] = [] schema_files = 0 @@ -148,7 +164,7 @@ def _load_schema_nodes(paths: Iterable[Path]) -> tuple[list[NodeRecord], int, Co doc = json.loads(path.read_text(encoding="utf-8")) except (OSError, UnicodeDecodeError, json.JSONDecodeError): continue - if not isinstance(doc, dict) or doc.get("schema_version") != SCHEMA: + if not isinstance(doc, dict) or _recognized_node_schema(doc) is None: continue nodes = doc.get("nodes") if not isinstance(nodes, list): From b57836b80ca73caa9299fac9637b882389b8ceea Mon Sep 17 00:00:00 2001 From: Oleksii-debug Date: Sun, 27 Sep 2026 05:46:15 +0200 Subject: [PATCH 2/2] Test Gospel pedagogical envelope discovery --- tools/test_analyze_pedagogical_quality.py | 27 +++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tools/test_analyze_pedagogical_quality.py b/tools/test_analyze_pedagogical_quality.py index 89fc08603..a1b304812 100644 --- a/tools/test_analyze_pedagogical_quality.py +++ b/tools/test_analyze_pedagogical_quality.py @@ -72,6 +72,23 @@ def _write_pack(root: Path, nodes: list[dict], *, status: str = "AUTHOR_COMPLETE return path +def _write_gospel_pack(root: Path, nodes: list[dict]) -> Path: + path = root / "gospel-nodes.json" + path.write_text( + json.dumps( + { + "schema": "GW_CANONICAL_NODE_FILESET_v1.2", + "mission_id": "GW-T", + "node_count": len(nodes), + "nodes": nodes, + }, + ensure_ascii=False, + ), + encoding="utf-8", + ) + return path + + class PedagogicalQualityAnalyzerTests(unittest.TestCase): def test_substantive_node_has_no_blocker(self): with tempfile.TemporaryDirectory() as tmp: @@ -154,6 +171,16 @@ def test_report_keeps_canonical_status_inventory_without_audit_promotion(self): self.assertEqual(payload["canonical_status_counts"], {status: 1}) self.assertIn("independent audit acceptance", payload["interpretation"]["not_claimed"]) + def test_gospel_canonical_envelope_is_analyzed_without_status_promotion(self): + with tempfile.TemporaryDirectory() as tmp: + _write_gospel_pack(Path(tmp), [_node("GW-T-N01")]) + result = analyze([tmp]) + blockers = [f for f in result.findings if f.severity == BLOCKER] + self.assertEqual(blockers, []) + self.assertEqual(result.schema_files, 1) + self.assertEqual(result.nodes_analyzed, 1) + self.assertEqual(result.canonical_status_counts, {"": 1}) + def test_non_schema_json_is_ignored_not_reclassified(self): with tempfile.TemporaryDirectory() as tmp: root = Path(tmp)