Report a missing entity source beside a licensed one.
All checks were successful
synthetic / suite (push) Successful in 1m2s

Assistant: grok
Assistant-Session: 01a1531b-6698-7732-8587-f28ea604bcdf
This commit is contained in:
tegwick 2026-10-19 11:10:52 +02:00
parent 70054ee7cc
commit 8bcb3414d7
4 changed files with 33 additions and 7 deletions

View file

@ -12,6 +12,7 @@ from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(ROOT))
from content_explorer.contract import graph_errors # noqa: E402
from content_explorer.ingest import project_records, publish_directory # noqa: E402
from content_explorer.quality import FAILURE_CLASSES, quality_report, report_dataspaces # noqa: E402
@ -129,6 +130,29 @@ class ExampleReports(unittest.TestCase):
self.assertEqual(allowed_report["failureClasses"]["rights"], 0)
self.assertEqual(allowed_report["failureClasses"]["missing-license"], 0)
def test_entity_source_ref_is_unresolved_beside_a_licensed_source(self) -> None:
snapshot, manifest = load_example("systems-thinking")
entity = next(
item for item in snapshot["entities"]
if item["id"] == "urn:ce:systems-thinking:concept:feedback"
)
licensed = entity["sourceRefs"][0]
self.assertIn(licensed, {source["id"] for source in snapshot["sources"]})
entity["sourceRefs"] = list(entity["sourceRefs"]) + ["src:does-not-exist"]
report = quality_report(snapshot, manifest, today="2026-10-19")
self.assertTrue(any(
item["id"] == entity["id"]
and item["field"] == "sourceRefs"
and item["target"] == "src:does-not-exist"
for item in report["unresolvedReferences"]
))
self.assertGreater(report["failureClasses"]["unresolved-reference"], 0)
self.assertIn(entity["id"], report["provenance"]["incomplete"])
self.assertTrue(any(
error == f"{entity['id']}: missing source src:does-not-exist"
for error in graph_errors(snapshot, manifest)
))
def test_stale_state_is_counted(self) -> None:
snapshot, manifest = load_example("software-architecture")
entity_id = snapshot["entities"][0]["id"]