Commit Graph

9 Commits

Author SHA1 Message Date
Georges-Antoine Assi
892657465f fix: stage the config fixture for e2e and address review findings
The e2e job copied only the fixture library, not the config.yml declaring its
platform-folder-first layout, so the seeder scanned an empty library.

Reject `.` and `..` template sections: no directory listing yields either, so a
template carrying one discovered nothing and marked the platform's roms missing.

Drop the cached `full_path` when either half is set. A scan reads it and then
renames the file in place, which left the cached pair stale.

Point `build_physical_fs_name` at the index 0126 actually creates.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-08 09:11:16 -04:00
Georges-Antoine Assi
2e90022dea fix(db): make virtual_collections and generated columns collation-agnostic
A MariaDB server configured with --character-set-server=utf8 makes the roms
table, string literals and JSON_TABLE columns utf8mb3, which breaks three
places that a default utf8mb4 server accepts:

- 0096/0101 pin `COLLATE utf8mb4_general_ci` on view output columns. An
  explicit utf8mb4 collation on a utf8mb3 value is rejected outright, so
  upgrading fails with "COLLATION 'utf8mb4_general_ci' is not valid for
  CHARACTER SET 'utf8mb3'". Each operand now goes through CONVERT(... USING
  utf8mb4) first, keeping the strong coercibility that 3758 needed.
- 0098 compares JSON_UNQUOTE output against string literals in NOT IN, REGEXP
  and NULLIF. JSON_UNQUOTE resolves under the connection charset while a
  literal in a generated-column expression takes the table's collation, so the
  two are an illegal mix. All of them now route through _maria_text, which
  wraps the value in CAST(... AS CHAR).

CI only ever exercised the default collation, so none of this was visible. The
migrations workflow now runs MariaDB as a matrix over utf8mb4_general_ci and
utf8mb3_unicode_ci. Service containers take docker create options and cannot
pass --character-set-server, so the server is started from a step instead.

MariaDB moves to 11.3.2 everywhere in CI, matching docker-compose. That image
dropped the mysqladmin symlink, so the service health checks move to the
image's own healthcheck.sh.

Verified on mariadb:11.3.2: alembic upgrade head reaches head under both
collations, and the generated_* columns and virtual_collections rows are
identical between them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-06 08:46:38 -04:00
Georges-Antoine Assi
a3aecdf045 chore(python): restore the C accelerators lost on 3.14
The runtime moved to 3.14 but the pinned versions did not, so packages
without cp314 wheels silently resolved to their pure-Python universal
wheels. Bump each to the first release that ships cp314 wheels, all
within the existing pyproject specs:

- SQLAlchemy 2.0.41 -> 2.0.52 (cyextension, and greenlet is back so
  sqlalchemy.ext.asyncio is functional rather than merely importable)
- multidict, propcache, frozenlist (aiohttp/yarl accelerators)
- wrapt 1.17.2 -> 1.17.3 (OpenTelemetry instrumentation proxies)
- coverage 7.9.2 -> 7.16.0 (CTracer, and CI runs the suite under --cov)
- mysql-connector-python 9.3.0 -> 9.7.0 (C extension protocol)
- debugpy 1.8.14 -> 1.8.21 (pydevd accelerators)
- pyinstrument 5.0.3 -> 5.1.3 (no longer compiled from sdist on every
  `uv sync --all-extras`, which broke the no-toolchain dev setup)
- anyio 4.9.0 -> 4.14.2, dropping a PEP 765 SyntaxWarning printed on
  every process start

Run pytest and the migrations workflow when the runtime or the lock
changes: nothing in the 3.14 bump lives under `backend/`, so neither
workflow triggered on it. `e2e.yml` already listed those paths.

Make `.python-version` the single home for the version: `uv python
install` and `actions/setup-python` both read it. In the dev Dockerfile
that also fixes the interpreter layer not being invalidated when the pin
changes, and the sigil install now derives site-packages from the venv.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-05 21:48:52 -04:00
Sam Dornan
3c547dfbd0 chore(python): move the backend to Python 3.14
Bumps the runtime everywhere it is pinned: requires-python, the
.python-version uv reads, both Dockerfiles (with the python:3.14-alpine3.23
and uv 3.14 image digests), the six workflows that install Python, and the
contributor docs.

