File size: 10,144 Bytes
00b6e59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
#!/usr/bin/env python3
"""Build a public-surface QA report for repo, website, and HF mirrors."""

from __future__ import annotations

import json
from datetime import datetime, timezone
from pathlib import Path


ROOT = Path(__file__).resolve().parents[1]
HF_ROOT = ROOT.parent / "hf_publish"
OUTPUT_JSON = ROOT / "docs/data/public_surface_qa.json"
OUTPUT_MD = ROOT / "PUBLIC_SURFACE_QA.md"

SURFACES = {
    "github_readme": ROOT / "README.md",
    "website_html": ROOT / "docs/index.html",
    "hf_space_card": HF_ROOT / "space/README.md",
    "hf_artifact_card": HF_ROOT / "artifacts/README.md",
    "hf_model_card": HF_ROOT / "model/README.md",
}

STATUS_REPORTS = {
    "website_integrity": ROOT / "docs/data/website_integrity.json",
    "task_surface_integrity": ROOT / "docs/data/task_surface_integrity.json",
    "source_alignment": ROOT / "docs/data/source_alignment_audit.json",
    "scope_claims": ROOT / "docs/data/scope_claims_audit.json",
    "publication_hygiene": ROOT / "docs/data/publication_audit.json",
    "mirror_parity": ROOT / "docs/data/mirror_parity.json",
    "live_publication": ROOT / "docs/data/live_publication_status.json",
}

BANNED_PUBLIC_STRINGS = [
    "audit" + "able",
    "rev" + "iewer " + "scorecard",
    "REVIEWER_" + "SCORECARD",
    "ChatGPT" + "-image",
    "H" + "20",
    "A" + "100",
    "Cur" + "sor",
    "public " + "dashboard and generated figures " + "deliberately follow",
]


def read_text(path: Path) -> str:
    return path.read_text(encoding="utf-8", errors="ignore") if path.exists() else ""


def read_status(path: Path) -> dict:
    if not path.exists():
        return {"exists": False, "status": "missing"}
    try:
        payload = json.loads(path.read_text(encoding="utf-8"))
    except json.JSONDecodeError as exc:
        return {"exists": True, "status": "invalid_json", "error": str(exc)}
    return {
        "exists": True,
        "status": str(payload.get("status", "unknown")),
        "generated_at_utc": payload.get("generated_at_utc"),
    }


def display_path(path: Path) -> str:
    for base in (ROOT, ROOT.parent):
        try:
            return path.relative_to(base).as_posix()
        except ValueError:
            continue
    return path.name


def check(name: str, passed: bool, reason: str, **detail) -> dict:
    return {"name": name, "status": "pass" if passed else "fail", "reason": reason, **detail}


def marker_count(text: str, markers: list[str]) -> dict[str, int]:
    return {marker: text.count(marker) for marker in markers}


