109 Commits

Author SHA1 Message Date
zurdi
d7a896b5da
fix: re-parse tags from filename when renaming a rom
Renaming a rom via PUT /roms/{id} only updated fs_name and its
derivatives, leaving regions/languages/tags/revision/version stale
against the new filename. Re-parse them whenever fs_name changes so
edits like "patapon (Fr En)" -> "Patapon (Fr, En)" are reflected in
the database.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 22:23:33 +00:00
Spinnich
14342b5726 fix(tests): use client.request(\"DELETE\") to send JSON body in tests
Starlette's TestClient (httpx-based) does not expose body kwargs on the
delete() convenience method; client.request(\"DELETE\", ..., json=...) is
the correct approach. Also switch datetime.utcnow() to
datetime.now(timezone.utc) to silence Python 3.13 deprecation warnings.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 21:02:26 -04:00
Spinnich
9aab88ad8b fix(tests): fix remaining DELETE body and timestamp comparison issues
- Switch content= to data= for DELETE requests (Starlette TestClient is
  requests-based and does not accept content= keyword argument)
- Fix test_bumps_updated_at to record time before the API call and use >=
  comparison, avoiding false failures when MariaDB truncates DATETIME to
  whole seconds and creation/update land in the same second

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 20:53:57 -04:00
Spinnich
fae6d869f1 fix(tests): correct test failures in collection endpoint tests
- Replace client.delete(json=...) with content=json.dumps()+Content-Type header
  (Starlette TestClient does not forward json= on DELETE requests)
- Adjust duplicate-name test to expect HTTP 500 matching CollectionAlreadyExistsException
- Add description="" to collections created without it to satisfy Pydantic schema
- Strip tzinfo before comparing updated_at to avoid offset-naive/aware TypeError

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 20:43:12 -04:00
Spinnich
1c9f010918 Fix isort import ordering in test_collection.py 2026-04-14 20:33:45 -04:00
Spinnich
4cc0c868b7 Fix linting and formatting issues from trunk CI 2026-04-14 20:27:45 -04:00
Spinnich
2ecefa3d3f Fix race condition in collection and favorite rom membership updates
Replace full rom_ids list replacement with atomic POST/DELETE endpoints
that add or remove individual ROMs from a collection. This prevents
concurrent rapid clicks from overwriting each other (last-write-wins).

Also fix missing session.flush() in add_rom_user() and add collection
endpoint tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 15:08:53 -04:00
Georges-Antoine Assi
686c609b3a
Merge pull request #3155 from tmgast/feature/play-session-ingest
Add play session ingest for game time tracking
2026-04-11 11:23:02 -04:00
Georges-Antoine Assi
ccf5f656b7
Add if_not_exists/if_exists guards to all alembic add_column/drop_column ops 2026-04-09 22:50:07 -04:00
Georges-Antoine Assi
ae03b0b322
ingest playtime with sync sessions 2026-04-06 21:32:13 -04:00
Georges-Antoine Assi
e5cb29ae80
Merge branch 'master' into feature/play-session-ingest 2026-04-06 12:42:15 -04:00
Georges-Antoine Assi
21eee327b0
Merge branch 'master' into save-sync 2026-04-06 09:09:53 -04:00
Georges-Antoine Assi
af69630481
more self review 2026-04-05 23:17:57 -04:00
Georges-Antoine Assi
fafb804bc6
mega cleanup 2026-04-05 22:35:37 -04:00
Georges-Antoine Assi
a61ff81e22
Merge branch 'master' into gamelist-customize 2026-04-05 22:11:02 -04:00
Georges-Antoine Assi
f2e8e337b2
Merge branch 'master' into save-sync 2026-04-05 21:47:53 -04:00
Georges-Antoine Assi
ef35ecaea9
props rom updte endpoint 2026-04-04 14:16:00 -04:00
Georges-Antoine Assi
494af9e4c8
Merge pull request #3217 from rommapp/copilot/fix-get-api-tasks-status-error
Fix GET /api/tasks/status 500 on expired job TTL (NoSuchJobError)
2026-04-03 14:37:21 -04:00
Georges-Antoine Assi
dbb3b9e469
run trunk fmt 2026-04-03 14:23:45 -04:00
copilot-swe-agent[bot]
674061c1d3
fix: narrow OSError catch and clean up test mock
Agent-Logs-Url: https://github.com/rommapp/romm/sessions/303f2c27-6b65-41a9-b201-c055142b1edb

Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
2026-04-03 17:31:14 +00:00
copilot-swe-agent[bot]
394799d7c3
fix: wrap empty parent dir cleanup in try-except and add test coverage for it
Agent-Logs-Url: https://github.com/rommapp/romm/sessions/303f2c27-6b65-41a9-b201-c055142b1edb

Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
2026-04-03 17:28:50 +00:00
copilot-swe-agent[bot]
e540d7c1a2
fix: handle nested ROM directories in delete endpoint and reorder FS/DB operations
Agent-Logs-Url: https://github.com/rommapp/romm/sessions/303f2c27-6b65-41a9-b201-c055142b1edb

Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
2026-04-03 17:26:22 +00:00
copilot-swe-agent[bot]
789f8d4e31
fix: handle NoSuchJobError in get_tasks_status when job TTL expires
Agent-Logs-Url: https://github.com/rommapp/romm/sessions/bc0915c3-2d5f-4ac1-ab89-24942eeac825

Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
2026-04-03 17:22:58 +00:00
Georges-Antoine Assi
ceddf2f9e9
changes from bot review 2026-04-03 11:24:02 -04:00
Georges-Antoine Assi
ec8583016b
mega ton of fixes for 4.8 2026-04-03 10:54:31 -04:00
Vargash
2b17da0c6c fix: manage the new export.gamelist.media configs via _update_config_file 2026-03-31 15:29:23 +02:00
Georges-Antoine Assi
4c97eddfc3
fix trunk check 2026-03-22 16:30:14 -04:00
nendo
75302ed59a Add play session ingest for game time tracking
Backend API for collecting and querying play sessions, modeled after
the Argosy session data format. Clients submit batches per device,
recording both the session window and screen-on time.
2026-03-22 20:22:55 +09:00
nendo
c59ea7790c test: add coverage for sync session handler, sync watcher, device masking, and auth utils
- test_sync_sessions_handler: increment_operations_completed (atomic
  counter, no-op on missing), NoResultFound on update/complete/fail
  with nonexistent session
- test_sync_watcher: _extract_device_and_platform path parsing (valid,
  non-incoming, too few parts, nested, outside base), _ensure_conflicts_dir
  creation and idempotency, process_sync_changes empty/disabled
- test_sync (endpoints): negotiate with untracked saves (no_op),
  server saves not mentioned by client (download), deleted-by-client
  detection (skip), complete on FAILED/CANCELLED session (400),
  trigger_push_pull passes session_id in enqueue kwargs
- test_device (endpoints): sync_config SSH credential masking
  (ssh_password/ssh_key_path -> "********"), null config passthrough,
  config without sensitive fields
- test_utils_auth: _get_device_name UA parsing (browser+OS, browser
  only, OS only, neither), create_or_find_web_device (creates new,
  returns existing on fingerprint match, updates last_seen)
2026-03-16 11:19:30 +09:00
Georges-Antoine Assi
55ca39cacb
fix deprecations in pydantic 2026-03-15 09:34:48 -04:00
Georges-Antoine Assi
ed6f9f5907
cleanup endpoint tests 2026-03-14 23:56:46 -04:00
Georges-Antoine Assi
b3fbbf59fb
add tests 2026-03-14 23:35:04 -04:00
Georges-Antoine Assi
ffbd997940
remove unused test 2026-03-12 23:14:17 -04:00
HydroSulphide
6a1c1597ce Fix: directly import constants from config and preventing silent fallback on wrong user input for env variable 2026-03-12 20:18:48 +01:00
HydroSulphide
48091225c7 Fix: imports in all test files with renamed constants 2026-03-12 20:04:19 +01:00
HydroSulphide
61c0d401d4 Fix: conftest.py now using the renamed constants 2026-03-12 19:55:50 +01:00
Georges-Antoine Assi
b1cd003625
run fmt 2026-03-11 22:27:33 -04:00
copilot-swe-agent[bot]
d45530cd8b Add typed RomUserData model for documented partial ROM user props update
Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
2026-03-12 01:41:10 +00:00
Georges-Antoine Assi
122cdf072d
fix tests 2026-03-11 20:52:23 -04:00
Georges-Antoine Assi
7961af6525
run fmt 2026-03-11 19:13:19 -04:00
copilot-swe-agent[bot]
24fe5b941f refactor: move get_pico8_cover_url to FSRomsHandler, use validate_path for safe path construction
Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
2026-03-11 22:17:22 +00:00
copilot-swe-agent[bot]
2958e6f12b feat: use PICO-8 built-in cover art from .p8.png cartridge files
Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
2026-03-11 02:35:18 +00:00
nendo
fb37c5cafe fix fork to match upstream changes and verify tests 2026-03-11 11:01:23 +09:00
nendo
ea5b7546aa refactor: address PR #3114 review feedback
- Use atomic getdel for pairing code exchange
- Add cascade="all, delete-orphan" to User.client_tokens
- Move generate/hash_client_token into AuthHandler as static methods
- Extract endpoint helpers to utils/client_tokens.py
2026-03-11 10:56:35 +09:00
nendo
bd5b3375f0 fix: remove unused User import and add i18n keys to all locales
Fixes trunk_check (unused import) and check-translations (missing
keys in non-en_US locales) CI failures.
2026-03-11 10:56:35 +09:00
nendo
e0b25fbc6c feat(client-tokens): add client API tokens with QR pairing flow
Long-lived, revocable, scope-restricted tokens for external clients
(mobile apps, retro handhelds, third-party tools). Includes:

- Backend: model, migration, DB handler, auth integration (rmm_ prefix
  routing in HybridAuthBackend), CRUD + pairing + exchange endpoints,
  rate limiting, scope intersection enforcement, admin oversight
- Frontend: settings page with token management table, stepped
  create/deliver dialog (config -> copy/pair), QR code with RomM logo,
  admin token table, standalone /pair page for QR scan landing
- /pair page supports custom-scheme callbacks for app deep linking,
  falls back to displaying code for manual entry
- 33 backend tests across 5 classes (CRUD, auth, isolation, pairing,
  admin)
2026-03-11 10:56:35 +09:00
Georges-Antoine Assi
f0e5abadc9
fix tests again 2026-03-10 09:23:12 -04:00
HydroSulphide
b9ea937373
Merge branch 'master' into fix-oauth-token-expiry-and-refresh-rotation 2026-03-10 08:51:44 +01:00
HydroSulphide
8758cb31b7 Tried to fix everything the bot complained about and the failed pytests.
Three tests were also implemented to check initial implementation that now invalidates expired access and refresh tokens and also rotating refresh tokens.

Since I introduced wrapper functions for create_oauth_token to distinguish between access and refresh token there is no need to set the token type in the data dict, since the type is now enforced in the wrapper functions create_access_token and create_refresh_token.

By convention I renamed create_oauth_token to _create_oauth_token as it is considered a private helper function now.
2026-03-10 07:22:02 +01:00
Georges-Antoine Assi
11c16e92bd
run fmt 2026-03-09 22:53:30 -04:00