Skip to content

Commit bc1f365

Browse files
committed
chore(validate): drop the game checks left over from the catalog split
Games moved to the game-catalog repository and data/game no longer exists, so GAME_REQUIRED and the loop over an always-empty list checked nothing. The engine's validator has no game branch either. The docstring named a validate-data.yml workflow this repo does not have; it now names what runs the validator and says which document the section numbers in the messages belong to. A comment cited a decision record that is about something else. No check changes: the full scan passes as before. Line endings are untouched (still CRLF).
1 parent 8ccc29e commit bc1f365

1 file changed

Lines changed: 11 additions & 25 deletions

File tree

‎app/validate.py‎

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
"""Validate seed JSON against the schema and conventions (§9.3, §15.3).
1+
"""Validate the records under ``data/`` with the standard library only.
22
3-
Checks: required fields, slug convention (§14.1), value ranges/units (§14.3),
4-
and foreign-key integrity by slug. Run with ``python -m app.validate``;
5-
exits non-zero on the first failure set (used by CI ``validate-data.yml``).
3+
Checks: required fields, the slug convention, value ranges and units, the
4+
folder a record lives in, and that references by slug (brand, soc, cpu, gpu)
5+
resolve. Run with ``python -m app.validate``; it prints every issue and exits
6+
non-zero if there is any. ``pr-checks.yml`` runs it on every PR and
7+
``.github/scripts/build-api.sh`` runs it before the API is generated.
8+
9+
Section numbers in the messages (§14.1, §14.2) are those of
10+
``docs/SPEC.md`` in TechEngine, whose ``app/validate.py`` is the full
11+
validator.
612
"""
713

814
from __future__ import annotations
@@ -35,7 +41,7 @@
3541
"defunct",
3642
}
3743
COUNTRY_RE = re.compile(r"^[A-Z]{2}$")
38-
# Media links may only point at free Wikimedia Commons files (ADR-017), never third-party hotlinks.
44+
# Media links may only point at free Wikimedia Commons files, never third-party hotlinks.
3945
COMMONS_UPLOAD_RE = re.compile(r"https://upload\.wikimedia\.org/wikipedia/commons/\S+")
4046
COMMONS_FILEPATH_RE = re.compile(r"https://commons\.wikimedia\.org/wiki/Special:FilePath/\S+")
4147
SOC_REQUIRED = {"slug", "name", "manufacturer", "release_date", "process_nm", "gpu_name"}
@@ -108,13 +114,6 @@
108114
"verified",
109115
}
110116

111-
GAME_REQUIRED = {
112-
"slug",
113-
"name",
114-
"source_urls",
115-
"verified",
116-
}
117-
118117
SOFTWARE_REQUIRED = {
119118
"slug",
120119
"name",
@@ -327,7 +326,6 @@ def validate() -> list[str]:
327326
cpus = _load("cpu")
328327
laptops = _load("laptop")
329328
monitors = _load("monitor")
330-
games = _load("game")
331329
software = _load("software")
332330
websites = _load("website")
333331
catalog = _load("device_catalog")
@@ -348,7 +346,6 @@ def validate() -> list[str]:
348346
("cpu", cpus),
349347
("laptop", laptops),
350348
("monitor", monitors),
351-
("game", games),
352349
("software", software),
353350
("website", websites),
354351
("device_catalog", catalog),
@@ -508,17 +505,6 @@ def validate() -> list[str]:
508505
errors.append(f"{fname}: brand '{rec.get('brand')}' not a known brand")
509506
_check_variant_path(fname, rec, "monitor", errors, allow_flat=True)
510507

511-
for fname, rec in games:
512-
_check_required(fname, rec, GAME_REQUIRED, errors)
513-
_check_source_urls(fname, rec, errors)
514-
_check_slug(fname, rec.get("slug"), errors)
515-
if rec.get("release_date") is not None:
516-
_check_date(fname, rec["release_date"], errors)
517-
if rec.get("rating") is not None:
518-
_check_range(fname, "rating", rec.get("rating"), 0, 5, errors)
519-
if rec.get("metacritic") is not None:
520-
_check_range(fname, "metacritic", rec.get("metacritic"), 0, 100, errors)
521-
522508
for fname, rec in software:
523509
_check_required(fname, rec, SOFTWARE_REQUIRED, errors)
524510
_check_source_urls(fname, rec, errors)

0 commit comments

Comments
 (0)