File size: 11,986 Bytes
c4212da
04c0bde
c4212da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149cadc
c4212da
 
cf07180
 
c4212da
 
 
 
540e67a
 
 
 
 
 
 
 
 
04c0bde
540e67a
 
c4212da
 
04c0bde
 
c4212da
 
 
 
ed07d1b
540e67a
04c0bde
540e67a
 
cf07180
540e67a
cf07180
540e67a
 
 
cf07180
 
04c0bde
ed07d1b
04c0bde
6a1869c
04c0bde
9c208a9
 
 
 
 
c4212da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9c208a9
c4212da
 
 
 
 
 
 
 
 
 
7cc9dbe
c4212da
149cadc
c4212da
 
 
 
b7a466b
c4212da
 
 
 
 
 
 
 
 
 
6de56be
c4212da
 
 
 
 
 
 
540e67a
c4212da
 
 
 
 
 
 
 
 
 
 
 
93223e3
d735235
 
c4212da
 
d735235
c4212da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cf07180
c4212da
 
 
 
 
 
 
 
 
 
 
04c0bde
c4212da
 
 
cf07180
c4212da
04c0bde
c4212da
 
 
 
 
540e67a
c4212da
 
 
 
 
540e67a
c4212da
 
 
 
 
540e67a
c4212da
b7a466b
c4212da
 
 
cf07180
c4212da
 
 
6a1869c
c4212da
 
 
540e67a
 
c4212da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
#!/usr/bin/env python3
"""Build the public presentation 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",
    "rendered_site_check": ROOT / "docs/data/rendered_site_check.json",
    "task_surface_integrity": ROOT / "docs/data/task_surface_integrity.json",
    "source_alignment": ROOT / "docs/data/source_alignment_audit.json",
    "scale_up_status": ROOT / "docs/data/scope_claims_audit.json",
    "publication_package": ROOT / "docs/data/publication_audit.json",
    "mirror_parity": ROOT / "docs/data/mirror_parity.json",
    "live_publication": ROOT / "docs/data/live_publication_status.json",
}

DISPLAY_LABELS = {
    "public_presentation_files_exist": "Public files",
    "core_status_reports_pass": "Project reports",
    "website_has_research_seo_metadata": "Website metadata",
    "website_tabs_are_accessible_and_keyboardable": "Keyboard navigation",
    "responsive_navigation_guard_present": "Responsive navigation",
    "public_naming_consistent": "Project naming",
    "public_links_cover_repo_hf_dataset_and_ropedia": "Public links",
    "public_artifact_qa_files_are_exposed": "Artifact links",
    "public_copy_uses_reader_facing_language": "Project language",
}

BANNED_PUBLIC_STRINGS = [
    "audit" + "able",
    "in" + "ternal " + "re" + "view label",
    "pri" + "vate " + "evaluation note",
    "ChatGPT" + "-image",
    "H" + "20",
    "A" + "100",
    "Cur" + "sor",
    "public " + "dashboard and generated figures " + "deliber" + "ately follow",
    "unsupported general-result language",
    "non-public planning note",
    "Public " + "project QA",
    "public-project " + "QA",
    "readiness" + "-only",
    "not a foundation-model result",
    "unsupported " + "interpretations",
    "unsupported " + "conclusions",
    "result-scope guard",
    "Result-scope guard",
    "Publication " + "hyg" + "iene",
    "copy " + "hyg" + "iene",
    "Research progress with pri" + "vate caveats",
    "Research progress with process caveats",
    "re" + "viewer " + "scorecard",
    "block" + "er",
    "re" + "view" + "-only checklist",
    "accelerated relay",
    "selected relay",
    "chunked parallel transfer",
    "batch prefetch",
    "overlapping batch prefetch",
]


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",
        "128-episode pilot",
    ]
    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/project_brief.json",
        "data/website_integrity.json",
        "data/rendered_site_check.json",
        "data/task_surface_integrity.json",
        "data/publication_audit.json",
        "data/mirror_parity.json",
        "data/public_surface_qa.json",
        "data/research_roadmap.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_presentation_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,
            "The public project surface depends on the existing project reports already passing.",
            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("data-tab-key=") == 6
            and website.count("data-panel-target=") >= 4
            and website.count('role="tab"') >= website.count("data-tab-key=") + website.count("data-panel-target=")
            and website.count('role="tabpanel"') >= 19
            and "moveProjectTabFocus" in website
            and "initContentTabs" 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 status.",
            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 website reference, release package, mirror, and public presentation files from public copy.",
            marker_counts=marker_count(combined_public_text, artifact_markers),
        ),
        check(
            "public_copy_uses_reader_facing_language",
            not banned_hits,
            "Project language is clear and avoids hardware details or irrelevant implementation details.",
            banned_hits=banned_hits,
        ),
    ]
    status = "pass" if all(item["status"] == "pass" for item in checks) else "fail"
    return {
        "title": "Ropedia Xperience-10M Public Project Surface",
        "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()},
        "scope_note": "This report covers the public repo, website, Hugging Face cards, and package contents. Multi-episode model metrics are tracked by the training and evaluation reports.",
    }


def markdown(report: dict) -> str:
    lines = [
        "# Public Project Surface",
        "",
        "This generated report checks whether the public repo, website, and Hugging Face cards read like one cohesive research project.",
        "",
        f"Current status: **{report['status']}**",
        "",
        report["scope_note"],
        "",
        "## Checks",
        "",
        "| Area | Status | What it covers |",
        "| --- | --- | --- |",
    ]
    for item in report["checks"]:
        label = DISPLAY_LABELS.get(item["name"], item["name"].replace("_", " ").title())
        lines.append(f"| {label} | `{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())