test_api_large_artifact.py
python
sha256:0e9549ec7b463911bc08b7d586dc320b1ac9b1f5c943ee7e3865dcc6cb0f6f83
chore(governance): sync handover+roadmap to 84db8c8 (drift:…
Human
1 day ago
| 1 | """Stress tests for API freeze review on large artifacts (K11).""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | import json |
| 6 | from pathlib import Path |
| 7 | |
| 8 | from cli.kit_root import kit_root |
| 9 | from tests.support import FakeHttpTransport, api_provider_factory, git_status_runner, run_cli, write_config |
| 10 | |
| 11 | |
| 12 | def test_large_artifact_api_review_stable(tmp_path: Path, monkeypatch) -> None: |
| 13 | monkeypatch.setenv("OVERSEER_REVIEW_API_KEY", "ci-key") |
| 14 | monkeypatch.setenv("OVERSEER_REVIEW_API_URL", "https://review.example.com/v1") |
| 15 | write_config(tmp_path, "config-api-reviewer.yaml") |
| 16 | docs = tmp_path / "docs" |
| 17 | docs.mkdir(parents=True) |
| 18 | sections = [ |
| 19 | "# Large freeze artifact\n", |
| 20 | "```yaml\nphase: K11-stress\noutputs:\n - id: out\n path: docs/X.md\n frozen: true\n```\n", |
| 21 | "\nseven-tier test matrix\n", |
| 22 | ] |
| 23 | sections.extend(f"\n## Section {index}\nfrozen: true reference\n" for index in range(400)) |
| 24 | artifact = docs / "LARGE-FREEZE.md" |
| 25 | artifact.write_text("".join(sections), encoding="utf-8") |
| 26 | rel = artifact.relative_to(tmp_path).as_posix() |
| 27 | findings = [ |
| 28 | { |
| 29 | "check": "C3", |
| 30 | "severity": "MINOR", |
| 31 | "category": "consistency", |
| 32 | "path": rel, |
| 33 | "line": 5, |
| 34 | "message": f"nit {index}", |
| 35 | } |
| 36 | for index in range(50) |
| 37 | ] |
| 38 | transport = FakeHttpTransport( |
| 39 | review_body=json.dumps({"findings": findings}).encode("utf-8"), |
| 40 | ) |
| 41 | code = run_cli( |
| 42 | ["review", "--freeze", rel, "--json"], |
| 43 | cwd=tmp_path, |
| 44 | runner=git_status_runner(), |
| 45 | kit=kit_root(), |
| 46 | review_provider_factory=api_provider_factory(transport), |
| 47 | json_mode=True, |
| 48 | ) |
| 49 | assert code == 7 |
| 50 | assert len(transport.calls) >= 2 |
File History
1 commit
sha256:6abcf1fa82a7a621ccbc945f19acdba5bc0db54569599404a1452fb4a096a199
fix(ISR): default require_independent_second_reviewer to require
Human
minor
⚠
1 day ago