Commit Graph

206 Commits

Author SHA1 Message Date
Georges-Antoine Assi
c413c066c6 refactor(docker): supervise the container with s6-overlay (#4019)
* refactor(docker): supervise the container with s6-overlay

The init script was a hand-rolled supervisor: PID files, /proc polling, a
5s watchdog loop and a trap-based shutdown. Its shutdown wait was unbounded,
so a process that refused to exit stranded PID 1 and left the container up
and serving nothing, which no restart policy can detect.

s6-rc replaces it with a declared service graph. Ordering and readiness
gates that were sequential bash become dependencies, and the failure modes
become configuration:

- timeout-kill bounds SIGTERM before SIGKILL, and flag-timeout-killpg
  escalates to the whole process group.
- S6_BEHAVIOUR_IF_STAGE2_FAILS=2 exits the container when a startup step
  fails, so the restart policy retries instead of the container wedging.
- valkey gets --shutdown-on-sigterm force, so it stops refusing to exit
  when the snapshot it writes on shutdown cannot be written.

A crashed service is now restarted on its own instead of taking the whole
container down. Its leftover children are swept first, because children
reparented from a hard-killed master keep holding its listening sockets and
would make every replacement fail to bind.

Optional services have no conditional mechanism in s6-rc, so they start,
check their environment variable, and take themselves down with s6-svc -O.

Running with a read-only root filesystem now needs /run mounted exec, since
s6 executes its generated stage scripts from there.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix(docker): always start the RQ scheduler under s6

The s6 service carried over the four-flag ENABLE_SCHEDULED_* gate from the
init script, which #4033 has since removed on master. Since this branch
deletes that script, the fix would be lost on rebase.

Nothing else respects the condition: startup.py registers the netplay,
upload-tmp and zip-cache cleanups unconditionally, three more flags gate
periodic tasks absent from the list, and the watcher defers its rescans
through the scheduler. Any of those leaves jobs in the scheduler registry
with no process to run them, and a stuck delayed scan_platforms entry reads
to the concurrent scan guard as a scan already queued, refusing every
manual scan.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix(docker): port master's init changes to the s6 services

Master reworked docker/init_scripts/init while this branch replaced it,
so carry those changes into the s6-rc services:

- Replace rq-scheduler with `rq cron` (romm-rq-cron) on tasks.cron_config.
- Add romm-rq-scan-worker (scans queue) and romm-rq-streaming-worker
  (streaming queue, down unless config.yml enables streaming).
- Run every worker with --with-scheduler and the RomMRedis connection
  class, passing the Redis URL through RQ_REDIS_URL so the password stays
  off the command line, and read REDIS_SSL as a boolean.
- Bring gunicorn's flags in line: --no-control-socket, a private-range
  FORWARDED_ALLOW_IPS default, 4 workers and a 65s keep-alive.
- Check the sync folder and SSH keys path in romm-init, and switch the
  features off through the container environment when they're unusable.
- Accept the backend's truthy values for the watcher flags.
- Point the serving-layer guard tests at the gunicorn run script and
  drop the PID-file tests, which guarded the bash watchdog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(docker): guard the s6-overlay service tree

Check that every service is in the user bundle, depends on something
that exists, and that every longrun has its finish sweep, kill timeout
and process-group flag. Also check that the dev entrypoint starts the
same RQ workers and cron scheduler as the image, since it keeps its own
launcher.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(dev): pass the image's RQ flags in the dev entrypoint

The dev image's RQ cron scheduler and workers ran without the RomMRedis
connection class, and the workers without --results-ttl, so they kept
redis-py's maintenance notification probe and RQ's default result TTL.
The s6 guard test now compares each rq command's flags with the image's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(docker): address Greptile review on the s6 service tree

- Cut the s6 script comments to two lines, keeping the reason each
  helper exists.
- Compare the values of the dev entrypoint's RQ options with the
  image's, not only their names, allowing for the dev image's path,
  PID files and LOGLEVEL default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci(docker): check every s6 service stays up after boot

The heartbeat only proves gunicorn and nginx came up. Enable both watchers
and require each longrun in the s6 tree to report up for 15s straight, so a
crashing or restart-looping worker, cron, valkey or watcher fails the job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ci(docker): enable streaming so its worker is checked too

The streaming worker turns itself off when streaming.enabled is false in
config.yml, which the services check read as a failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-24 08:29:06 -05:00
renovate[bot]
146a23089a chore(deps): update postgres docker tag to v19 (#5742)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-22 19:32:36 -06:00
renovate[bot]
964115db20 chore(deps): update github actions (#5740)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-22 19:27:44 -06:00
renovate[bot]
a3d6e09f6c chore(deps): update valkey/valkey docker tag to v9.0.8 (#5676) 2026-11-19 20:40:39 -06:00
renovate[bot]
fd52329649 chore(deps): update peter-evans/create-pull-request action to v8.1.3 (#5638)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-17 12:18:11 -05:00
Georges-Antoine Assi
87c38eebf6 fix(patcher): cap the output size a patch can declare (#5632)
* fix(patcher): cap the output size a patch can declare

RomPatcher.js allocates the patched ROM from the size written in the
patch header, so a few-byte UPS/BPS/APS/BDF/RUP patch could make the
Node patcher allocate and write gigabytes. patcher.js now wraps the
BinFile constructor and refuses any allocation above a cap passed by
the backend: twice the source ROM, or the ROM plus 64 MiB when that is
larger, never above ROM_PATCHER_MAX_FILE_SIZE_BYTES. An oversized
output is reported with exit code 3 and surfaces as a 400.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(patcher): run the output size guard through the real patcher.js

The CI pytest job now installs Node and RomPatcher.js so the patcher
tests can exercise patcher.js itself: a UPS patch declaring a 2 GiB
output is rejected, and one growing the ROM within the cap applies.
The tests skip when node or RomPatcher.js is missing locally.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 08:56:12 -05:00
Georges-Antoine Assi
e813e4d666 chore(coherence): adopt Coherence with specs, invariants and a PR report (#5584)
* chore(coherence): adopt Coherence with specs, invariants and a PR report

Install @posthog/coherence as a frontend dev dependency and wire its
Claude Code hooks into the committed .claude/settings.json, so every
agent session in the repo gets the vocabulary, specs, journal and checks.
The hooks call the binary under frontend/ through $CLAUDE_PROJECT_DIR.

Declare 23 components and the entrances that carry outside trust, and
six invariants, each refuted with a deliberate break before it counted:

- every /api route requires auth and its scopes, except a named public
  list (new route sweep in tests/endpoints/test_route_guards.py)
- a hidden rom, platform or firmware answers every id route exactly as
  a missing id would (new sweep over every method of every id route)
- the unscoped save, state and screenshot fetches by id are reached only
  from their own routers (chokepoints)
- validate_path never resolves outside its base folder

The PR workflow runs in comment mode: one report comment, failing only
when Coherence itself breaks. Trunk skips Prettier and markdownlint on
*.spec.md and *.practice.md, since Prettier escapes their globs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(routes): satisfy mypy in the route guard sweep

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(coherence): record the worktree test database enactment

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(roms): answer a hidden rom like a missing one on file routes; tighten route sweeps

Addresses Greptile's review on #5584.

The rom file delete and reading-progress routes answered "File not found"
for a hidden rom but "Rom with id N not found" for a missing one, so a
caller could tell them apart. They now raise the same not-found.

The route sweeps now reach the checks they claim to test: a protected
route with no scopes counts as public (its guard admits anyone), write
requests carry a body and upload name so validation can't answer first,
RomFile-keyed routes get a real file id, error bodies are compared with
the id normalized, and the rom routes are swept with the rom hidden
directly, through its platform, and by the unrated filter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(coherence): tighten route guard sweeps and isolate oracle test databases (code-review)

- Count a route as protected only when its endpoint is the scope-checking
  wrapper with non-empty scopes, not just when it declares the bearer scopes.
- Treat 401 and 403 like 422 as never reaching the visibility check, and
  sweep /api/streaming/states/{rom_id}.
- Run pytest oracles with a per-run ROMM_TEST_DB_TAG unless one is set.
- Use the shared setup-frontend action and ubuntu-24.04 in the workflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(tests): simplify route guard sweeps and path tests (simplify)

- Mark scope-guard wrappers with required_scopes so the auth sweep reads a
  public attribute instead of the private closure.
- Derive the entity regex from one segment list, ask each missing id once,
  and run the three hide scenarios through one sweep helper.
- Fold the new validate_path inputs into the existing valid, traversal and
  absolute path tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(coherence): trim workflow comments (review-polish)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(filesystem): restore the validate_path property test the paths invariant cites

Filesystem.spec.md names test_validate_path_never_escapes_its_base as the
invariant's evidence, and Coherence selects it by name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(coherence): run hooks from the local binary instead of npx

Each hook calls frontend/node_modules/.bin/coherence directly and exits 0
when it isn't installed, so sessions without frontend deps (fresh
worktrees, backend-only setups, cloud setup still installing) don't report
a hook error on every tool call, and no hook pays npx's startup.

Also commits the journal and run records left by earlier sessions, which
.coherence/.gitignore keeps as durable records.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(tests): share the bearer, user token and hide helpers

Tests built the same Authorization headers and HiddenEntity rows in about
40 local copies, and two modules imported private helpers from other test
files. They now use bearer, user_headers and hide from tests/auth_helpers.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(endpoints): one 404 for a missing or hidden rom, platform or firmware

Each route wrote the missing-row 404 and the hidden-row 404 separately and
had to keep them identical by hand. visible_rom_or_404,
visible_platform_or_404 and visible_firmware_or_404 take the lookup result
and raise one answer for both, either the standard not-found or a bespoke
detail. Re-reads after a write keep a plain not-found check, so an edit that
hides the row doesn't turn into a 404 after it succeeded.

The RomFile-keyed routes (/roms/{file_id}/files, .../files/content/{name},
/roms/{file_id}/patch) name their path parameter file_id instead of id, so
the route sweep reads which id a route takes from its path and drops its
hand-kept list. URLs are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(setup): develop inside WSL on Windows

@posthog/coherence installs only on Linux and macOS, so npm install in
frontend/ fails on native Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(coherence): record the whole-repo chokepoint run

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(types): regenerate API types for the file_id patch route

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 10:53:46 -05:00
renovate[bot]
6732bc3655 chore(deps): update peter-evans/create-pull-request action to v8.1.2 (#5535) 2026-11-09 08:22:07 -06:00
renovate[bot]
8d98ec2cea chore(deps): update github actions (#5494)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-05 16:10:33 -06:00
renovate[bot]
d328779435 chore(deps): update valkey/valkey docker tag to v9.0.7 (#5467)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-04 10:52:39 -05:00
renovate[bot]
e923ced4f0 chore(deps): update astral-sh/setup-uv action to v10.3.3 (#5466)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-04 08:57:51 -05:00
Sam Dornan
fec6e494f7 ci(coverage): measure frontend coverage with v8 and backend branch coverage (#5407)
* ci(coverage): measure frontend coverage with v8 and backend branch coverage

The frontend had no coverage measurement, and the backend's line-only
report counts a one-sided `if` as covered when its body never runs.

- Add @vitest/coverage-v8 and `npm run test:coverage`. Its include lists
  every source file, so a file no test imports reports 0% instead of
  disappearing. Generated types, locales, tokens, test utilities,
  stories, fixtures and play helpers are excluded.
- Frontend Checks runs tests with coverage and uploads the cobertura
  report to GitHub code coverage as code-coverage/vitest, mirroring
  pytest.yml: a separate job holds code-quality: write and fork PRs skip
  the upload.
- Turn on branch coverage in backend/.coveragerc.

Baseline on master: 407 test files pass; frontend lines 63.3%, branches
55.3%. The app project alone (no stories) gives 61.4% lines, so stories
add about two points.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4iK9WRvZqdTHiRc9gY

* ci(coverage): include JavaScript sources in the frontend coverage report

The two audio worklets (gmeAudioWorklet.js, pico8AudioWorklet.js) are
production code that the `{ts,vue}` glob left out of the report, so they
now show at 0% instead of being omitted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NH5s4iK9WRvZqdTHiRc9gY

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 10:49:20 -05:00
Georges-Antoine Assi
5af2e231ec fix(i18n): placeholder parity check, one locale list, memory card plurals (#5375)
* fix(i18n): pluralize the memory card import message

Replace "save file(s)" with vue-i18n plural forms in en_US and en_GB.
The dialog already passes count, which selects the form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(i18n): check placeholder parity and fix es_ES placeholders

check_i18n_locales.py now fails when a translation's {placeholders}
differ from en_US. The check found 33 es_ES strings that dropped a
placeholder (usernames, error details, file paths) or used one the code
never passes, which renders empty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* refactor(i18n): derive the language list from the locale folders

The language store kept its own list of locales next to the folders
that locales/index.ts already discovers, so a new locale had to be
registered in both. The store now lists availableLocales and keeps only
their display names, and a test fails when a folder has no name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(i18n): address Greptile review on #5375

Give memory-card-import-body plural forms in the locales whose
"(s)"-style text has a one/other split (de, es, fr, pt_BR, ro, sv, bg)
and in cs_CZ's four-form rule. Extract the placeholder comparison into a
function, cover it with stdlib unittest tests, and run them in i18n.yml.
The locale checker now skips __pycache__.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(i18n): type the locale checker for mypy

mypy.yml runs strict mypy over frontend/src/locales, which rejected the
untyped helpers and tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(i18n): humanizer pass on the i18n skill changes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(i18n): handle two-form Czech plurals

The cs_CZ plural rule always returned a four-form index, so the 17
cs_CZ strings with only "one | other" forms showed the wrong form for
0 and 1 and threw "Unexpected return type in composer" for counts of
2 or more. Two-form strings now use the one/other split, which also
lets memory-card-import-body drop its duplicated segments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 09:11:39 -04:00
renovate[bot]
f5d3909c00 chore(deps): update github actions (#5348) 2026-10-25 20:16:03 -05:00
Sam Dornan
7eae2b8ffb chore(frontend): remove the v1 UI and console mode (#5309) 2026-10-23 19:37:45 -05:00
renovate[bot]
9c74d0143f chore(deps): update github/codeql-action action to v4.39.0 (#5299)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-10-22 08:33:20 -04:00
renovate[bot]
967a975a2f chore(deps): update github actions (#5244)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-10-21 14:20:30 -04:00
Georges-Antoine Assi
a874e4d012 ci: keep CI jobs off Ubuntu apt mirrors (#5182)
* ci: bound apt network timeouts for Playwright's dependency install

`npx playwright install --with-deps` runs its own `apt-get update`, so the
`-o` flags from #5181 could not reach it, and a stalled Ubuntu mirror hung
the frontend test job until the 15 minute limit cancelled it. Move the
retry/timeout options into an apt.conf.d file written by a small composite
action, used by setup-backend and the frontend test job.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci: install Playwright's headless shell without apt

The apt.conf.d timeouts did not stop the hang: on a runner whose Azure
mirror is unreachable, apt falls back to archive.ubuntu.com and stalls
while downloading the package indexes, slowly enough that no timeout
fires. The ubuntu-latest image already ships Chrome's system libraries,
so drop --with-deps from the frontend and e2e jobs and keep apt out of
their path. Revert the bound-apt-timeouts action, and run the frontend
checks when frontend.yml itself changes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci: install setup-backend's apt packages from a cache

The MariaDB connector .debs (plus each job's extra apt packages) were
fetched from an Ubuntu mirror on every backend job, so a stalled mirror
could hang any of them until the 15 minute limit, the same way it hung
Playwright's dependency install. Cache the downloaded .debs keyed on the
runner image OS and package list, saved from master only, and install
from them without apt-get update on a hit. A miss still downloads them
with the #5181 retry and timeout options.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci: install cached apt packages without re-downloading them

With package lists present, apt fetched the mirror's copy of each local
.deb instead of installing the file, so even the cached path reached the
mirror. Point apt's archives dir at the .deb directory and pass
--no-download. Also read ImageOS in a shell step: it is a runner shell
variable, not in the `env` context, so the cache key came out empty.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci: pin workflow runners to ubuntu-24.04

The apt .deb cache in setup-backend only holds packages built for one
Ubuntu release. Pin every job to ubuntu-24.04 so a GitHub move of
ubuntu-latest can't restore noble packages onto a newer image, and
hardcode the release in the cache key instead of reading ImageOS.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-07 16:56:47 -04:00
Georges-Antoine Assi
dbf5ae94c3 ci: check that PR titles follow Conventional Commits (#5143)
* ci: check that PR titles follow Conventional Commits

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci: address Greptile review on the PR title check

Give the HLTB updater a Conventional Commits title so its PRs pass the
check, and strip line breaks from the title before echoing it so it
cannot start a workflow command.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-07 11:52:49 -04:00
Sam Dornan
208bfa7889 test(frontend): run Storybook stories and a11y checks in Chromium via addon-vitest (#5153) 2026-10-06 12:59:12 -04:00
Stu Anderson
d8b024bddc chore(e2e): Update playwright with smaller focus (#4932)
* chore(e2e): Update playwright #4772, smaller focus

* chore(e2e) address greptile feedback

* chore(e2e): keep static analysis out of e2e/.output

Everything the suites write (reports, traces, saved sessions) lands in
e2e/.output. It was already gitignored and ESLint skipped it, but the
e2e tsconfig included it through ./**/*.ts, so any .ts file written
there was type-checked, and Trunk skipped it only through the
.gitignore default. Exclude it from the tsconfig and list it in
Trunk's ignore paths explicitly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(e2e): run with zero config locally and typecheck the suite in CI

- Every E2E_* variable now falls back to a default matching
  seed_e2e_users.py, and the shell wins over e2e/.env, which is optional.
- With E2E_BASE_URL unset, the config starts (or reuses) `npm run dev`
  through webServer; CI still sets the URL and serves the static build.
- Drop the migration table for removed variables, the unknown-key checks,
  and the gitignore entries for suite versions that never shipped.
- Add e2e/tsconfig.json to the root project references, so
  `npm run typecheck` (run by Frontend Checks) covers specs/ and setup/.
- Restore `test:e2e:ui`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(e2e): make seedUiState win over the user's stored preferences

Preferences are now stored per user (#5098), and the app only adopts an
unscoped value when the user has no `user:<id>:` copy. Saved sessions
carry one, so seedUiState(page, "light") was silently ignored. Drop the
scoped copies before seeding, and assert the light theme in the spec
that relies on it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* build(frontend): add build:preview, which copies frontend/assets into dist

Vite leaves frontend/assets out of the build and only the Docker image
copies it in, so a bare `vite preview` serves the SPA fallback for every
icon, logo, font and default cover. Give that copy one home: the e2e
workflow and the local production-build recipe both use the script. It
copies with fs.cpSync so it also runs from cmd.exe and PowerShell.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* ci(e2e): let the Playwright webServer serve CI again

The suite starts its own server once more, so the workflow no longer
needs its own build, serve, wait and teardown steps, nor the E2E_*
variables that now default to the seeded accounts. In CI the webServer
runs `build:preview` and `vite preview` as it did before this PR; locally
it runs (or reuses) `npm run dev`. The default URL is 127.0.0.1, which
the preview binds, rather than localhost, which can resolve to ::1.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(e2e): simplify the setup files

- auth.setup.ts signs each account in afresh every run, instead of
  validating saved sessions in a separate browser context. Two sign-ins
  cost about 3s.
- The hand-rolled login retry loop and its CI-specific attempt counts
  give way to `retries: 2` on the setup project, and the timeout
  arithmetic to `setup.slow()`.
- global-setup.ts folds its four check functions into one, and reads the
  library total from the admin's account check instead of fetching it
  twice.
- Drop isSessionValid(), login() and the ESLint exception that only the
  old setup needed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(e2e): drop the global-setup preflight

The suite already reports what it checked: a downed backend fails
sign-in through the app-error guard (`GET /api/heartbeat returned 502`),
and a wrong E2E_BASE_URL fails page.goto with the URL. The one case it
explained better, a rejected account, is now an assertion on the
`POST /api/login` status in auth.setup.ts. With no preflight, the suite
never calls the API directly, so its ESLint exception goes too.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test(e2e): cover every route for both roles, and stop the theme leaking

loads.spec.ts:
- Key PAGES by RouteName from src/plugins/routeNames.ts, with a `skip`
  reason for routes it can't open, so a new route fails the typecheck
  until it is listed. That adds devices and conversion-settings, which
  had drifted out.
- Load each page as every role allowed on it, not only as admin, so a
  viewer-only 403 shows up.
- Drop the wait for in-flight requests, which timed out on pages that
  load slowly on a large library.

Tags and folders now use route names (@page:rom, specs/rom/,
specs/user-profile/).

The app syncs UI settings to the account and reapplies them on sign-in,
so a theme a spec wrote leaked into later sessions: admin ended up on
"auto", and every "dark" spec rendered light. seedUiState now always
stores "auto", the config sets `colorScheme: "dark"`, and the light
spec uses emulateMedia. The saved sessions carry the seeded settings, so
specs no longer call seedUiState themselves.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(e2e): keep support/auth.ts to accounts and sign-in

- Navigation helpers (gotoHydrated, gotoFirstRom, gotoOwnProfile) move
  to support/navigation.ts, with a gotoFirstPlatform that loads.spec.ts
  and gotoFirstRom now share.
- openMoreMenu and menuLabels move into rom/actions-menu.spec.ts, their
  only user.
- Role derives from ROLES, and accountFor's return type is inferred, so
  the Account interface goes.
- watchAppErrors folds into the app-error guard, its last caller.
- output.ts exports the results and report paths instead of a
  suiteOutput() that only ever took "specs".

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(e2e): don't count the page load against gotoHydrated's waits

The /api/permissions/me and login-form waits are armed before page.goto,
so their 5s local action timeout also covered the navigation, and a slow
page timed out before the request was sent. The test's own timeout now
bounds them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(e2e): replace the environment module with plain reads

With every variable defaulted, the parser, its aggregated error and the
e2eEnv fixture guarded against mistakes that can barely happen, and
Playwright reports the rest itself.

- playwright.config.ts loads e2e/.env with process.loadEnvFile (the
  shell still wins) and reads E2E_BASE_URL; support/auth.ts reads the
  accounts into ACCOUNTS. Specs that need the URL use the baseURL
  fixture.
- E2E_WORKERS goes: `--workers N` already does that.
- Drop the e2eEnv fixture, its ESLint import ban and the empty-pattern
  exception it needed, and trim .env.example.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* build(e2e): typecheck the suite with tsconfig.node.json

e2e/tsconfig.json was a looser copy of the Node config: it lacked
noUncheckedIndexedAccess and exactOptionalPropertyTypes, so specs/ and
setup/ escaped flags the rest of the frontend, and the e2e support files
through playwright.config.ts, already obey. The suite runs in Node, so
it joins tsconfig.node.json, and typecheck:e2e goes with its config.
The specs needed no changes under the stricter flags.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(e2e): trim the ESLint config and the app-error guard's opt-out

- Drop the Node globals block: typescript-eslint turns no-undef off for
  .ts files, so it changed nothing.
- Drop no-skipped-test's allowConditional: nothing in the suite skips.
- Fold the type-info, floating-promise and no-API blocks into one, and
  move the e2e/.output ignore to the base config's generated-output list.
- Remove failOnAppErrors and E2EOptions: nothing opts out of the guard.

Every remaining rule still fires on a probe spec.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* docs(frontend): shorten the test:e2e command note

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* build(frontend): copy assets with cp -R in build:preview

Also puts a comma in the test:e2e command note.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(e2e): one set of timeouts, and treat empty variables as unset

- Local runs used 3-10s timeouts against CI's 10-45s, so slow pages on
  a large dev library failed locally while CI passed. Both now use the
  CI values; a debugger still turns them off.
- An empty E2E_BASE_URL left baseURL as "" while still starting the
  server, and an empty account variable signed in as "". Both fall back
  to their defaults now.
- Set the Desktop Chrome device once, point the slow-test comment at
  test.slow(), and anchor the setup project's testMatch.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(e2e): apply code-review findings

pr-ready step 2 (code-review xhigh --fix):
- fall back to E2E_PASSWORD, which the seed script uses, for both accounts
- name the cause when the library has no platform or game to click
- read PWDEBUG=0/false as off, as Playwright does
- widen the API-call lint ban to any uncalled `.request` and its import
- compare the signed-in username case-insensitively
- only allow adminOnly with a URL, so the viewer 404 check always runs
- fix the README grep recipe and the recorded-spec location
- Object.hasOwn in seedUiState, ROLES in role.spec, shorter comments

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(e2e): apply simplify findings

pr-ready step 3 (simplify):
- one home for the login-form and signed-in-user locators
- derive ROLES and STORAGE_STATE from ACCOUNTS
- openMediaSubtab returns the panel; upload helpers take a scope
- menuLabels reads the panel openMoreMenu returns
- seed the UI state in login.spec's beforeEach
- one no-restricted-syntax entry for the API-call ban
- one port constant in playwright.config.ts
- drop .gitignore entries for paths nothing writes any more

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* docs(e2e): trim two long comments

pr-ready step 4 (review-polish).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* docs(e2e): plainer README opener and comments

pr-ready step 5 (humanizer).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* refactor(e2e): role selectors, one first-game lookup, shared route scopes

- Select by role and label: the account menu's name ("Account menu for
  <user>") replaces the user-name span, the Login button the login form's
  class, the "Page not found" heading the 404 class, and the subtab rail's
  tablist role the subtab button class.
- library.setup.ts clicks through to the first game once per run and saves
  its URL; specs open it with gotoFirstRom() instead of clicking through
  /platforms in every test. loads.spec keeps the click-through.
- Move the router's route scope table to routeNames.ts as ROUTE_SCOPES, so
  loads.spec derives admin-only pages from it: a newly gated route gets the
  viewer 404 check unless it is listed in VIEWER_OPENS.
- `vite preview` serves frontend/assets through a sirv middleware, as the
  dev server and the Docker image do, so build:preview goes away.
- CI builds the frontend in the background while the backend is set up,
  and the Playwright webServer only runs `vite preview` on that build.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(v2): menuitem role on button menu items, tabpanel role on Media panels

- RMenuItem sets role="menuitem" on its button form too, not only on links,
  so every item in an RMenu is a menuitem. Stories give the items a
  role="menu" parent.
- SubtabNav takes an optional idPrefix that gives each rail tab an id and
  aria-controls. MediaTab uses it to make its sections tabpanels labelled
  by their tab; the small-screen sheet variant has no tabs, so its sections
  stay plain.
- The e2e specs read menu labels by the menuitem role and find a Media
  panel by its tabpanel name.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
2026-10-04 20:28:07 -04:00
renovate[bot]
a0fa9d43a8 chore(deps): update actions/upload-code-coverage action to v1.4.4 (#5105) 2026-10-04 10:01:20 -04:00
Sam Dornan
116732ff70 Split the frontend tsconfig into project references (#5057) 2026-10-02 19:20:36 -04:00
Sam Dornan
8e715926e9 ci: cache frontend node_modules and skip npm ci on a lockfile match (#5044) 2026-10-02 19:05:19 -04:00
Sam Dornan
4e3ac0c1d8 ci: grant issues: write to the build scan job (#4934) 2026-09-30 11:49:28 -04:00
renovate[bot]
9b57d834fd chore(deps): update github actions (#4910) 2026-09-29 02:06:34 -04:00
Georges-Antoine Assi
1be710d828 ci: sign without adding tags to either registry
Cosign signs on Docker Hub only, which stores the signature as an OCI
referrer. GHCR has no referrers API and would add a sha256-<digest> tag
per signature, so provenance attestations stay in GitHub's attestation
API, where gh attestation verify finds them for either registry.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 17:08:44 -04:00
Georges-Antoine Assi
37e26e5460 ci: keep nightly signing off the registries
GHCR has no OCI referrers API, so every pushed signature or attestation
lands under a new sha256-<digest> tag, which piles up with a nightly.
Nightly now only records the provenance attestation in GitHub's API,
which still exercises the OIDC and attestation path every day.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 16:56:57 -04:00
Georges-Antoine Assi
446f7aeb45 ci: make scan re-runs work and log the ClamAV signature version
upload-artifact refuses an existing name, so re-running a scan job that
failed at the critical gate failed at the upload instead. The malware
summary now records which signature version ran, so a stale fallback
after a failed freshclam is visible.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 16:50:52 -04:00
Georges-Antoine Assi
b73e372d36 ci: trim the critical gate comment (review-polish)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 16:40:45 -04:00
Georges-Antoine Assi
cf873110da ci: simplify image signing and scan jobs (simplify)
- Sign and attest per variant through a matrix instead of paired steps.
- Read the index digest back from the GHCR tag, not the first Docker Hub one.
- Drop the name= prefixes from IMAGES so the sign loop uses it as is.
- Let Trivy gate on criticals itself instead of parsing SARIF message text.
- Export both platforms in one malware job per image, so freshclam runs once.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 14:54:18 -04:00
Georges-Antoine Assi
69c72ffe2a ci: move image signing into its own job (code-review)
A Sigstore or registry failure while signing no longer skips the scan of an
already published image. Grants artifact-metadata: write so the attestation
storage records are created.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 14:50:20 -04:00
Georges-Antoine Assi
6d21380545 ci: sign release images, gate on critical CVEs and scan for malware
- Sign each pushed index with keyless cosign in both registries and attach
  a GitHub build provenance attestation.
- Keep the Trivy SARIF as a 90-day artifact, since code scanning rejects
  tag refs, and fail the scan on fixable critical vulnerabilities.
- Add a ClamAV pass over the exported filesystem of every scanned image,
  on both platforms.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 14:27:48 -04:00
Sam Dornan
f6a919e11c ci: coverage upload, Docker PR check, API type drift check and other CI maintenance (#4875) 2026-09-28 11:29:26 -04:00
Sam Dornan
ed405495b0 chore(trunk): upgrade plugins and linters, automate upgrades, scan all files weekly (#4870) 2026-09-28 10:23:42 -04:00
Sam Dornan
fc9278f7f4 ci: cache mypy between runs and install only Playwright's headless shell (#4873) 2026-09-28 10:12:09 -04:00
Georges-Antoine Assi
0fe3b356b6 Merge pull request #4731 from rommapp/claude/docker-dev-rolling-tag-dmqssl
ci: nightly image, index annotations and SBOMs
2026-09-26 10:14:20 -04:00
Georges-Antoine Assi
2c9e861b1e refactor(ci): derive the build channel once and share tag lists (simplify)
A workflow-level CHANNEL replaces the scattered event-name checks and
the build-only CACHE_SCOPE. The image and tag lists, repeated in all
four metadata steps, move to workflow env, and the index annotation
level is set once on the merge job.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 09:56:36 -04:00
Georges-Antoine Assi
468414f664 fix(ci): drop empty version labels and skip the nightly on forks (code-review)
metadata-action renders `{{version}}` in custom labels and annotations
as empty, overriding its own correct version label, so those entries
are removed and the shared title/description/licenses live in one
OCI_METADATA env. The scheduled run is limited to rommapp/romm, and
the compose note says `latest` won't start after a nightly migration.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 09:54:41 -04:00
Georges-Antoine Assi
ae7b1cb22b ci: build the rolling master image nightly and tag it nightly
A cron run replaces the per-push build, so the tag is renamed from
`edge` to `nightly` (and `nightly-slim`), using metadata-action's
`type=schedule`. The version string becomes `nightly-<short sha>`.
The concurrency guard is dropped since scheduled runs can't overlap.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 08:06:17 -04:00
Sam Dornan
2c71226887 ci: run mypy in its own workflow instead of through Trunk (#4724) 2026-09-25 21:37:01 -04:00
Georges-Antoine Assi
f6607c8ede Merge pull request #4537 from rommapp/renovate/major-mariadb
chore(deps): update mariadb docker tag to v13
2026-09-24 10:31:24 -04:00
Sam Dornan
daf818c5f4 ci: annotate image indexes and attach SBOMs
- The multi-platform index now carries the OCI annotations (version,
  title, description, licenses, plus metadata-action's revision, source
  and created). Labels only live in each platform's image config, so
  GHCR showed no description for the package.
- Labels drop the literal quotes metadata-action kept in their values,
  and the licence is the SPDX id AGPL-3.0-only. The description has one
  home in the workflow env.
- Both builds attach an SBOM attestation alongside the default
  provenance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01817LYuBpFBV5Pi6VEcKfFZ
2026-09-23 10:47:37 +00:00
Sam Dornan
7ddf718e94 ci: publish edge as a single rolling tag
A history of per-commit edge tags isn't needed; the image still reports
edge-<short sha> as its version, and older builds stay reachable by
digest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01817LYuBpFBV5Pi6VEcKfFZ
2026-09-23 10:47:02 +00:00
Sam Dornan
291f68aa18 ci: publish a rolling edge image from master
Every push to master builds and pushes rommapp/romm:edge (plus
edge-slim, edge-<sha> and edge-<sha>-slim) to Docker Hub and GHCR,
reusing the release build, merge and scan jobs. Release tagging is
unchanged: the semver rules emit nothing on a push and the edge rules
nothing on a release.

- Concurrency cancels a superseded edge build so an older commit
  cannot land on the tag last.
- Edge reads the release layer cache but writes its own scope, so
  master layers never seed a release image.
- The baked version is edge-<short sha>, which keeps version-keyed
  caches (ROM filter values) fresh between edge builds and makes bug
  reports identifiable. The v2 version display links it to the commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01817LYuBpFBV5Pi6VEcKfFZ
2026-09-23 10:43:29 +00:00
Georges-Antoine Assi
e16520168b ci: review-polish, say the weekly run rescans latest
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-22 19:26:08 -04:00
Georges-Antoine Assi
bf77205b7a ci: simplify pass, drop the duplicated rescan rationale from build.yml
The why already lives next to the cron in image-scan.yml.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-22 19:25:31 -04:00
Georges-Antoine Assi
148dd41a51 ci: apply code-review fixes to the image scan workflow
- Set limit-severities-for-sarif, since trivy-action otherwise unsets the
  severity filter for SARIF output and every severity was reported.
- Key the code scanning category by image ref, so a dispatched scan of an
  older tag can't replace the analysis of latest.
- Validate and compact caller-provided JSON before writing it to outputs.
- Correct the build.yml comment: the weekly run rescans latest only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-22 19:24:09 -04:00
Georges-Antoine Assi
1e03363816 ci: clear the Trunk findings on the image scan workflows
aquasecurity's IP allow list rejects GitHub API calls from hosted
runners, so pinact 403s verifying the trivy-action tag comment. A
.pinact.yaml rule skips verification for aquasecurity actions only once
they are pinned to a full SHA, so an unpinned ref is still flagged.

zizmor (enabled on master) wants the $/ self-repository syntax for the
reusable workflow call, but actionlint 1.7.12 rejects it, so the finding
is suppressed inline for now.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-22 17:46:55 -04:00
Georges-Antoine Assi
47fd91904e Merge remote-tracking branch 'origin/master' into claude/scan-published-images
# Conflicts:
#	.trunk/trunk.yaml
2026-09-22 17:28:14 -04:00