feat: implement institutional governance and recovery architecture
This commit is contained in:
@@ -4,17 +4,101 @@ import sys
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from govoplan_core.core.modules import ModuleManifest
|
||||
from govoplan_core.core.provider_governance import (
|
||||
ExternalProviderDeclaration,
|
||||
ModuleArchitectureDeclaration,
|
||||
ModuleMaturityEvidence,
|
||||
ProviderBehaviorDeclaration,
|
||||
ProviderObjectDeclaration,
|
||||
)
|
||||
|
||||
|
||||
META_ROOT = Path(__file__).resolve().parents[1]
|
||||
RELEASE_ROOT = META_ROOT / "tools" / "release"
|
||||
if str(RELEASE_ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(RELEASE_ROOT))
|
||||
|
||||
from govoplan_release.catalog_entry_synthesis import validate_initial_entry_closure # noqa: E402
|
||||
from govoplan_release.catalog_entry_synthesis import ( # noqa: E402
|
||||
manifest_catalog_entry,
|
||||
validate_initial_entry_closure,
|
||||
)
|
||||
from govoplan_release.selective_catalog import apply_repo_updates # noqa: E402
|
||||
|
||||
|
||||
class ReleaseCatalogEntrySynthesisTests(unittest.TestCase):
|
||||
def test_catalog_entry_preserves_architecture_and_provider_declarations(
|
||||
self,
|
||||
) -> None:
|
||||
provider = ExternalProviderDeclaration(
|
||||
id="example.records",
|
||||
module_id="example",
|
||||
label="Example records",
|
||||
maturity="read",
|
||||
operations=("read",),
|
||||
objects=(
|
||||
ProviderObjectDeclaration(
|
||||
object_type="record",
|
||||
field_groups=("identity", "content"),
|
||||
authority_modes=("external_mirror",),
|
||||
default_authority_mode="external_mirror",
|
||||
),
|
||||
),
|
||||
behavior=ProviderBehaviorDeclaration(
|
||||
freshness="Reports the acquisition timestamp.",
|
||||
health="Reports source and parser health.",
|
||||
max_read_items=100,
|
||||
classifications=("internal",),
|
||||
purposes=("release contract test",),
|
||||
retention="The owning package retention policy applies.",
|
||||
),
|
||||
)
|
||||
architecture = ModuleArchitectureDeclaration(
|
||||
layer="data_reporting_integration",
|
||||
kind="integration",
|
||||
maturity="vertical_slice",
|
||||
evidence=(
|
||||
ModuleMaturityEvidence(
|
||||
kind="test",
|
||||
reference="tests/test_release_catalog_entry_synthesis.py",
|
||||
summary="Proves catalog metadata preservation.",
|
||||
),
|
||||
ModuleMaturityEvidence(
|
||||
kind="documentation",
|
||||
reference="docs/INSTITUTIONAL_GOVERNANCE_TARGET_ARCHITECTURE.md",
|
||||
summary="Defines the provider declaration contract.",
|
||||
),
|
||||
),
|
||||
known_limits=("Test-only provider.",),
|
||||
supported_authority_modes=("external_mirror",),
|
||||
owned_concepts=("example transport",),
|
||||
target_tested_providers=(provider.id,),
|
||||
)
|
||||
|
||||
entry = manifest_catalog_entry(
|
||||
manifest=ModuleManifest(
|
||||
id="example",
|
||||
name="Example",
|
||||
version="1.2.3",
|
||||
architecture=architecture,
|
||||
external_providers=(provider,),
|
||||
),
|
||||
repo="govoplan-example",
|
||||
package="govoplan-example",
|
||||
version="1.2.3",
|
||||
description=None,
|
||||
root=META_ROOT,
|
||||
repository_base="git+ssh://git@git.add-ideas.de/GovOPlaN",
|
||||
)
|
||||
|
||||
self.assertEqual("vertical_slice", entry["architecture"]["maturity"])
|
||||
self.assertEqual(
|
||||
"external_mirror",
|
||||
entry["external_providers"][0]["objects"][0][
|
||||
"default_authority_mode"
|
||||
],
|
||||
)
|
||||
|
||||
def test_selective_update_synthesizes_initial_entries_from_package_manifests(self) -> None:
|
||||
payload: dict[str, object] = {
|
||||
"core_release": {},
|
||||
|
||||
Reference in New Issue
Block a user