From 16d66f0e9800e948e268f2494b4c21274acd4035 Mon Sep 17 00:00:00 2001 From: Dan Wolfson Date: Sat, 7 Nov 2026 21:14:52 +0000 Subject: [PATCH] test(analytic-registry): scope the built-in declaration tests to pyegeria's own routines The RS-W2-1a tests read get_analytic_registry(), which also holds entry points from installed packages. With egeria-trellis-analytics installed they failed: 0.3.1's three routines carry no declaration, 0.4.0's declarations are the library's models (out may be a shape name, so f.kind raised AttributeError), and test_calls_cover_the_registry saw 31 names against 28 calls. The checks that read pyegeria's declaration model now iterate _BUILTINS (test_rs_w2_1a_routine_declarations, test_issue_170's every-builtin test, and the library cross-check). One registry-wide census stays, test_every_registry_entry_is_declared, asserting only that each entry has a declaration. Architect read-back RS-W2-1a, finding F1. Signed-off-by: Dan Wolfson --- .../micro-tests/test_declarations_match_library.py | 5 +++-- .../test_issue_170_analytic_declaration.py | 4 ++-- .../test_rs_w2_1a_routine_declarations.py | 14 ++++++++++++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/tests/micro-tests/test_declarations_match_library.py b/tests/micro-tests/test_declarations_match_library.py index f496aa97..ddee482a 100644 --- a/tests/micro-tests/test_declarations_match_library.py +++ b/tests/micro-tests/test_declarations_match_library.py @@ -15,7 +15,7 @@ library = pytest.importorskip("trellis_analytics.declaration") -from pyegeria.view.analytic_registry import ROW_SHAPES, get_analytic_registry # noqa: E402 +from pyegeria.view.analytic_registry import _BUILTINS, ROW_SHAPES # noqa: E402 #: Keys pyegeria declares that a library release may not know yet, by where they sit. Each is #: dropped before validation only when the installed library's model has no such field, so a newer @@ -39,7 +39,8 @@ def _fields(fields) -> list: return [f.model_dump(exclude_defaults=True) for f in fields] -DECLARED = sorted((name, spec.declaration) for name, spec in get_analytic_registry().items() +#: pyegeria's own routines; entry points from the library declare in the library's own models. +DECLARED = sorted((name, spec.declaration) for name, spec in _BUILTINS.items() if spec.declaration is not None) diff --git a/tests/micro-tests/test_issue_170_analytic_declaration.py b/tests/micro-tests/test_issue_170_analytic_declaration.py index a4349fe5..591806f2 100644 --- a/tests/micro-tests/test_issue_170_analytic_declaration.py +++ b/tests/micro-tests/test_issue_170_analytic_declaration.py @@ -4,11 +4,11 @@ from pydantic import ValidationError from pyegeria.view.analytic_registry import ( + _BUILTINS, AnalyticDeclaration, AnalyticFunctionSpec, analytic_registry_payload, clear_runtime_analytic_functions, - get_analytic_registry, register_analytic_functions, ) @@ -32,7 +32,7 @@ def test_every_builtin_declares_its_results(): """RS-W2-1a: every built-in now declares (asset_composition was the first, RS-W1-4); the field itself stays optional for specs registered by others.""" - assert all(spec.declaration is not None for spec in get_analytic_registry().values()) + assert all(spec.declaration is not None for spec in _BUILTINS.values()) assert AnalyticFunctionSpec(name="x", function="pyegeria.view.overview_metrics.growth_series").declaration is None diff --git a/tests/micro-tests/test_rs_w2_1a_routine_declarations.py b/tests/micro-tests/test_rs_w2_1a_routine_declarations.py index c17d35a1..af1c26ef 100644 --- a/tests/micro-tests/test_rs_w2_1a_routine_declarations.py +++ b/tests/micro-tests/test_rs_w2_1a_routine_declarations.py @@ -136,18 +136,28 @@ def test_stale_and_term_routines_failure_is_unmeasured(): ABSENCE_STATES, LEGACY_NOTHING_FOUND, ROW_SHAPES, + _BUILTINS, get_analytic_registry, ) -BUILTINS = get_analytic_registry() +#: pyegeria's own routines. The registry also holds entry points from installed packages +#: (egeria-trellis-analytics, for one), whose declarations are the library's models, so the +#: checks below that read pyegeria's declaration model run over the built-ins only. +BUILTINS = _BUILTINS AS_OF = "2026-10-01T00:00:00+00:00" -def test_every_registry_entry_is_declared(): +def test_every_builtin_is_declared(): undeclared = sorted(name for name, spec in BUILTINS.items() if spec.declaration is None) assert undeclared == [] +def test_every_registry_entry_is_declared(): + """The census over the whole registry, entry points included: each has a declaration.""" + undeclared = sorted(name for name, spec in get_analytic_registry().items() if spec.declaration is None) + assert undeclared == [] + + def test_the_three_overview_routines_are_registered(): """D6: the Overview depends on these, so they are routines, registered and declared.""" for name in ("count_relationships", "drl_readiness_gates", "solution_component_realisation"):