Admit source evidence snapshots and harden stream completeness
Assistant: codex Assistant-Model: gpt-6-astra Assistant-Session: 01a06e89-93a2-7aa2-82b3-ce5ccd2682e6
This commit is contained in:
parent
824fb1b966
commit
31e9963933
34 changed files with 1057 additions and 122 deletions
|
|
@ -1,7 +1,12 @@
|
|||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from kings_guard.cadence import load_qonto_assistant_source_cadence
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
DRAFT = ROOT / "specs" / "EmissionCadenceDeclaration.md"
|
||||
QONTO_SOURCE_DECLARATION = Path("/home/worsch/qonto-assistant/specs/audit-emission-cadence.yaml")
|
||||
|
||||
|
||||
def test_emission_cadence_draft_exists_for_taxonomy_handover() -> None:
|
||||
|
|
@ -17,3 +22,62 @@ def test_emission_cadence_draft_exists_for_taxonomy_handover() -> None:
|
|||
assert "reconciliation" in text.lower()
|
||||
assert "alongside the security genome" in text.lower() or "alongside the genome" in text.lower()
|
||||
assert "security_genome" in text
|
||||
|
||||
|
||||
def test_qonto_source_declaration_is_consumed_separately_from_the_taxonomy_draft() -> None:
|
||||
cadence = load_qonto_assistant_source_cadence()
|
||||
|
||||
assert cadence.status == "source-declared"
|
||||
assert cadence.owner == "qonto-assistant"
|
||||
assert cadence.reference_instance == "QONTO-WP-0005"
|
||||
assert cadence.forms() == {"heartbeat-or-reconciliation"}
|
||||
assert cadence.rates == ()
|
||||
assert cadence.heartbeats[0].interval.total_seconds() == 86400
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
not QONTO_SOURCE_DECLARATION.is_file(),
|
||||
reason="qonto-assistant source declaration checkout is unavailable",
|
||||
)
|
||||
def test_qonto_source_cadence_fixture_matches_the_source_owned_declaration() -> None:
|
||||
yaml = pytest.importorskip("yaml")
|
||||
source = yaml.safe_load(QONTO_SOURCE_DECLARATION.read_text(encoding="utf-8"))[
|
||||
"audit_emission_cadence"
|
||||
]
|
||||
cadence = load_qonto_assistant_source_cadence()
|
||||
|
||||
assert cadence.source_system == source["source"]
|
||||
assert cadence.heartbeats[0].event_class == source["heartbeat"]["event_class"]
|
||||
assert (
|
||||
cadence.heartbeats[0].interval.total_seconds()
|
||||
== source["heartbeat"]["default_interval_seconds"]
|
||||
)
|
||||
assert source["event_classes"]["audit.deny"]["form"] in cadence.forms()
|
||||
assert source["event_classes"]["audit.allow"]["completeness_claimed"] is False
|
||||
assert cadence.rates == ()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("filename", [
|
||||
"qonto_assistant_cadence.json", "qonto_assistant_source_cadence.json",
|
||||
])
|
||||
def test_cadence_fixtures_conform_to_owner_schema(filename):
|
||||
import json
|
||||
|
||||
import jsonschema
|
||||
import yaml
|
||||
|
||||
schema_path = Path(
|
||||
"/home/worsch/info-tech-canon/infospace/schemas/emission-cadence.schema.yaml"
|
||||
)
|
||||
if not schema_path.is_file():
|
||||
pytest.skip("canonical InfoTechCanon schema checkout is unavailable")
|
||||
schema = yaml.safe_load(schema_path.read_text())
|
||||
payload = json.loads((ROOT / "src/kings_guard/fixtures" / filename).read_text())
|
||||
jsonschema.Draft202012Validator(schema).validate(payload)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(("value", "seconds"), [("P1DT2H30M5S", 95405), ("P1D", 86400)])
|
||||
def test_canonical_compound_durations_are_consumed(value, seconds):
|
||||
from kings_guard.cadence import parse_interval
|
||||
|
||||
assert parse_interval(value).total_seconds() == seconds
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue