"""Stress tests — landing validator on large HTML payloads."""
from __future__ import annotations
import time
from pathlib import Path
from tools.landing.validate import validate_landing
KIT_ROOT = Path(__file__).resolve().parents[2]
def test_validator_large_padded_html_bounded(tmp_path: Path) -> None:
"""Duplicate landing tree with padded HTML; validator must finish without OOM."""
landing_src = KIT_ROOT / "docs" / "landing"
landing_dst = tmp_path / "docs" / "landing"
landing_dst.mkdir(parents=True)
# Stub linked doc targets referenced from landing pages.
linked = [
"README.md",
"docs/GIT-ONLY-QUICKSTART.md",
"docs/CONSUMER-ADAPTER-PATTERN.md",
"docs/K7-DOGFOOD-OPERATOR-RUNBOOK.md",
"docs/TRACK-Q-DESKTOP-OPERATOR-RUNBOOK.md",
"docs/ROADMAP.md",
"docs/archive/phases/PHASE-K12-TRACK-N-LANDING-CONTRACT.md",
"docs/consumers/videofactory/OVERSEER-SETUP.md",
"docs/consumers/knowtation/OVERSEER-SETUP.md",
"docs/consumers/scooling/OVERSEER-SETUP.md",
"templates/ci/freeze-review-github-actions.yml",
]
for rel in linked:
path = tmp_path / rel
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text("# stub\n", encoding="utf-8")
for rel in (
"manifest.yaml",
"index.html",
"docs.html",
"assets/style.css",
"assets/favicon.ico",
"assets/favicon-32.png",
"assets/apple-touch-icon.png",
"assets/theme.js",
"assets/musehub-logo.svg",
"assets/ok-mark.svg",
"assets/ok-mark-1024.png",
):
src = landing_src / rel
if not src.is_file():
continue
dst = landing_dst / rel
dst.parent.mkdir(parents=True, exist_ok=True)
if rel.endswith(".html"):
content = src.read_text(encoding="utf-8")
content = content.replace("