test_honesty_bounded.py
python
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
13 hours ago
| 1 | """Performance bounds for honesty ledger verify.""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | import json |
| 6 | import time |
| 7 | |
| 8 | from tests.support import honesty_artifact_hash, load_honesty_config |
| 9 | from tools.honesty.canonical import compute_entry_hash |
| 10 | from tools.honesty.ledger import verify_ledger_file |
| 11 | from tools.honesty.ledger_io import serialize_entry |
| 12 | from tools.honesty.ledger import append_entry |
| 13 | from tools.honesty.types import LedgerAppendOptions |
| 14 | |
| 15 | |
| 16 | def test_verify_10k_bounded(repo_root) -> None: |
| 17 | config = load_honesty_config(repo_root) |
| 18 | artifact_hash = honesty_artifact_hash(repo_root) |
| 19 | body = { |
| 20 | "actor_role": "verifier", |
| 21 | "actor_session_id": "perf-verifier", |
| 22 | "artifact_sha256": artifact_hash, |
| 23 | "passed": True, |
| 24 | "evidence": {"reexecuted": ["verify-step:perf"]}, |
| 25 | } |
| 26 | append_entry( |
| 27 | config=config, |
| 28 | repo_root=repo_root, |
| 29 | options=LedgerAppendOptions(kind="verdict", body=body), |
| 30 | ) |
| 31 | ledger = repo_root / ".overseer" / "honesty" / "VERDICT-LEDGER.jsonl" |
| 32 | text = ledger.read_text(encoding="utf-8") |
| 33 | last = json.loads(text.strip().splitlines()[-1]) |
| 34 | expected_prev = last["entry_hash"] |
| 35 | extra: list[str] = [] |
| 36 | for index in range(9998): |
| 37 | entry = { |
| 38 | "v": 1, |
| 39 | "ts": "2026-01-01T00:00:00Z", |
| 40 | "kind": "hook_check", |
| 41 | "actor_role": "overseer", |
| 42 | "actor_session_id": f"p-{index}", |
| 43 | "hook": "handoff", |
| 44 | "ok": True, |
| 45 | "prev_hash": expected_prev, |
| 46 | } |
| 47 | entry["entry_hash"] = compute_entry_hash(entry) |
| 48 | expected_prev = entry["entry_hash"] |
| 49 | extra.append(serialize_entry(entry)) |
| 50 | ledger.write_text(text + "".join(extra), encoding="utf-8") |
| 51 | |
| 52 | start = time.monotonic() |
| 53 | result = verify_ledger_file(config=config, repo_root=repo_root) |
| 54 | elapsed = time.monotonic() - start |
| 55 | assert result.exit_code == 0 |
| 56 | assert elapsed < 5.0 |
File History
2 commits
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
13 hours ago
sha256:4671b7f787ddbe63ced31c895b688c77ab495653b65a730b423329f26b3c1439
feat: K1-P1 complete — agent provenance, build-verification…
Sonnet 4.6
patch
52 days ago