def build_report() -> dict:
    texts = {name: read_text(path) for name, path in SURFACES.items()}
    combined_public_text = "\n".join(texts.values())
    website = texts["website_html"]
    all_surface_files_exist = all(path.exists() for path in SURFACES.values())

    status_records = {name: read_status(path) for name, path in STATUS_REPORTS.items()}
    status_failures = {
        name: record
        for name, record in status_records.items()
        if record["status"] != "pass"
    }

    seo_markers = [
        "<title>Ropedia Xperience-10M Task Suite</title>",
        'name="description"',
        'rel="canonical"',
        'property="og:title"',
        'property="og:image"',
        'name="twitter:card"',
        'application/ld+json',
        'rel="manifest"',
        'rel="apple-touch-icon"',
    ]
    accessible_markers = [
        'role="tablist"',
        'role="tab"',
        'role="tabpanel"',
        "aria-selected",
        "aria-controls",
        "moveProjectTabFocus",
        "ArrowRight",
        "Home",
        "End",
    ]
    naming_markers = [
        "Ropedia Xperience-10M Task Suite",
        "Xperience-10M",
        "12-task",
        "Qwen3-Omni",
        "one public Xperience-10M sample episode",
    ]
    hf_link_markers = [
        "https://github.com/ChaoYue0307/ropedia-xperience-10m-task-suite",
        "https://huggingface.co/spaces/cy0307/ropedia-xperience-10m-task-suite",
        "https://huggingface.co/datasets/cy0307/ropedia-xperience-10m-task-suite-artifacts",
        "https://huggingface.co/cy0307/ropedia-xperience-10m-task-baselines",
        "https://huggingface.co/datasets/ropedia-ai/xperience-10m",
        "https://ropedia.com/dataset",
    ]
    artifact_markers = [
        "data/website_integrity.json",
        "data/task_surface_integrity.json",
        "data/publication_audit.json",
        "data/mirror_parity.json",
        "data/public_surface_qa.json",
    ]

    banned_hits = [
        {"marker": marker, "count": combined_public_text.count(marker)}
        for marker in BANNED_PUBLIC_STRINGS
        if marker in combined_public_text
    ]

    checks = [
        check(
            "public_surface_files_exist",
            all_surface_files_exist,
            "Repo README, website HTML, and three Hugging Face cards should all be present in the publication workspace.",
            missing=[str(path) for path in SURFACES.values() if not path.exists()],
        ),
        check(
            "core_status_reports_pass",
            not status_failures,
            "Current public-surface QA depends on the existing validators already reporting pass.",
            reports=status_records,
            failures=status_failures,
        ),
        check(
            "website_has_research_seo_metadata",
            all(marker in website for marker in seo_markers),
            "The website should expose search/social metadata and structured project metadata.",
            marker_counts=marker_count(website, seo_markers),
        ),
        check(
            "website_tabs_are_accessible_and_keyboardable",
            'role="tablist"' in website
            and website.count('role="tab"') == 5
            and website.count('role="tabpanel"') >= 19
            and "moveProjectTabFocus" in website
            and "ArrowRight" in website
            and "Home" in website
            and "End" in website,
            "The long research dashboard should be navigable as real tabs, including keyboard support.",
            marker_counts=marker_count(website, accessible_markers),
        ),
        check(
            "responsive_navigation_guard_present",
            "@media (max-width: 1120px)" in website
            and ".nav-links { display: none; }" in website
            and "scroll-margin-top" in website,
            "Tablet/mobile navigation should not overflow and deep links should land below sticky navigation.",
        ),
        check(
            "public_naming_consistent",
            all(marker in combined_public_text for marker in naming_markers),
            "Public copy should consistently present the project as Ropedia Xperience-10M, with the Qwen3-Omni scale-up boundary.",
            marker_counts=marker_count(combined_public_text, naming_markers),
        ),
        check(
            "public_links_cover_repo_hf_dataset_and_ropedia",
            all(marker in combined_public_text for marker in hf_link_markers),
            "Public cards should link the repo, Space, artifacts, model baselines, upstream dataset, and Ropedia dataset page.",
            marker_counts=marker_count(combined_public_text, hf_link_markers),
        ),
        check(
            "public_artifact_qa_files_are_exposed",
            all(marker in combined_public_text for marker in artifact_markers),
            "Readers should be able to find integrity, publication, mirror, and public-surface QA files from public copy.",
            marker_counts=marker_count(combined_public_text, artifact_markers),
        ),
        check(
            "public_copy_avoids_internal_or_meta_tone",
            not banned_hits,
            "Public copy should not expose internal tooling, private hardware labels, assessment framing, or meta design-process wording.",
            banned_hits=banned_hits,
        ),
    ]
    status = "pass" if all(item["status"] == "pass" for item in checks) else "fail"
    return {
        "title": "Ropedia Xperience-10M Public Surface QA",
        "status": status,
        "generated_at_utc": datetime.now(timezone.utc).isoformat(timespec="seconds"),
        "scope": "Repo README, GitHub Pages HTML, Hugging Face Space card, artifact dataset card, and model card.",
        "checks": checks,
        "surface_files": {name: display_path(path) for name, path in SURFACES.items()},
        "boundary": "This report validates public presentation quality and packaging hygiene. It does not prove multi-episode model quality.",
    }


def markdown(report: dict) -> str:
    lines = [
        "# Public Surface QA",
        "",
        "This generated report checks whether the public repo, website, and Hugging Face cards read like one polished research project.",
        "",
        f"Current status: **{report['status']}**",
        "",
        report["boundary"],
        "",
        "## Checks",
        "",
        "| Check | Status | What it guards |",
        "| --- | --- | --- |",
    ]
    for item in report["checks"]:
        lines.append(f"| {item['name']} | `{item['status']}` | {item['reason']} |")
    lines.extend([
        "",
        "## Scope",
        "",
        "| Surface | File |",
        "| --- | --- |",
    ])
    for name, path in report["surface_files"].items():
        lines.append(f"| {name} | `{path}` |")
    lines.extend([
        "",
        "## Regenerate",
        "",
        "```bash",
        "python scripts/build_public_surface_qa.py",
        "```",
        "",
    ])
    return "\n".join(lines)


def main() -> int:
    report = build_report()
    OUTPUT_JSON.parent.mkdir(parents=True, exist_ok=True)
    OUTPUT_JSON.write_text(json.dumps(report, indent=2) + "\n", encoding="utf-8")
    OUTPUT_MD.write_text(markdown(report), encoding="utf-8")
    print(f"{report['status'].upper()}: wrote {OUTPUT_JSON}")
    print(f"{report['status'].upper()}: wrote {OUTPUT_MD}")
    if report["status"] != "pass":
        for item in report["checks"]:
            if item["status"] != "pass":
                print(f"- {item['name']}: {item['reason']}")
        return 1
    return 0


if __name__ == "__main__":
    raise SystemExit(main())