feat(dotnet): add read model contract harness
CI Workflow Lint / validate-ci-workflow-lint (push) Failing after 13s
Validators (Pushes and Pull Requests) / validate-ui-and-storage (push) Successful in 23s
Validators (Pushes and Pull Requests) / validate-core (push) Successful in 2m11s

This commit is contained in:
2026-07-13 00:41:30 +09:00
parent c852ad49cf
commit d610ecb57c
7 changed files with 193 additions and 0 deletions
@@ -0,0 +1,38 @@
from __future__ import annotations
import json
import subprocess
import sys
from pathlib import Path
def test_validate_dotnet_read_model_contract_passes() -> None:
root = Path(__file__).resolve().parents[2]
proc = subprocess.run(
[sys.executable, str(root / "tools" / "validate_dotnet_read_model_contract_v1.py")],
cwd=root,
capture_output=True,
text=True,
)
assert proc.returncode == 0, proc.stdout + proc.stderr
payload = json.loads(proc.stdout)
assert payload["gate"] == "PASS"
def test_validate_dotnet_read_model_contract_reports_missing_budget() -> None:
root = Path(__file__).resolve().parents[2]
temp = root / "Temp" / "test_wbs_10_read_model_contract_bad.yaml"
temp.write_text(
"formula_id: WBS_10_DOTNET_READ_MODEL_CONTRACT_V1\ngoal: 운영 화면과 조회 API의 read model 경계를 분리한다.\nread_models:\n - model_id: dashboard_summary\n purpose: x\n source: y\n consumers: [a]\n fields: [b]\nrules: [x,y,z,w]\n",
encoding="utf-8",
)
proc = subprocess.run(
[sys.executable, str(root / "tools" / "validate_dotnet_read_model_contract_v1.py"), "--contract", str(temp)],
cwd=root,
capture_output=True,
text=True,
)
assert proc.returncode != 0
payload = json.loads(proc.stdout)
assert payload["gate"] == "FAIL"
assert "dashboard_summary.staleness_budget" in payload["missing"]