Commit Graph
115 Commits
Author SHA1 Message Date
Georges-Antoine AssiandClaude Opus 4.7 783d9a257e test(backend): cover artwork upload validation for roms and collections
Adds rejection + acceptance tests for update_rom, add_collection, and
update_collection artwork uploads, mirroring the existing avatar tests:
non-image content returns 400, and a real PNG uploaded under a misleading
filename like payload.html is stored with the trusted .png extension.

Also fixes two `return HTTPException(...)` → `raise` in raw.py so the 404
path actually surfaces instead of silently returning the exception object.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 09:37:44 -04:00
Georges-Antoine AssiandClaude Opus 4.7 53f14f5710 fix(backend): validate uploaded images with libmagic before storing
Avatar, ROM artwork, and collection artwork uploads now sniff the file
header with libmagic and reject anything that isn't PNG/JPEG/WebP/GIF,
saving the file with an extension derived from the detected MIME rather
than the user-supplied filename. Pairs with the raw asset endpoint,
which decides inline vs attachment from the on-disk extension.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 09:18:02 -04:00
copilot-swe-agent[bot]andgantoine ee1faf363c fix: update test mocks to use job.id attribute instead of get_id()
Agent-Logs-Url: https://github.com/rommapp/romm/sessions/f053983a-ae39-44b3-a59d-083d65f2055d

Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
2026-04-29 19:57:57 +00:00
Georges-Antoine Assi c2d6b08a6b Merge pull request #3293 from rommapp/copilot/fix-update-tags-metadata
feat: open refresh metadata dialog with scan type and metadata source selection
2026-04-20 21:57:29 -04:00
Georges-Antoine Assi ac45d1a32f changes from bot review 2026-04-20 21:51:30 -04:00
Georges-Antoine Assi 98f1d65a7c fixes 2026-04-20 21:36:59 -04:00
zurdiandClaude Opus 4.7 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
SpinnichandClaude Sonnet 4.6 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
SpinnichandClaude Sonnet 4.6 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
SpinnichandClaude Sonnet 4.6 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
SpinnichandClaude Sonnet 4.6 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]andgantoine 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]andgantoine 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]andgantoine 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]andgantoine 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]andgantoine 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]andgantoine 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]andgantoine 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