- 06 Aug, 2026 7 commits
-
-
Aryan Noshirvani authored
Every existing test file mostly covered validation-shape (missing fields -> 422, unknown id -> 404) but not the actual success path with real dummy data, and auth.py's one "success" test just accepted any of [200, 400, 422, 500] since it hit the real Telegram API unmocked - not really testing anything. Went through every router and added the missing success-path coverage: - auth.py: mock telegram_auth/telegram_sync instead of hitting real Telegram; test request_code and login (including that login actually creates a User row), chats and chat-music with a real session header (previously only the 401-no-token cases existed). - discovery.py: /listen success path (mocked identify_audio, asserts a DiscoveredSong row is actually created) and the no-match case; /swipe success path (asserts `liked` is actually persisted, not just that invalid ids 404). - library.py: /library/stream and /library/lyrics had zero test coverage at all - added success + 404 + (for stream) file-missing- on-disk cases; /playlists/{id}/add success path (asserts the PlaylistTrack row actually exists, not just that invalid ids 404). - music.py: /music/upload success path - generates a real minimal MP3 at test time (mutagen rejects garbage bytes, so a fake byte string isn't enough here), mocks identify_audio, verifies the response metadata and that the tagged file actually lands in downloads/. - social.py: added the one endpoint with no test at all, /social/posts/{id}/tree (both the 404 and the with-children case). 44 tests total (up from 24), full run still ~1s since everything external is mocked - no real network calls anywhere in the suite. Co-Authored-By:Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
-
Aryan Noshirvani authored
Both /music/upload and /remix/{job_id} (fixed in the previous commit's diff already for remix.py) built their download_url from a hardcoded "http://91.234.52.134:8000" - meaning the dev instance (port 8001) was handing back main's port for files it had actually produced. It happened to still work, since both instances share the same physical /root/antigrav-stax-audio/downloads directory, but it's semantically wrong and would break the moment that's no longer true. Found via the same real-browser Playwright pass as the previous fix - the Tag & Identify panel's result audio player pointed at port 8000 while running against the port 8001 instance. Now derives the URL from request.base_url instead, so it always reflects whichever host actually served the request. Co-Authored-By:Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
-
Aryan Noshirvani authored
Root cause of the "failed to submit" report: identify_audio (real Shazam/AcoustID network calls) was running synchronously in the POST /remix request handler, once per uploaded file, before the response was ever sent. Confirmed via server logs that a single Shazam call takes ~30s to time out on a miss - with 2 files that's a minute-plus of the browser just waiting on fetch() with nothing to show for it, easily read as "broken." Moved identify_audio into the background job (render_remix_sync), where it belongs alongside the rest of the slow pipeline (BPM detection, Gemini planning, Demucs). The API handler now only does fast local I/O - save the uploads, create the job row, queue the background task, return immediately. Verified with a real headless-browser test (Playwright) driving the actual console UI end-to-end, not just curl/pytest against the API: submit now returns in well under a second and the job progresses through queued -> planning -> separating -> ... -> done while the page polls, exactly as designed. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
-
Aryan Noshirvani authored
The generic Swagger UI has no concept of "upload audio, get audio back" - every response was just a raw JSON blob with a download_url string you'd have to copy elsewhere to actually listen to. Built a small self-contained console (single HTML file, dark/neon theme matching the Flutter app's AppTheme) instead: - AI Remix panel: drag-and-drop up to 5 files, a prompt box, a live per-stage progress bar (queued -> planning -> separating -> mixing -> mastering -> tagging -> done) that polls GET /remix/{job_id}, and an inline <audio> player for the result plus the AI's actual plan (target BPM, which stems came from which song). - Tag & Identify panel: same idea for the single-file /music/upload flow. - A generic endpoint explorer below both, built dynamically from the live /openapi.json (grouped by router tag, expandable "try it" forms for path/query params and JSON bodies) so every other route - auth, discovery, library, social - is still reachable without hand-writing bespoke UI for each. Same HTTP Basic auth gate as before (verify_docs_auth on the /docs route); the console's own fetch() calls ride on the browser's cached Basic Auth for the origin, no extra plumbing needed. Co-Authored-By:Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
-
Aryan Noshirvani authored
- tests/test_remix.py: exercises the /remix API contract (validation, job bookkeeping, 404 for unknown jobs) with identify_audio and the actual render pipeline mocked out - deliberately not running real Demucs/Gemini in CI, that's proven manually above. - Removed test_music.py's test for the old /music/remix/batch mock stub, which no longer exists. - test_social.py used a hardcoded "valid_token_xyz" cookie that the previous commit's auth rework removed; switched it to HTTP Basic using the configured DOCS_USERNAME/DOCS_PASSWORD. - conftest.py sets safe default DOCS_USERNAME/DOCS_PASSWORD for the test run specifically, so tests don't depend on CI having real secrets configured. - .gitlab-ci.yml: install CPU-only torch before requirements.txt (otherwise pip pulls a multi-GB CUDA build for nothing), and run the test stage on pushes to dev too, not just main/merge_requests. - Adds the dev-instance systemd unit (deploy/systemd/, mirrors how stax_bot.service is tracked) for reference. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
-
Aryan Noshirvani authored
New POST /remix + GET /remix/{job_id}: takes 1-5 uploaded songs plus a natural-language prompt, runs it as a background job (RemixJob table tracks status/stage as it progresses), and returns a download URL when done. Pipeline: 1. Detect each song's BPM (librosa) and grab quick metadata via the existing Shazam/AcoustID identify_audio. 2. Ask Gemini to produce a structured remix plan - it hears a real ~25s preview of each song (not just title/artist text) plus the detected BPMs, and returns which stems to pull from which song, at what gain/pitch, a shared target BPM, and a master effects chain. This replaces the old ai_remix.py's approach of faking "stem separation" with a sox highpass filter while literally telling the AI it was using Demucs. 3. Actually run Demucs (real 4-stem separation: vocals/drums/bass/ other), cached on disk by file content hash so re-remixing the same song never reprocesses it. 4. Time-stretch selected stems to the shared target BPM (librosa phase vocoder), mix with per-song gain/pitch-shift, master with a pedalboard compressor + reverb chain, tag and export via the existing tag_and_convert_audio. Removes the old /music/remix/batch and /music/remix/status mock stubs in music.py (hardcoded fake job ids/progress) now that the real thing exists at /remix. This VPS's virtualized CPU exposes no SSE3/SSE4/AVX at all, which makes PyTorch's default oneDNN backend fail ("could not create a primitive") on Demucs's real-sized convolutions - a tiny toy conv works fine, which is what makes this easy to miss in isolation. torch.backends.mkldnn.enabled = False works around it. Also: Gemini calls need this box's HTTP(S)_PROXY set to reach the network at all (confirmed the already-running main branch's stax_backend.service has the same gap and is likely silently failing on Gemini calls in production right now - flagging separately, out of scope here). numpy is pinned <2 / scipy pinned to 1.13.1: numpy>=2's default wheels require the x86-64-v2 baseline and RuntimeError on import on this CPU. Tested end-to-end against two synthetic multi-tone MP3s: single-song "drop the vocals, slowed + reverb" and two-song "blend vocals of one over the drums of the other" both produced correct, tagged, playable MP3s (~75s for the two-song case, ~3s when stems were already cached). Co-Authored-By:Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
-
Aryan Noshirvani authored
Replaces the hardcoded plaintext admin/stax123 cookie-login flow with standard HTTP Basic Auth gating /docs and /openapi.json, credentials read from DOCS_USERNAME/DOCS_PASSWORD env vars (secrets.compare_digest, no fixed session-token bypass). The actual API routes' existing auth (used by the mobile app) is untouched - this only protects the interactive documentation surface. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
-
- 05 Aug, 2026 1 commit
-
-
Aryan Noshirvani authored
Missed in the previous reorg commit - byte-identical to src/api/main.py, nothing imports it, and the live service runs src.api.main:app. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
-
- 04 Aug, 2026 2 commits
-
-
Aryan Noshirvani authored
The previous commit moved bot.py/ai_remix.py into src/telegram_bot/ but missed staging the import-path fixes inside them, and the ExecStart in stax_bot.service still pointed at the pre-reorg antigrav-stax-audio path. Both were edited in the working tree already; this just gets them into the commit. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
-
Aryan Noshirvani authored
- Delete 18 files fully superseded by src/ (api_new/prod/remote*.py, root config/database/audio_processing/music_identification/ telegram_auth/telegram_sync/social.py duplicates, broken patch_*.py and update_database.py debug scripts that reference a nonexistent Mac path, dead test_api.py/test_gradio.py, and the redundant stax_bot.tar.gz backup of the same dead files) - Relocate bot.py + ai_remix.py into a new src/telegram_bot/ package and fix their imports to use src.core/src.services (the Telegram bot isn't wired into the live FastAPI app, but it's real unshipped functionality, not cruft - kept it, not deleted it) - Move one-off dev scripts (list_models.py, build_loops.py, and the manual smoke scripts test_mb.py/test_mutagen.py) into scripts/, renaming the smoke scripts so pytest's default test_*.py discovery never sweeps them up outside tests/ - Fold the misplaced-but-real test_social.py into tests/ (6 passing tests that weren't part of the actual suite) - Move stax_bot.service into deploy/systemd/ and fix its ExecStart (was pointing at a nonexistent telegram_client.py under a stale antigrav-stax-audio path) - Add .gitignore; untrack .env going forward (secrets remain in prior history - flagged separately, not rewritten here) - Rewrite README.md and setup.sh, which described/depended on the old flat api.py/bot.py architecture and the deleted tarball Full suite: 21/21 passing (up from 15 - gained test_social.py's 6). Live stax_backend service on this host untouched: same src/api/main.py entrypoint, same .env/stax.db on disk, still responding through the reorg. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
-
- 02 Aug, 2026 4 commits
-
-
Aryan Noshirvani authored
-
Aryan Noshirvani authored
-
Aryan Noshirvani authored
-
Aryan Noshirvani authored
-
- 01 Aug, 2026 19 commits
-
-
Aryan Noshirvani authored
-
Aryan Noshirvani authored
-
Aryan Noshirvani authored
-
Aryan Noshirvani authored
-
Aryan Noshirvani authored
-
Aryan Noshirvani authored
-
Aryan Noshirvani authored
-
Aryan Noshirvani authored
-
Aryan Noshirvani authored
-
Aryan Noshirvani authored
-
Aryan Noshirvani authored
-
Aryan Noshirvani authored
-
Aryan Noshirvani authored
-
Aryan Noshirvani authored
-
Aryan Noshirvani authored
-
Aryan Noshirvani authored
-
Aryan Noshirvani authored
-
Aryan Noshirvani authored
-
Aryan Noshirvani authored
-