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.
This commit is contained in:
Abdessamad Derraz committed 2026-10-23 20:04:38 +02:00
1 parent e5cd024e2e
commit b5173ce72f
6 files changed
+28 -16

No files matched your search

+1 -1
View File
@@ -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))
+2 -2
View File
@@ -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'<table class="rb-options"')
self.assertRegex(_built("wiki/installer"), r'<table[^>]*\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))
+1 -1
View File
@@ -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)
+8 -6
View File
@@ -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: [
+12 -4
View File
@@ -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"])
+4 -2
View File
@@ -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