Commit Graph

170 Commits

Author SHA1 Message Date
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
Georges-Antoine Assi
4aff9675b0 Merge pull request #4660 from rommapp/claude/enable-semgrep-zizmor
chore(security): harden Actions and Renovate, credit Socket in the readme
2026-09-22 13:39:55 -04:00
Georges-Antoine Assi
a5b51e772a Merge pull request #4592 from rommapp/claude/harden-image-and-workflow-permissions
fix(security): patch OS packages in the published image and scope workflow permissions
2026-09-22 08:13:40 -04:00
Georges-Antoine Assi
836d88ad64 Merge pull request #4575 from andest01/chore/vite-config-ts
chore: expand ts typecheck to `frontend/scripts/**/*.ts`
2026-09-22 08:09:49 -04:00
Georges-Antoine Assi
b2d5ffb4b4 chore: split the scripts typecheck into its own script
Keep `typecheck` to vue-tsc and move the tsconfig.node.json pass to
`typecheck:scripts`, run as a separate CI step so a failure names the
pass that broke. Drop the JSON-invalid comments from tsconfig.node.json.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-22 07:41:36 -04:00
Georges-Antoine Assi
b2cde9406f ci: scan the published Docker images for vulnerabilities
Nothing looked at the image we ship. The lockfile scanners in Trunk cover
Python and npm dependencies, but the Alpine base, nginx, valkey and the
runtimes copied in from the emulator stage reach users unexamined.

Adds a reusable Trivy scan of a published tag, called from the release
build for both variants and run weekly against latest, since most
vulnerabilities in an image are disclosed after it was built. Results go
to the job summary always, and to code scanning when the run sits on a
branch (the API rejects the tag ref a release run carries).

Report-only on purpose: a CVE published the day after a build must not
fail a release.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-21 22:08:19 -04:00
renovate[bot]
80b8335139 chore(deps): update astral-sh/setup-uv action to v10.2.0 2026-09-21 20:06:09 +00:00
Georges-Antoine Assi
76fd21d9a6 ci: enable zizmor and fix its findings
Adds zizmor to Trunk, which audits GitHub Actions workflows, and clears
the 19 findings it reports:

- Every actions/checkout now sets persist-credentials: false, so the
  token stops being written into .git/config where any later step (or
  an uploaded artifact) could read it.
- Service ports and the release version move from run-block template
  expansions into env vars, keeping expansion out of the shell.
- Frontend Checks drops read-all for the contents: read it actually
  needs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-21 07:30:56 -04:00
Georges-Antoine Assi
43ad55624b fix(docker): keep the release cache from serving a stale apk upgrade
Release builds import a persistent registry cache, and an `apk upgrade` off a
fixed base digest has no changing input, so the layer would be reused from a
previous release and reship its package set.

