docs: cite the site modules at their paths

Comments in the workflow, the bootstraps, the installer, the site
sources and the tests still named scripts/sitebootstrap.py and the other
site modules sitegen/ took over. test_cited_scripts checks that every
scripts/ path or -m module a tracked text names exists.
This commit is contained in:
Abdessamad Derraz committed 2026-11-24 10:22:33 +01:00
1 parent e1bad01b82
commit 3fabb52367
21 files changed
+115 -31

No files matched your search

+2 -2
View File
@@ -245,13 +245,13 @@ on:
- "docs_assets/**"
- "install/**"
# The site serves install.sh and install.ps1 pinned to install.py
# of the commit it is built from (scripts/sitebootstrap.py).
# of the commit it is built from (scripts/sitegen/bootstrap.py).
- "install.py"
- "installer/**"
- "install.sh"
- "install.ps1"
# The handheld launchers it serves are built from ports/ at the same
# commit (scripts/sitehandheld.py).
# commit (scripts/sitegen/handheld.py).
- "ports/**"
- "database.json"
- "release.json"
+2 -2
View File
@@ -14,9 +14,9 @@
# What a refused installer most likely means for this copy. The copy the
# site serves reads a commit's installer, which no cache serves stale,
# and Invoke-WebRequest throws on a cut transfer before the hash is read:
# the site's build rewrites this line there (scripts/sitebootstrap.py).
# the site's build rewrites this line there (scripts/sitegen/bootstrap.py).
$mismatchAdvice = "The download was most likely cut short: try again. Within minutes of an update of this project the two files can come from caches of different ages. Waiting five minutes settles that."
$defaultInstallSha256 = "bf437a4a291a8eda372040014f029689183cf09d78f6b54102b9261c493e40dd"
$defaultInstallSha256 = "4307fc63db9377dfe241598bf044c1635fade08a3bde5d10b034ee25abf23878"
# The pin above refuses any changed byte: this cap only stops a body that
# cannot be the installer (a sign-in portal's page) before it is hashed.
$maximumInstallerBytes = 8MB
+1 -1
View File
@@ -593,7 +593,7 @@ SITE_URL = "https://abdess.github.io/retrobios/"
INSTALLER_PAGE = f"{SITE_URL}wiki/installer/"
TROUBLESHOOTING_PAGE = f"{SITE_URL}wiki/troubleshooting/"
# The one-line bootstraps the site serves: BOOTSTRAP_URL for sh, .ps1 after it
# for PowerShell (scripts/sitebootstrap.py).
# for PowerShell (scripts/sitegen/bootstrap.py).
BOOTSTRAP_URL = f"{SITE_URL}i"
+2 -2
View File
@@ -21,9 +21,9 @@ DEFAULT_INSTALL_URL="https://raw.githubusercontent.com/Abdess/retrobios/main/ins
# What a refused installer most likely means for this copy. The copy the
# site serves reads a commit's installer, which no cache serves stale, and
# curl or wget stop on a cut transfer before the hash is read: the site's
# build rewrites this line there (scripts/sitebootstrap.py).
# build rewrites this line there (scripts/sitegen/bootstrap.py).
MISMATCH_ADVICE="The download was most likely cut short: try again. Within minutes of an update of this project the two files can come from caches of different ages. Waiting five minutes settles that."
DEFAULT_INSTALL_SHA256="bf437a4a291a8eda372040014f029689183cf09d78f6b54102b9261c493e40dd"
DEFAULT_INSTALL_SHA256="4307fc63db9377dfe241598bf044c1635fade08a3bde5d10b034ee25abf23878"
# The pin above refuses any changed byte: this cap only stops a body that
# cannot be the installer (a sign-in portal's page) before it is hashed.
MAX_INSTALLER_BYTES=8388608
+8 -8
View File
@@ -27,8 +27,8 @@
{
"dest": "roms/ports/retrobios/install.py",
"repo_path": "install.py",
"size": 1503591,
"sha256": "bf437a4a291a8eda372040014f029689183cf09d78f6b54102b9261c493e40dd",
"size": 1503595,
"sha256": "4307fc63db9377dfe241598bf044c1635fade08a3bde5d10b034ee25abf23878",
"executable": false
},
{
@@ -71,8 +71,8 @@
"muos": {
"archive": {
"dest": "ARCHIVE/RetroBIOS.muxapp",
"size": 1557216,
"sha256": "ebed28757531f64d484a567c693a0d84695c4f8c1f4ee561ebc8ce75500ece19"
"size": 1557220,
"sha256": "a35f1206b9b2731116c7132b7a6a8126e2ec9e03bea15782191e4ed7af563aa9"
},
"members": [
{
@@ -92,8 +92,8 @@
{
"name": "RetroBIOS/install.py",
"repo_path": "install.py",
"size": 1503591,
"sha256": "bf437a4a291a8eda372040014f029689183cf09d78f6b54102b9261c493e40dd",
"size": 1503595,
"sha256": "4307fc63db9377dfe241598bf044c1635fade08a3bde5d10b034ee25abf23878",
"executable": false
},
{
@@ -166,8 +166,8 @@
{
"dest": ".config/modules/retrobios/install.py",
"repo_path": "install.py",
"size": 1503591,
"sha256": "bf437a4a291a8eda372040014f029689183cf09d78f6b54102b9261c493e40dd",
"size": 1503595,
"sha256": "4307fc63db9377dfe241598bf044c1635fade08a3bde5d10b034ee25abf23878",
"executable": false
},
{
+1 -1
View File
@@ -125,7 +125,7 @@ SITE_URL = "https://abdess.github.io/retrobios/"
INSTALLER_PAGE = f"{SITE_URL}wiki/installer/"
TROUBLESHOOTING_PAGE = f"{SITE_URL}wiki/troubleshooting/"
# The one-line bootstraps the site serves: BOOTSTRAP_URL for sh, .ps1 after it
# for PowerShell (scripts/sitebootstrap.py).
# for PowerShell (scripts/sitegen/bootstrap.py).
BOOTSTRAP_URL = f"{SITE_URL}i"
+2 -2
View File
@@ -1,6 +1,6 @@
# What each platform page and pack README tell someone holding the device:
# the folder, where the command runs, what to know. Read by
# scripts/siteguides.py, which checks it on load: every platform in
# scripts/sitegen/guides.py, which checks it on load: every platform in
# _registry.yml has a guide here, and every guide a registered platform.
#
# Values are Markdown. A folder row with no `path` is the registry's
@@ -19,7 +19,7 @@
# The registry keeps what tools read (device_group, extract_to, install);
# this file keeps what people read.
# The site serving the one-line bootstraps (scripts/sitebootstrap.py).
# The site serving the one-line bootstraps (scripts/sitegen/bootstrap.py).
install_base: https://abdess.github.io/retrobios
# Is it safe: shown on the home page and under every command on a guide page.
+1 -1
View File
@@ -5,7 +5,7 @@ the commits to read, the format of the system list, and the facts a parser
cannot read from a table (roms root, case rule, folders the OS never scans),
each with its `source_ref`. A format parser reads the system list and returns
one row per folder. The setup file it writes carries the OS's own names only:
`scripts/romfolders.py` resolves them to repository systems and profiles.
`scripts/model/romfolders.py` resolves them to repository systems and profiles.
Every fetch goes through `upstream.fetch_file`, cached by revision, so a
second run reads nothing from the network and writes the same bytes.
+1 -1
View File
@@ -333,7 +333,7 @@ def generate_gap_analysis(
a file the collection does not hold yet names the catalog or romset
that lists it.
Combines verification results (from coverages/verify.py) with source
Combines verification results (from packs/coverage.py) with source
provenance (from cross_reference) into a single truth dashboard.
Sections:
+84
View File
@@ -0,0 +1,84 @@
"""Every script a tracked text cites exists at the path or module it gives.
Comments, messages and pages kept naming scripts/sitebootstrap.py and
scripts/region.py long after the code moved into packages, and a reader
following one found nothing. A path (`scripts/sitegen/wanted.py`) or a
module run with `-m` (`python -m scripts.scraper.arcade.mame_hash_scraper`)
must name a file of the tree.
"""
from __future__ import annotations
import tests
import re
import subprocess
import unittest
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
# Where a script is cited: the code, the tests, the pages, the workflows,
# the site's own sources, the installer and its bootstraps, the platform files
# and the unattended jobs.
CITING = ("scripts", "tests", "wiki", ".github", "website/src", "installer", "install.sh", "install.ps1",
"platforms/*.yml", "platforms/**/*.yml", "automation")
# Modules that check a checker: the missing names they cite are the point.
CHECKER_TESTS = frozenset({"tests/test_cited_scripts.py", "tests/test_doc_pages_tools.py",
"tests/test_autorun.py"})
# A module a guide asks the reader to write (`myplatform_scraper`).
PLACEHOLDERS = ("myplatform",)
SCRIPT_PATH = re.compile(r"(?<![\w/.-])scripts/[\w/.-]*?\.py\b")
# `-m scripts.x.y` on a command line, or `"-m", "scripts.x.y"` in an argv list.
SCRIPT_MODULE = re.compile(r"-m\b[\"',\s]+(scripts(?:\.\w+)+)(?![.\w])")
def cited(text: str) -> list[tuple[int, str]]:
found = []
for number, line in enumerate(text.splitlines(), 1):
found += [(number, m.group()) for m in SCRIPT_PATH.finditer(line)]
found += [(number, m.group(1).replace(".", "/") + ".py") for m in SCRIPT_MODULE.finditer(line)]
return found
def exists(path: str) -> bool:
file = ROOT / path
return file.is_file() or (file.with_suffix("") / "__init__.py").is_file()
def citing_files() -> list[str]:
listed = subprocess.run(["git", "ls-files", "--", *CITING], cwd=ROOT, capture_output=True,
text=True, check=True).stdout.split()
return sorted(set(listed) - CHECKER_TESTS)
class CitedScripts(unittest.TestCase):
def test_every_cited_script_exists(self):
missing = []
for name in citing_files():
path = ROOT / name
if not path.is_file():
continue
try:
text = path.read_text(encoding="utf-8")
except UnicodeDecodeError:
continue
missing += [f"{name}:{number}: {script}" for number, script in cited(text)
if not exists(script) and not any(word in script for word in PLACEHOLDERS)]
self.assertEqual(missing, [])
def test_the_check_reads_both_spellings(self):
text = ('# built by scripts/sitebootstrap.py\n'
'python -m scripts.scraper.mame_hash_scraper --dry-run\n'
'[sys.executable, "-m", "scripts.scraper.game_dat_importer"]\n')
self.assertEqual(cited(text), [(1, "scripts/sitebootstrap.py"),
(2, "scripts/scraper/mame_hash_scraper.py"),
(3, "scripts/scraper/game_dat_importer.py")])
self.assertFalse(any(exists(script) for _, script in cited(text)))
if __name__ == "__main__":
unittest.main()
+1 -1
View File
@@ -287,7 +287,7 @@ class TheArchives(unittest.TestCase):
def test_the_site_serves_each_and_the_release_none(self):
"""Each archive carries install.py: the site serves it from its own
commit (sitehandheld.py), and the release steps never build one."""
commit (sitegen/handheld.py), and the release steps never build one."""
text = (REPO_ROOT / "wiki" / "release-process.md").read_text(encoding="utf-8")
self.assertNotIn("scripts/build_port.py", text)
installer = (REPO_ROOT / "wiki" / "installer.md").read_text(encoding="utf-8")
+1 -1
View File
@@ -4,7 +4,7 @@
verify.py and generate_pack.py must reach the same verdict on the same file:
a pack and a coverage report that disagree describe different collections.
The rule used to rest on both files spelling out `mode == "existence"` in
their own words. Routing both through scripts/nativemode.py single-sources
their own words. Routing both through scripts/resolve/nativemode.py single-sources
it, and these tests make the agreement checkable instead of reviewable.
"""
+1 -1
View File
@@ -1,4 +1,4 @@
"""The installer demos of the README and the site (scripts/demovariants.py).
"""The installer demos of the README and the site (scripts/sitegen/demovariants.py).
The home page and Get your files score 98 to 100 on a phone: a video must
cost nothing before it is on screen, keep still under reduced motion, and say
+1 -1
View File
@@ -1,4 +1,4 @@
"""The drawn steps of the install box (scripts/sitesteps.py).
"""The drawn steps of the install box (scripts/sitegen/steps.py).
Each drawing file says in words what it shows, for one opened on its own:
a title and a desc the SVG names. On the page the images are alt="" and the
@@ -1,7 +1,7 @@
---
// The Measurements page: every test of the measurements index, filtered in
// the browser. Reads public/data/measurements/index.json, which
// scripts/sitemeasurements.py writes from the records under measurements/.
// scripts/sitegen/measurements.py writes from the records under measurements/.
// Each row keeps its method and the computer it ran on beside the result,
// and links its full record. The filters answer from the index alone: no
// SQL engine is loaded.
+1 -1
View File
@@ -1,7 +1,7 @@
---
// The wanted page: files dropped here are hashed on this device and
// compared with public/data/wanted.json, the files the gaps page reports
// the collection lacks (scripts/sitewanted.py). A file no hash matches
// the collection lacks (scripts/sitegen/wanted.py). A file no hash matches
// may still be an entry known by its name only. A file the collection
// holds is found in the hash lookup (api/v1/lookup/, one shard per first
// two characters). Nothing is sent anywhere: a wanted file gets a link to
+1 -1
View File
@@ -1,5 +1,5 @@
---
// Every file of public/data/wanted.json (scripts/sitewanted.py) in one
// Every file of public/data/wanted.json (scripts/sitegen/wanted.py) in one
// table, a header row per system, most useful first: what someone needs
// to search for a file. The list is fetched when the page runs, never
// written in the HTML. A name links to the page holding the file's
+1 -1
View File
@@ -1,5 +1,5 @@
// What each page knows of its place in the site, computed once per page
// from what scripts/sitestarlight.py writes beside the sidebar:
// from what scripts/sitegen/starlight.py writes beside the sidebar:
// - breadcrumbs: the tab and the groups above the page, each linked to the
// page or the section that introduces it, never to a sibling page. A
// group of names by their first letter (A, B) is no crumb;
+1 -1
View File
@@ -1,4 +1,4 @@
// The wanted page's reading of public/data/wanted.json (scripts/sitewanted.py):
// The wanted page's reading of public/data/wanted.json (scripts/sitegen/wanted.py):
// which entries a hashed file is, and where its upload goes. An entry
// with no h is known by its name only: a dropped file meets it by name,
// and the review of the upload decides.
+1 -1
View File
@@ -564,7 +564,7 @@ body:has(.rb-sys-file, .rb-file-entry) { --sl-content-width: var(--rb-grid-width
}
:is(.rb-sys-file, .rb-file-entry):has(> .rb-file-title:target) { background: var(--rb-surface); }
/* Entries as table rows (scripts/siteentries.py): the name takes the room
/* Entries as table rows (scripts/sitegen/entries.py): the name takes the room
and its card opens under it. On a phone the row stacks like any table
with a hash column, the name on the full width. */
body:has(table.rb-entries) { --sl-content-width: var(--rb-grid-width); }
+1 -1
View File
@@ -82,7 +82,7 @@ Every module in `tests/`, by the area it guards.
| Truth and native export | synthetic + cached originals | `test_export_counts`, `test_export_native_layer`, `test_export_report`, `test_exporters_contract`, `test_exporters_fidelity`, `test_exporters_lists`, `test_exporters_reconciliation`, `test_exporters_scripts`, `test_truth_data_dir_readers`, `test_truth_diff`, `test_truth_layout` |
| Scrapers, upstream and provenance | inline sources, synthetic | `test_auto_fetch_lookup`, `test_batocera_md5_list`, `test_check_freshness`, `test_data_dir_refs`, `test_dedup`, `test_elec_scrapers`, `test_fbneo_parser`, `test_find_embedded`, `test_find_pinned_revision`, `test_hash_merge`, `test_lines`, `test_listxml`, `test_mame_devices`, `test_mame_parser`, `test_provenance`, `test_refresh_data_dirs`, `test_refresh_failures`, `test_refresh_stale`, `test_retrodeck_component_md5`, `test_retrodeck_scraper_errors`, `test_romset_recipes`, `test_scraper_contract`, `test_scraper_dropped`, `test_scraper_network`, `test_upstream`, `test_upstream_index` |
| Site and published pages | the generated pages, the built site, the published data | `test_coverage_cache`, `test_retired_files`, `test_site_agents`, `test_site_arcade_boards`, `test_site_availability`, `test_site_bootstrap`, `test_site_built_gate`, `test_site_components`, `test_site_console_folders`, `test_site_content_data`, `test_site_copy`, `test_site_cores`, `test_site_css`, `test_site_demo`, `test_site_density_cards`, `test_site_emulator_page`, `test_site_emulators`, `test_site_entry`, `test_site_entry_tables`, `test_site_exports`, `test_site_freshness`, `test_site_funnel`, `test_site_handheld`, `test_site_images`, `test_site_inputs`, `test_site_insights`, `test_site_integration`, `test_site_nav`, `test_site_page_text`, `test_site_picker`, `test_site_platform_density`, `test_site_platform_hashes`, `test_site_privacy`, `test_site_pronouns`, `test_site_reference_data`, `test_site_reference_lookup`, `test_site_reference_pages`, `test_site_render`, `test_site_search`, `test_site_steps`, `test_site_system_links`, `test_site_system_names`, `test_site_system_sections`, `test_site_systems`, `test_site_validation`, `test_site_wanted`, `test_site_weight`, `test_site_wiki`, `test_site_write` |
| Documentation pages | the wiki, the README and CONTRIBUTING read against the code | `test_contributing_text`, `test_doc_pages_installer`, `test_doc_pages_rules`, `test_doc_pages_style`, `test_doc_pages_tools`, `test_doc_surfaces`, `test_prose_style`, `test_report_excerpt`, `test_text` |
| Documentation pages | the wiki, the README and CONTRIBUTING read against the code | `test_cited_scripts`, `test_contributing_text`, `test_doc_pages_installer`, `test_doc_pages_rules`, `test_doc_pages_style`, `test_doc_pages_tools`, `test_doc_surfaces`, `test_prose_style`, `test_report_excerpt`, `test_text` |
| Profile sync and citations | an injected fetch, synthetic profiles, the committed profiles at their pins | `test_cited_lines`, `test_mame_ref_audit`, `test_pin_build`, `test_profile_sync_anchoring`, `test_profile_sync_cli`, `test_profile_sync_prose`, `test_profile_sync_report`, `test_profile_sync_repositories`, `test_profile_sync_versions`, `test_profile_sync_writes`, `test_source_ref_targets`, `test_version_basis` |
| Launcher extractors | upstream source blocks placed at the lines they hold at the pinned revision | `test_launchers_amberelec`, `test_launchers_batocera`, `test_launchers_emudeck`, `test_launchers_emuelec`, `test_launchers_knulli`, `test_launchers_recalbox`, `test_launchers_retrobat_configs`, `test_launchers_retrobat_files`, `test_launchers_retrodeck`, `test_launchers_retropie`, `test_launchers_rocknix` |
| PR validation and CI | synthetic contributor files, the workflow files, the source of `scripts/` | `test_dataclass_defaults`, `test_optional_dependencies`, `test_schema_semantic_gate`, `test_validate_pr`, `test_validate_pr_flow`, `test_validate_pr_hashes`, `test_workflow_paths` |