test_p_deploy_stress.py
python
sha256:0e9549ec7b463911bc08b7d586dc320b1ac9b1f5c943ee7e3865dcc6cb0f6f83
chore(governance): sync handover+roadmap to 84db8c8 (drift:…
Human
1 day ago
| 1 | """Stress tests for P-deploy Mode C match scan (§PD.9).""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | import time |
| 6 | |
| 7 | from tests.fixtures.p_deploy import load_p_deploy_entry, seed_p_deploy_repo |
| 8 | from tools.honesty.ledger import append_entry |
| 9 | from tools.honesty.status import HonestyStatusOptions, run_honesty_status |
| 10 | from tools.honesty.types import LedgerAppendOptions |
| 11 | from tools.honesty.validate import find_matching_deploy_health |
| 12 | |
| 13 | _MATCH_BUDGET_S = 2.0 |
| 14 | |
| 15 | |
| 16 | def test_sparse_deploy_health_last_wins_over_many_entries(repo_root) -> None: |
| 17 | config = seed_p_deploy_repo(repo_root, require_deploy_health="require") |
| 18 | for round_num in range(1, 101): |
| 19 | body = load_p_deploy_entry("verification-test-output-only.json") |
| 20 | body["round"] = round_num |
| 21 | body["actor_session_id"] = f"bv-{round_num}" |
| 22 | assert ( |
| 23 | append_entry( |
| 24 | config=config, |
| 25 | repo_root=repo_root, |
| 26 | options=LedgerAppendOptions(kind="verification_evidence", body=body), |
| 27 | ).exit_code |
| 28 | == 0 |
| 29 | ) |
| 30 | |
| 31 | deploy_body = load_p_deploy_entry("verification-with-deploy-health.json") |
| 32 | deploy_body["round"] = 101 |
| 33 | deploy_body["actor_session_id"] = "bv-deploy" |
| 34 | append_entry( |
| 35 | config=config, |
| 36 | repo_root=repo_root, |
| 37 | options=LedgerAppendOptions(kind="verification_evidence", body=deploy_body), |
| 38 | ) |
| 39 | |
| 40 | more = load_p_deploy_entry("verification-test-output-only.json") |
| 41 | more["round"] = 102 |
| 42 | more["actor_session_id"] = "bv-after" |
| 43 | append_entry( |
| 44 | config=config, |
| 45 | repo_root=repo_root, |
| 46 | options=LedgerAppendOptions(kind="verification_evidence", body=more), |
| 47 | ) |
| 48 | |
| 49 | started = time.perf_counter() |
| 50 | result = run_honesty_status( |
| 51 | config=config, |
| 52 | repo_root=repo_root, |
| 53 | options=HonestyStatusOptions( |
| 54 | hook=None, |
| 55 | artifact=None, |
| 56 | deploy_health="Track P / P-deploy", |
| 57 | ), |
| 58 | ) |
| 59 | elapsed = time.perf_counter() - started |
| 60 | assert result.exit_code == 0 |
| 61 | assert elapsed < _MATCH_BUDGET_S |
| 62 | |
| 63 | from tools.honesty.ledger_io import read_ledger_entries |
| 64 | from cli.paths import confine_path |
| 65 | |
| 66 | entries = read_ledger_entries(confine_path(repo_root, config.honesty.ledger)) |
| 67 | winner = find_matching_deploy_health( |
| 68 | entries, |
| 69 | phase_id="Track P / P-deploy", |
| 70 | frozen_spec=None, |
| 71 | ) |
| 72 | assert winner is not None |
| 73 | assert winner["round"] == 101 |
| 74 | assert winner["actor_session_id"] == "bv-deploy" |
File History
1 commit
sha256:6abcf1fa82a7a621ccbc945f19acdba5bc0db54569599404a1452fb4a096a199
fix(ISR): default require_independent_second_reviewer to require
Human
minor
⚠
1 day ago