`no-cache-filters` forces both upgrade stages to run on every release. The
Python-side upgrade moves into its own `python-runtime` stage so that busting
it does not also rebuild the venv and the sigil bindings.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 13:18:51 -04:00
Georges-Antoine Assi
cdbc33f65f chore(ci): scope workflow permissions to what each job actually uses
`read-all` grants the token read on every scope, not just the one a job
needs, so replace it with `contents: read`. The job-level `checks: write` and
`pull-requests: write` in typecheck, pytest and migrations were writes no
step makes; trunk-check keeps `checks: write` for its annotations, and
update-hltb-api-url moves its write scopes down to the job that opens the PR.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 13:08:16 -04:00
renovate[bot]
d8e482034d chore(deps): update mariadb docker tag to v13 2026-09-16 15:05:46 +00:00
renovate[bot]
0249a164d8 chore(deps): update docker/setup-buildx-action action to v4.4.1 2026-09-16 08:51:38 +00:00
zurdi
a81cbc2f59 ci: fetch the base branch with history in the v1 freeze check
The shallow fetch left origin/<base> without a merge base against the
PR head whenever the base branch had moved on, so the check died with
"no merge base" before it could evaluate the diff or the bypass label.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XXrMndq8eYexafm6nhajLo
2026-09-16 00:05:37 +02:00
Georges-Antoine Assi
3bafae8286 Merge remote-tracking branch 'origin/master' into claude/bump-uv-0.12.13
# Conflicts:
#	docker/Dockerfile
2026-09-15 09:30:31 -04:00
renovate[bot]
cf770354a2 chore(deps): update github actions (#4513) 2026-09-15 06:54:07 -05:00
Sam Dornan
c4a36aa023 ci: gate the preview-build report job on the build-preview label (#4475)
The workflow triggers on `pull_request: types: [labeled]`, so adding any
label starts a run. `prepare`, `build` and `merge` are each gated on the
`build-preview` label and are skipped without it, but `report` was gated
only on the event type, so it ran and read `needs.merge.result` of
`skipped` as a failure. Every PR that received any other label got a
false "Preview build failed" sticky comment.


Claude-Session: https://claude.ai/code/session_01YBBbdsDv9BiYJnKwcCGE6A

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 17:19:37 -05:00
Georges-Antoine Assi
2455969182 chore(ci): drop the docs and website release triggers
Docs and the marketing site are released by hand now, so the
trigger-docs-and-web job no longer has a job to do. Removing it also
retires the last use of the DOCS_PAT secret, which can be revoked.

The workflow name loses its "and Trigger Docs/Website" half, since
building and pushing the image is all it does.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-13 07:48:26 -04:00
Sam Dornan
d04235f54e test(uv): drop the packaging import and run the guard on Dockerfile edits
packaging was imported but never declared, so the guard rode on whatever
pytest and gunicorn happened to pull in and a dependency update could have
broken collection. Since required-version has to be an exact pin, comparing
the strings is enough and needs nothing beyond the standard library.

pytest only triggered on backend, pyproject, the lock and the Python
version, so a change to either Dockerfile pin skipped the guard entirely.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HDXxq3vAxJVGhm1pQuK8V7
2026-09-12 01:11:12 +00:00
Sam Dornan
a34524c7b9 chore(uv): pin the uv version from pyproject and freeze CI syncs
The uv version lived only in the Dockerfile, while CI let setup-uv install
whatever was latest, so the image and CI could build against different
versions. Declaring required-version gives both a single source: setup-uv
resolves from it with no workflow input, and the image build's uv sync
refuses to run when its pinned UV_VERSION falls outside it.

CI also synced without --frozen, so it was free to re-resolve rather than
consume the committed lock the way the image does. A lock the image build
could not use would have passed CI.

The build-time check only runs on a real image build, which is label-gated
rather than part of every CI run, so a test asserts the two agree.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HDXxq3vAxJVGhm1pQuK8V7
2026-09-12 00:43:54 +00:00
Sam Dornan
aef5da4d9b ci: run trunk check on master pushes (#4457) 2026-09-11 10:01:05 -05:00
Sam Dornan
01e28459a5 ci: pin the amd64 image build to ubuntu-24.04 (#4458) 2026-09-11 09:59:06 -05:00
renovate[bot]
eccacaabc9 chore(deps): update github actions (#4445) 2026-09-10 21:49:58 -05:00
renovate[bot]
df8429a7d6 chore(deps): update postgres docker tag to v18 (#4444) 2026-09-10 21:27:17 -05:00
renovate[bot]
6d914f6d0e chore(deps): update astral-sh/setup-uv action to v10.1.0 (#4440) 2026-09-10 21:26:40 -05:00
Sam Dornan
1608a8964b ci: build each arch on a native runner and cache layers (#4437) 2026-09-10 20:41:56 -05:00
Sam Dornan
7b72b4d130 ci: align and manage the Docker service image pins (#4433) 2026-09-10 19:53:23 -05:00
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
Zurdi
473526fc47 Merge pull request #4357 from sdornan/fix/zip-undecodable-compression-7zz
fix(hashing): read zips zipfile can't decode through 7zz
2026-09-06 13:52:16 +02:00
Georges-Antoine Assi
4a246a9c22 ci: set up Python through uv everywhere
i18n.yml was the only workflow reaching for actions/setup-python; the
other five use uv. Both locale checks are stdlib-only, so run them with
`uv run --no-project` rather than resolving the backend project.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-05 21:54:39 -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
13f8095f0a test(hashing): cover the 7zz fallback with a real PPMd zip
The unit tests stamp PPMd onto a stored zip and mock 7zz, which proves the
dispatch but not that 7zz can read such an archive. This adds an
integration test that has 7zz write a genuine PPMd zip next to a stored
.cue, checks zipfile refuses it, and compares the member hashes the reader
yields against hashes of the source files. CI installs 7zip so the test
runs there; it skips where 7zz is absent.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-05 08:49:40 -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
2a7953ed58 refactor: share the HLTB search wire contract with endpoint discovery
The discovery script imported build_search_payload from hltb_handler, which
pulls in handler/metadata/__init__ and so instantiates every metadata handler,
opens Redis and writes a config file at import time. That import side effect is
why the workflow needed a dummy ROMM_BASE_PATH.

The script also hand-forked the rest of the protocol (base headers, the /init
mint, the session headers and the honeypot body merge), so it validated a
candidate route against a copy of what the handler sends rather than against
the real thing.

Move the contract into utils/hltb_search.py, a leaf module both sides import,
and drop ROMM_BASE_PATH from CI.

Pace failed session mints too: _ensure_session retried on every lookup, so a
down or IP-blocking HLTB cost each ROM in a scan its own rate-limited /init
round trip.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 08:31:14 -04:00
Georges-Antoine Assi
eb22ce3ca5 ci: silence the checkov secret false positive on the HLTB workflow
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-29 08:09:06 -04:00
Sam Dornan
d2fafaa089 fix: validate the search contract during HLTB endpoint discovery
Minting a session only proved a candidate route was session-backed, not that it
answers the search the handler sends. A future session-minting route sorting
ahead of the game-search route would have been published on that evidence alone,
leaving installs without completion metadata until the fixture was corrected.

Discovery now completes the real exchange: it mints a session, POSTs a search
with it, and requires the HLTB game shape that search_games() reads back. The
payload is no longer duplicated for the check, it moves to build_search_payload()
so the handler and discovery send the same body.

Also fixes the workflow being unable to run this script at all. It imports the
backend config, which raises unless ROMM_AUTH_SECRET_KEY is set, and the workflow
set no environment, so every run (including the manual dispatches) died at import
before reaching any HLTB logic. That is why the fixture drifted from May despite
the workflow existing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-26 14:35:13 -05:00