Several locked C-extension versions had no cp314 wheels, so the Alpine
image fell back to building them from source and failed on the missing
C++ and Rust toolchains. Those packages are upgraded within their existing
pyproject ranges: pydantic 2.11.7 -> 2.13.5 (pydantic-core 2.46.5), uvloop
0.22.1, grpcio 1.83.1, httptools 0.8.0, inflate64 1.0.4, markupsafe 3.0.3,
pyyaml 6.0.3 and streaming-form-data 1.20.0. The lockfile also drops the
3.13-only resolution branches.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-05 08:57:10 -05:00
Sam Dornan
2539520de4 Bump GitHub Actions to Node 24 runtimes
GitHub is deprecating the Node 20 action runtime. Every third-party action
in the workflows was still pinned to a Node 20 release, so each is moved to
its latest release, all of which declare `runs.using: node24`:

- actions/checkout v4.3.x -> v7.0.1
- astral-sh/setup-uv v6.7.0 -> v10.0.1
- docker/login-action v3.5.0 -> v4.6.0
- docker/metadata-action v5.8.0 -> v6.2.0
- docker/build-push-action v6.18.0 -> v7.3.0
- docker/setup-qemu-action v3.6.0 -> v4.3.0
- docker/setup-buildx-action v3.11.1 -> v4.3.0
- actions/github-script v7.1.0 -> v9.0.0
- actions/upload-artifact v4.6.2 -> v7.0.1
- peter-evans/create-pull-request v7.0.11 -> v8.1.1
- trunk-io/trunk-action v1.2.4 -> v2.0.0 (its nested actions were on Node 20)

actions/setup-node and actions/setup-python were already on Node 24 but are
bumped to v7.0.0 as well, and the setup-node reference in the trunk
setup-ci composite action is now SHA-pinned like the rest.

None of the removed inputs, deprecated envs, or event-specific behavior
changes in the crossed major versions are used by these workflows.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-03 21:45:49 -05:00
Georges-Antoine Assi
7562195fc6 ci(e2e): stop the backend before post-job cleanup
setup-uv prunes the uv cache in its post-job hook whenever the cache key
misses, which happens on any change to uv.lock or pyproject.toml. The
backend is started with `uv run main.py` and left running, and `uv run`
holds the uv cache lock for its whole lifetime, so the prune blocks until
the runner kills cleanup at the 5 minute cap and the job fails with
`uv failed with exit code 2` despite every test passing.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 19:06:46 -04:00
Georges-Antoine Assi
474ef5b6e8 Move the e2e seed scripts to .github/scripts
They exist to stand up a disposable instance for the Playwright suite, so
they belong with the workflow that runs them rather than in backend/tools/
next to the library-generation utilities.

Their sys.path bootstrap now points at backend/ explicitly (it relied on
being one level below it), the workflow invokes them from the repo root
instead of backend/, and .github/scripts/** joins the workflow's path
filters so editing a seeder still triggers the suite.
2026-07-26 13:05:54 -04:00
Georges-Antoine Assi
395fe93912 cleanup 2026-07-26 12:56:16 -04:00
Georges-Antoine Assi
65425c1476 Run the e2e suite in CI
Adds .github/workflows/e2e.yml: MariaDB + Valkey services, migrations, an
offline library scan, the fixture users, the backend, then Playwright --
whose webServer starts the Vite dev server. DEV_PORT (5000) is both what
main.py binds and what Vite's /api proxy targets, so neither side needs
configuring. Report and test-results upload as an artifact on failure.

`tools/seed_e2e_library.py` scans backend/romm_test/library with an empty
metadata_sources list, so CI never reaches out to a provider. It exits
non-zero on an empty library rather than leaving a confusing Playwright
timeout later.

Also fixes the flakiness that a CI-shaped rehearsal exposed. Root cause was
not slowness: the Vite dev server force-reloads the page when it discovers a
new dependency to pre-bundle, wiping the half-filled login form so the submit
never lands. Defences are a passive warm-up pass in global-setup.ts (absorb
the reload before anything depends on the page, then compile the routes under
test) and a retry in login(). Two smaller real bugs fell out of the same
investigation: `button[type="submit"]` matched two elements, because the
collapsed reset-password form has its own, and the warm-up's best-effort
`.catch()` calls inherited a 120s timeout, making setup take 8 minutes.

Verified from a cold Vite cache against a throwaway database and the fixture
library: 15/15 pass, no flakes, 2.7 minutes.
2026-07-26 10:29:51 -04:00