feat: explain configured institutional architecture
This commit is contained in:
@@ -18,12 +18,18 @@ from govoplan_core.core.modules import (
|
||||
FrontendRoute,
|
||||
)
|
||||
from govoplan_core.core.registry import PlatformRegistry
|
||||
from govoplan_core.core.provider_governance import (
|
||||
ModuleArchitectureDeclaration,
|
||||
ModuleMaturityEvidence,
|
||||
)
|
||||
from govoplan_tenancy.backend.manifest import get_manifest as get_tenancy_manifest
|
||||
from govoplan_docs.backend.api.v1.routes import (
|
||||
_classify_documentation,
|
||||
_condition_visibility,
|
||||
_documentation_topic_anchor,
|
||||
_documentation_topic_groups,
|
||||
_documentation_provider_state,
|
||||
_module_payload,
|
||||
_visible_documentation_sources,
|
||||
docs_context,
|
||||
)
|
||||
@@ -46,6 +52,61 @@ class FakePrincipal:
|
||||
|
||||
|
||||
class DocsContextTests(unittest.TestCase):
|
||||
def test_user_provider_state_omits_binding_details(self) -> None:
|
||||
state = {
|
||||
"configured": True,
|
||||
"active": True,
|
||||
"health": "healthy",
|
||||
"freshness": "current",
|
||||
"conflict": "clear",
|
||||
"recovery": "ready",
|
||||
"binding_ref": "calendar:sync-source:secret-context",
|
||||
"bindings": [{"binding_ref": "calendar:sync-source:secret-context"}],
|
||||
}
|
||||
|
||||
user = _documentation_provider_state(state, technical=False)
|
||||
technical = _documentation_provider_state(state, technical=True)
|
||||
|
||||
self.assertNotIn("binding_ref", user)
|
||||
self.assertNotIn("bindings", user)
|
||||
self.assertEqual("healthy", user["health"])
|
||||
self.assertIn("bindings", technical)
|
||||
|
||||
def test_module_architecture_projection_hides_evidence_from_user_docs(self) -> None:
|
||||
manifest = ModuleManifest(
|
||||
id="example",
|
||||
name="Example",
|
||||
version="1.0.0",
|
||||
architecture=ModuleArchitectureDeclaration(
|
||||
layer="governance_accountability",
|
||||
kind="governance",
|
||||
maturity="vertical_slice",
|
||||
evidence=(
|
||||
ModuleMaturityEvidence(
|
||||
kind="test",
|
||||
reference="tests/test_example.py",
|
||||
summary="Private implementation evidence.",
|
||||
),
|
||||
ModuleMaturityEvidence(
|
||||
kind="documentation",
|
||||
reference="docs/EXAMPLE.md",
|
||||
summary="Architecture explanation.",
|
||||
),
|
||||
),
|
||||
known_limits=("Example limit.",),
|
||||
supported_authority_modes=("linked_reference",),
|
||||
owned_concepts=("examples",),
|
||||
),
|
||||
)
|
||||
|
||||
technical = _module_payload(manifest, technical=True)
|
||||
user = _module_payload(manifest, technical=False)
|
||||
|
||||
self.assertEqual("vertical_slice", technical["architecture"]["maturity"])
|
||||
self.assertEqual(2, len(technical["architecture"]["evidence"]))
|
||||
self.assertEqual([], user["architecture"]["evidence"])
|
||||
self.assertEqual(["Example limit."], user["architecture"]["known_limits"])
|
||||
|
||||
def test_topics_are_filtered_by_installed_or_selected_version(self) -> None:
|
||||
registry = PlatformRegistry()
|
||||
registry.register(ModuleManifest(
|
||||
|
||||
Reference in New Issue
Block a user