Add a consistency check for registry.json, game folders and trophies

Offen
#31 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
55/100
Issue-Typ
Feature
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
typescript, vite
Bereich
devtools, testing

Rechercherichtung

Start by reading games/registry.json, vite.config.ts, shared/achievements.ts, and scripts/new-game.mjs to trace how game folders, registry entries, and trophies are connected. Add the consistency checks in games/registry.test.ts, then make the scaffold function testable with a temporary directory. Done means the listed validation and scaffold cases pass in CI; the issue says there is no test suite yet, so first identify the project’s test setup.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

help wanted severity: medium testing

Summary

The list of games has three independent sources of truth and nothing ties them together: Vite builds pages from a folder scan, the hub lists games from registry.json, and the "play every game" trophy derives the game set from the trophy list. They agree today; this is a drift risk.

Where

  • vite.config.ts:10-19 (discoverGames)
  • games/registry.json, src/hub/main.ts:46 (unchecked cast)
  • shared/achievements.ts:143-144
  • scripts/new-game.mjs:7-44 (runs at module top level, so it cannot be pointed at a fixture directory)

Impact

A registry slug with no folder is a dead hub card. A folder with no registry entry is built and precached but unreachable. A game with no trophy is silently not required for the "play every game" trophy.

Suggested fix

Add games/registry.test.ts (and optionally the same check at build time in vite.config.ts):

  • Slugs are unique and match /^[a-z0-9]+(-[a-z0-9]+)*$/
  • The slug set equals the set of games/* folders that do not start with _ and contain index.html
  • Every entry has a non-empty title, description, controls and tags, and a six-digit hex accent
  • Every thumbnail resolves to a file under public/
  • Every non-arcade trophy's game is a registry slug, and every slug has at least one trophy
  • Trophy ids are unique; counter and target are both set or both absent

Then export scaffold({ root, slug, title }) from new-game.mjs with a thin CLI wrapper and test it against a temp directory:

  • Invalid and existing slugs are rejected with no writes
  • space-dodge with no title becomes "Space Dodge"
  • No placeholder remains in the copied files; the registry gains exactly one entry and stays valid JSON

Acceptance criteria

  • The cases above pass in CI

Getting started

  • Relevant files: games/registry.json, vite.config.ts, shared/achievements.ts, scripts/new-game.mjs
  • Run locally: npm install, then npm run dev
  • Checks: npm run typecheck and npm run build (there is no test suite yet)
  • Related docs: README.md

Filed by repo-audit/full-audit at b001f5d. Severity: medium. Effort: M. audit-key: testing|games/registry.json|registry-consistency

Vorherrschende Sprache
TypeScript
Sterne
3
Forks
3
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus TMHSDigital/GH-Arcade

Alle Issues in TMHSDigital/GH-Arcade

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.