Files
f1-circuits/merge-check.sh
T
jschoubben 11c17cb9ad Match a race's circuit on Jolpica's circuitId, not its name
Jolpica renamed Losail to Lusail International Circuit, so the name match
found no circuit and every Qatar Grand Prix poster, thumb and track image
answered 404 (reported by Brad Johnston for 2025 and 2026; every season
since 2021 failed). Names drift, ids do not: each circuit in circuits.json
now carries its ergastId, the lookup keys on it, and the poster's zoom
fallback resolves our circuit slug the same way. The name match also sent
Caesars Palace (1981-82) to the Las Vegas Strip circuit; by id it resolves
to nothing, as there is no layout of it.

tests/ checks every circuit has one unique ergastId and that a race
resolves by id; the merge check runs it.

Claude-Session: https://claude.ai/code/session_01NcbgfJAa38xFpzy69BWrqh
2026-11-27 09:40:27 +01:00

28 lines
1.5 KiB
Bash

#!/bin/sh
# mesh-check-toolchain: go
#
# f1-circuits' own check (novox/hq ADR 0237): the second layer of a pull request's merge check,
# `mesh/repo-check`, run by the build seat in the mesh's Go toolchain, which carries Python for the merge
# checks that need it. The gate — the manifest through the controller the mesh runs, every machine
# composed with it — is the build seat's first layer (`mesh/merge-gate`), run because the mesh's module
# graph builds f1-circuits from this branch.
#
# What the image ships, compiled before the merge: every Python file the service's image copies, and the
# models it imports. Then the tests in tests/, which need the standard library only: every circuit in
# circuits/circuits.json carries one unique ergastId, and a race's circuit resolves by that id, never by
# its name.
#
# **Said, never passed silently**: the service's dependencies (service/requirements.txt) are the image's to
# install, so the service is not started.
set -eu
# Parsed, not compiled to files: a check leaves the tree as it found it.
find cdn-api.py circuits_service.py ergast_service.py posters_service.py models -name '*.py' -print0 |
xargs -0 python3 -c 'import ast, sys
for f in sys.argv[1:]:
ast.parse(open(f, encoding="utf-8").read(), f)
print(len(sys.argv) - 1, "Python file(s) parse")'
# -B: no bytecode written, the tree stays as it was found.
python3 -B -m unittest discover -s tests -t .
echo "NOT RUN HERE: the service (its dependencies are the image's to install)"