test_isr_stress.py
python
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
1 day ago
| 1 | """Stress tests for ISR match scan (§ISR.11).""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | from tests.fixtures.isr import load_isr_entry, seed_isr_repo |
| 6 | from tools.honesty.ledger import append_entry, verify_ledger_file |
| 7 | from tools.honesty.status import HonestyStatusOptions, run_honesty_status |
| 8 | from tools.honesty.types import LedgerAppendOptions |
| 9 | from tools.honesty.validate import find_matching_independent_second_review |
| 10 | |
| 11 | |
| 12 | def test_fifty_isr_entries_last_wins_match(repo_root) -> None: |
| 13 | config = seed_isr_repo(repo_root, require_independent_second_reviewer="require") |
| 14 | for round_num in range(1, 51): |
| 15 | body = load_isr_entry("isr-pass.json") |
| 16 | body["round"] = round_num |
| 17 | body["actor_session_id"] = f"verifier-{round_num}" |
| 18 | body["producer_session_id"] = f"builder-{round_num}" |
| 19 | assert ( |
| 20 | append_entry( |
| 21 | config=config, |
| 22 | repo_root=repo_root, |
| 23 | options=LedgerAppendOptions(kind="independent_second_review", body=body), |
| 24 | ).exit_code |
| 25 | == 0 |
| 26 | ) |
| 27 | assert verify_ledger_file(config=config, repo_root=repo_root).exit_code == 0 |
| 28 | |
| 29 | from tools.honesty.ledger_io import read_ledger_entries |
| 30 | from cli.paths import confine_path |
| 31 | |
| 32 | entries = read_ledger_entries(confine_path(repo_root, config.honesty.ledger)) |
| 33 | winner = find_matching_independent_second_review( |
| 34 | entries, |
| 35 | phase_id="ISR-b", |
| 36 | frozen_spec=None, |
| 37 | producer_session=None, |
| 38 | ) |
| 39 | assert winner is not None |
| 40 | assert winner["round"] == 50 |
| 41 | |
| 42 | result = run_honesty_status( |
| 43 | config=config, |
| 44 | repo_root=repo_root, |
| 45 | options=HonestyStatusOptions( |
| 46 | hook=None, |
| 47 | artifact=None, |
| 48 | independent_second_review="ISR-b", |
| 49 | producer_session="builder-50", |
| 50 | ), |
| 51 | ) |
| 52 | assert result.exit_code == 0 |
| 53 | assert result.json_payload.independent_second_review["matched_entry_hash"] is not None |
File History
1 commit
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
1 day ago