chore: initialize K1 connector pre-production scaffold
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import json
|
||||
|
||||
from typer.testing import CliRunner
|
||||
|
||||
from k1link.cli import app
|
||||
|
||||
runner = CliRunner()
|
||||
|
||||
|
||||
def test_help() -> None:
|
||||
result = runner.invoke(app, ["--help"])
|
||||
assert result.exit_code == 0
|
||||
assert "evidence-led" in result.stdout
|
||||
|
||||
|
||||
def test_doctor_json() -> None:
|
||||
result = runner.invoke(app, ["doctor", "--json"])
|
||||
assert result.exit_code == 0
|
||||
payload = json.loads(result.stdout)
|
||||
assert payload["k1link_version"] == "0.1.0"
|
||||
assert isinstance(payload["tools"], list)
|
||||
assert isinstance(payload["network"], dict)
|
||||
assert any(item["name"] == "tcpdump" for item in payload["tools"])
|
||||
@@ -0,0 +1,40 @@
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).parents[1]
|
||||
|
||||
|
||||
def _sha256(path: Path) -> str:
|
||||
digest = hashlib.sha256()
|
||||
with path.open("rb") as stream:
|
||||
for chunk in iter(lambda: stream.read(1024 * 1024), b""):
|
||||
digest.update(chunk)
|
||||
return digest.hexdigest()
|
||||
|
||||
|
||||
def test_reference_inputs_are_unchanged() -> None:
|
||||
expected = {
|
||||
"CODEX_K1_MAC_LINK_PREPROD_PROMPT.md": (
|
||||
"f24537119bd76f76d1914ca7f34a6736d8c5d3b6d19ead6d0ae8a0e5966c9770"
|
||||
),
|
||||
"XGRIDS_Lixel_K1_PreProduction_Bible.md": (
|
||||
"22ea9d0dc6f5a623ba26d6f08108a905170db08112e0531a1d80bddd6101689c"
|
||||
),
|
||||
}
|
||||
for filename, expected_hash in expected.items():
|
||||
assert _sha256(ROOT / "docs" / "reference" / filename) == expected_hash
|
||||
|
||||
|
||||
def test_redacted_manifest_example_is_json() -> None:
|
||||
path = ROOT / "examples" / "session_manifest.redacted.json"
|
||||
payload = json.loads(path.read_text(encoding="utf-8"))
|
||||
assert payload["schema_version"] == 1
|
||||
assert payload["decision"]["status"] in {"GO", "PAUSE", "BLOCKED"}
|
||||
|
||||
|
||||
def test_manifest_schema_is_json() -> None:
|
||||
path = ROOT / "schemas" / "session-manifest.schema.json"
|
||||
payload = json.loads(path.read_text(encoding="utf-8"))
|
||||
assert payload["$schema"] == "https://json-schema.org/draft/2020-12/schema"
|
||||
assert payload["properties"]["schema_version"]["const"] == 1
|
||||
Reference in New Issue
Block a user