From b5173ce72f1391ee005085696daeedbeb4e5ce62 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Fri, 23 Oct 2026 20:04:38 +0200 Subject: [PATCH] fix: answer the search gate's missed queries terms weighs 20, so the version table outranks MAME parts. The FAQ carries ios, iphone, ipad, the file page check my dump, and a console's regional lead names it (the PlayStation BIOS). The FAQ quotes the bootstrap's fingerprint message again. The troubleshooting page, which answers the dc/ trap, joins the pages that answer dc bios missing. The gate starts node without its compile cache. --- tests/test_site_r3_components.py | 2 +- tests/test_site_r4_components.py | 4 ++-- tests/test_site_r4_reference.py | 2 +- website/astro.config.mjs | 14 ++++++++------ website/tools/search_gate.py | 16 ++++++++++++---- wiki/faq.md | 6 ++++-- 6 files changed, 28 insertions(+), 16 deletions(-) diff --git a/tests/test_site_r3_components.py b/tests/test_site_r3_components.py index 00b8caee..fee1219d 100644 --- a/tests/test_site_r3_components.py +++ b/tests/test_site_r3_components.py @@ -291,7 +291,7 @@ class SearchFoldsPagesUnderAHash(unittest.TestCase): def test_search_fields_are_weighted_and_never_shown(self): config = _read(CONFIG) - self.assertIn("metaWeights: { title: 10, files: 0.5, aliases: 5, devices: 5, consoles: 10, terms: 10 },", config) + self.assertIn("metaWeights: { title: 10, files: 0.5, aliases: 5, devices: 5, consoles: 10, terms: 20 },", config) self.assertIn("const UNSHOWN_FIELDS = new Set(['files', 'aliases', 'devices', 'consoles', 'terms']);", _read(SITE_TS)) diff --git a/tests/test_site_r4_components.py b/tests/test_site_r4_components.py index 40a6fac5..cd993c15 100644 --- a/tests/test_site_r4_components.py +++ b/tests/test_site_r4_components.py @@ -206,7 +206,7 @@ class ShortCodeMarked(unittest.TestCase): self.assertIn('class="rb-short"', _built("")) def test_the_options_table(self): - self.assertRegex(_built("wiki/installer"), r']*\sclass="(?:[^"]*\s)?rb-options[\s"]') class SearchFields(unittest.TestCase): @@ -214,7 +214,7 @@ class SearchFields(unittest.TestCase): def test_declared_and_never_shown(self): config = _read(CONFIG) - self.assertIn("metaWeights: { title: 10, files: 0.5, aliases: 5, devices: 5, consoles: 10, terms: 10 },", config) + self.assertIn("metaWeights: { title: 10, files: 0.5, aliases: 5, devices: 5, consoles: 10, terms: 20 },", config) self.assertIn("const UNSHOWN_FIELDS = new Set(['files', 'aliases', 'devices', 'consoles', 'terms']);", _read(SITE_TS)) diff --git a/tests/test_site_r4_reference.py b/tests/test_site_r4_reference.py index 722e1153..41b36ddf 100644 --- a/tests/test_site_r4_reference.py +++ b/tests/test_site_r4_reference.py @@ -263,7 +263,7 @@ class TheReferencePagesAnswerTheirWords(unittest.TestCase): def test_find_or_check_a_file(self): page = generate_site.generate_files_page() self.assertTrue(page.startswith( - "---\nterms: check dump, md5 check, verify bios file, check hash\n---\n")) + "---\nterms: check my dump, md5 check, verify bios file, check hash\n---\n")) self.assertIn("\n# Find or check a file\n\nCheck a BIOS dump: paste its hash " "or choose the file.\n", page) diff --git a/website/astro.config.mjs b/website/astro.config.mjs index 4fd5748d..8ec34d4a 100644 --- a/website/astro.config.mjs +++ b/website/astro.config.mjs @@ -111,11 +111,13 @@ export default defineConfig({ // every other query. Two fields name the page's subject in other words // and weigh half a title: `aliases`, the ids setups file a system under // (psx, dreamcast, gba), and `devices`, the handhelds and boxes a - // setup's own site names (R36S, Miyoo Mini). Two more weigh as much as - // a title, since each names what a reader types to reach the page: - // `consoles`, the consoles a manufacturer page holds (Neo Geo, - // WonderSwan Color), and `terms`, the words of a task or a message on - // screen (bios not found, mame version, check dump). All of them are + // setup's own site names (R36S, Miyoo Mini). `consoles`, the consoles a + // manufacturer page holds (Neo Geo, WonderSwan Color), weighs as much + // as a title. `terms`, the words of a task or a message on screen (bios + // not found, which mame version, check my dump), weighs twice that: a + // field match scores below a title match, and at 10 the MAME parts, + // whose card titles name MAME files, came before the version table + // for "which mame version". All of them are // attributes on an empty element, so no text of theirs reaches an // excerpt. pagefind: { @@ -124,7 +126,7 @@ export default defineConfig({ termFrequency: 0.5, termSaturation: 1.4, termSimilarity: 9, - metaWeights: { title: 10, files: 0.5, aliases: 5, devices: 5, consoles: 10, terms: 10 }, + metaWeights: { title: 10, files: 0.5, aliases: 5, devices: 5, consoles: 10, terms: 20 }, }, }, plugins: [ diff --git a/website/tools/search_gate.py b/website/tools/search_gate.py index 522d8296..19a59025 100644 --- a/website/tools/search_gate.py +++ b/website/tools/search_gate.py @@ -18,6 +18,7 @@ from __future__ import annotations import argparse import json +import os import socket import subprocess import sys @@ -60,7 +61,9 @@ QUERIES: dict[str, tuple[tuple[str, ...], int]] = { # The platforms' own names for a console (psx, dc, gba), a search field # of its page. Flycast's page names dc_boot.bin and where it goes. "psx bios": (("systems/sony",), 3), - "dc bios missing": (("systems/sega", "emulators/flycast/"), 3), + # Step 3 of the troubleshooting page answers it too: a BIOS setting on + # system/dc, while Flycast adds dc/ itself. + "dc bios missing": (("systems/sega", "emulators/flycast/", "wiki/troubleshooting/"), 3), "gba bios": (("systems/nintendo",), 3), # The words an emulator prints, and the page that answers them. "bios not found": (("wiki/troubleshooting/",), 3), @@ -91,11 +94,16 @@ def _free_port() -> int: return int(probe.getsockname()[1]) +# Node's compile cache fills /tmp (a 4 GB tmpfs under WSL): every node this +# gate starts runs without it. +NODE_ENV = {**os.environ, "NODE_DISABLE_COMPILE_CACHE": "1"} + + @contextmanager def served(site_dir: Path) -> Iterator[str]: """The build served by serve.mjs on a free port, for the run.""" port = _free_port() - server = subprocess.Popen(["node", str(TOOLS / "serve.mjs"), str(site_dir), str(port)]) + server = subprocess.Popen(["node", str(TOOLS / "serve.mjs"), str(site_dir), str(port)], env=NODE_ENV) url = f"http://127.0.0.1:{port}{BASE}" try: for _ in range(100): @@ -118,7 +126,7 @@ def run_gate(base: str) -> int: root = "/" + base.split("/", 3)[3] run = subprocess.run( ["node", str(TOOLS / "measure.mjs"), "search", base, "starlight-ui", *QUERIES], - capture_output=True, text=True, check=False, + capture_output=True, text=True, check=False, env=NODE_ENV, ) if run.returncode: print(run.stderr.strip() or f"measure.mjs exited with {run.returncode}", file=sys.stderr) @@ -146,7 +154,7 @@ def home_weight(base: str) -> float: """The home page's transfer at 390 px, once the network is idle.""" run = subprocess.run( ["node", str(TOOLS / "measure.mjs"), "weight", base, ""], - capture_output=True, text=True, check=True, + capture_output=True, text=True, check=True, env=NODE_ENV, ) return float(json.loads(run.stdout.splitlines()[0])["total_kb"]) diff --git a/wiki/faq.md b/wiki/faq.md index 9c7254d9..2244e4d5 100644 --- a/wiki/faq.md +++ b/wiki/faq.md @@ -1,6 +1,7 @@ --- level: start order: 50 +terms: ios, iphone, ipad --- # Common questions @@ -58,7 +59,8 @@ Sometimes, with an emulator's stand-in, but some games fail. ## Is the command safe? { #is-piping-the-installer-into-a-shell-safe } -- It checks the installer and each file against their fingerprints. +- It stops if the installer does not match its expected fingerprint, and + checks each file. - It writes in your BIOS folder, and for some emulators your save folder. - It never touches a game or a save. - It keeps each file it replaces in `retrobios-backup`. `--restore` puts it @@ -101,7 +103,7 @@ Fill its folder from a computer, as above, or unzip your ZIP and check it with ## Why is a file missing from the ZIP? -Some come with the emulator, so the ZIP skips them. +Some come with the emulator. ## My game shows a black screen