- 09 Aug, 2026 3 commits
-
-
Aryan Noshirvnai authored
This GitLab instance rejected rules: with "unknown keys" - confirmed by origin/dev's own prior .gitlab-ci.yml (pipeline #1007) using only: and passing on this same server/runner. Reverting to the proven syntax. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
Aryan Noshirvnai authored
Reconciles the hardening/caching/deploy-pipeline work on this branch with the previously-unmerged remix engine, Pass-the-Aux room websocket infra, Channels router, and custom API console from origin/dev. Conflict resolution notes: - Kept the current JWT/session-based auth (src/core/security.py) over origin/dev's older session-string-header auth; adapted its unique test coverage (chats/music endpoint, discovery listen/swipe content paths, library search/stream/lyrics/ playlist content paths, remix-tree tests) to the current auth_as fixture instead of dropping that coverage. - Kept origin/dev's branded login-page + session-cookie docs auth (superset of the plain HTTP Basic version), and its recursive _build_remix_tree over a flat one- level version. - Replaced the stopgap _run_lightweight_migrations()/create_all-at-import-time in database.py with Alembic, which both sides now share as the single source of truth for schema; generated a new migration for the 7 tables origin/dev added (Correction, RemixJob, Channel, ChannelFollow, VibeSet, VibeSetTrack, AudioStory, ChannelShowcase). - Fixed a real bug surfaced by the merge: remix_engine.py and remix.py hardcoded /root/antigrav-stax-audio/* for stem cache/temp/downloads, a different directory than storage.py's LOCAL_STORAGE_ROOT-based paths that main.py's /downloads mount actually serves - remix downloads would have 404'd. Both now share storage.py's paths. - deploy.sh and .gitlab-ci.yml now install CPU-only torch and libsndfile1, needed by the remix engine's demucs/librosa dependency chain. - test_channels.py::test_showcase_owner_only still posted to /social/posts without auth headers; updated to use the auth_as fixture like the rest of the suite. 104 tests pass (up from 40 pre-merge + origin/dev's own suite, combined and de-duplicated). Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
Aryan Noshirvnai authored
- Extract auth/storage into src/core/security.py and src/services/storage.py, scope library/discovery/social routes to the authenticated user - Add IdentifiedTrack cache table keyed by audio fingerprint so repeat uploads of the same song skip Shazam/AcoustID/Gemini identification entirely; enable sqlite WAL mode so cache reads don't stall behind unrelated writes - Add Alembic migrations (baseline schema + identified_tracks) - Add pytest-mock to requirements.txt - was missing despite being used throughout the existing test suite via the mocker fixture - Rewrite deploy/scripts/deploy.sh to self-bootstrap a bare prod server (system packages, repo clone, venv, .env from CI-supplied secrets, systemd unit sync) and restart services on every deploy - Add .gitlab-ci.yml: test stage runs on dev/main pushes, deploy_prod runs only on main and SSHes into prod to trigger deploy.sh Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019i3NAUkLkHNbsPg5vKfzF9
-
- 07 Aug, 2026 1 commit
-
-
Aryan Noshirvani authored
-
- 06 Aug, 2026 20 commits
-
-
Aryan Noshirvani authored
GET /social/posts/{id}/tree only ever fetched one level of children - a remix of a remix wouldn't show up at all. Rewrote it as a proper recursive walk (_build_remix_tree), each node now nesting its own children the same way, all the way down. Depth-capped at 50 as a guard against runaway recursion on pathological/corrupted data, well beyond anything a real remix-of-a-remix chain would reach. Co-Authored-By:Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
-
Aryan Noshirvani authored
Per the original vision doc, Channels are the creator hub - users host Vibe Sets, Audio Stories, and remix showcases. This pillar had zero model, router, or definition beyond one paragraph before this commit. New models (src/core/database.py): Channel, ChannelFollow, VibeSet + VibeSetTrack (a curated, ordered song collection - same shape as the existing Playlist/PlaylistTrack pair, owned by a channel instead of a user), AudioStory (ephemeral - expires_at defaults to 24h from creation; expired stories are filtered out of the "active" listing rather than deleted, the same soft-expiry pattern this codebase already uses for DiscoveredSong's 24h history), and ChannelShowcase (pins an existing Post - i.e. an actual remix from the tree - to a channel). New router (src/api/routers/channels.py): create/list channels, get channel detail with follower count, follow/unfollow (idempotent), create/list vibe sets + get one with its tracks, create/list stories, showcase/list showcased posts. Vibe sets/stories/showcase are owner- only (403 for anyone else), matching the "creator hub" framing - followers can browse, only the owner publishes. Found and fixed a real SQLAlchemy bug while testing create_vibe_set: returning an ORM object after a *second* db.commit() (for the VibeSetTrack rows, after the VibeSet itself was already committed and refreshed) serialized as an empty {} with no error - SQLAlchemy's expire_on_commit default re-expires already-loaded objects on every commit, not just the one that touched them. A final db.refresh() right before returning fixes it. Caught by an actual assertion on the response body, not just a status-code check. Also added a route-ordering regression test: GET /channels/vibe-sets/ {id} must be registered before the generic /{channel_id} catch-all, or FastAPI matches "vibe-sets" against {channel_id}:int first and 422s instead of ever reaching the real route. Co-Authored-By:Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
-
Aryan Noshirvani authored
There was zero real-time infrastructure anywhere in this backend before this - LiveRoom only ever supported create/list. Added WS /social/rooms/{room_id}/ws: - Chat: broadcast to everyone in the room (including the sender - a simpler, more predictable rule than asymmetric exclusion; clients can dedupe by user_id if they update optimistically). - Reactions + a "fire meter":🔥 reactions accumulate into a count that decays over a 30s window (src/services/room_manager.py), so it reads as "how hot is it right now," not a lifetime total. - DJ handoff: request_aux queues a listener, pass_aux (DJ-only, an explicit rejection if a non-DJ tries) hands off to the front of the queue or a requested user_id. Confirmed via the actual LiveRoom.dj_id column, not just the in-memory session. - now_playing (DJ-only) updates LiveRoom.current_song_id live. - Presence (user_joined/user_left) and an initial state snapshot on connect (current DJ, current song, who's here, recent chat, fire count, queue) so a client joining mid-session isn't starting blind. Room state (connections, chat history, fire events, DJ queue) is in-memory and ephemeral by design (src/services/room_manager.py) - only dj_id/current_song_id persist to the DB, since that's the only part that should still be true if someone checks GET /social/rooms without being live-connected. An empty room's ephemeral state is discarded when the last person disconnects. Found and fixed a real deployment gap while verifying this against the actual running server rather than just the test suite: uvicorn had no WebSocket protocol implementation installed at all (no `websockets` or `wsproto` in requirements.txt) - Starlette's TestClient simulates WebSockets in-process and doesn't need one, so all 8 new tests passed happily while the real deployed server would have silently rejected every WebSocket connection. Added websockets>=13.0 to requirements.txt and confirmed a real end-to-end session (two live `websockets` client connections, not TestClient) against the actual running dev instance: chat, reactions, fire count, aux request/handoff, all working and persisting to the DB correctly. Co-Authored-By:Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
-
Aryan Noshirvani authored
HTTP Basic Auth's credential prompt is a browser-native dialog - there is no HTML/CSS control over it at all, so "make the login screen better" had nowhere to go under the previous setup. Switched to a proper login page (matching the console's dark/neon theme) backed by a random per-session cookie: - GET/POST /login: styled form, wrong credentials redirect back with an inline error instead of a blank 401. - Session tokens are secrets.token_urlsafe(32), tracked in an in-memory dict with a 24h expiry - not the old hardcoded "valid_token_xyz" bypass value this app used to ship with. - GET /logout clears the session and cookie. - HTTP Basic is kept as a fallback authentication path (checked alongside the session cookie) specifically so curl -u still works for scripted/API access - only interactive browser use needed the new login page, and this repo's own test suite and my own manual testing throughout this session both rely on curl -u. Added tests/test_docs_auth.py covering the full flow: redirect when unauthenticated, login page rendering, wrong-credential error redirect, correct-credential session + docs/openapi access, the Basic fallback, and logout. Also manually verified live against the running dev instance end-to-end with curl (cookie jar) before committing. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
-
Aryan Noshirvani authored
Completed remixes were only ever written to the RemixJob row and the downloads/ folder - invisible to /library, /social, and therefore to "remix trees" entirely. A remix created through /remix had zero connection to the rest of the app's social model. - /remix now accepts library_song_ids (comma-separated LibrarySong IDs) as an alternative/addition to uploaded files. Using a library song as a source is what makes tree linkage possible - a source with no existing library entry has nothing to link back to. Also accepts an optional user_id for attribution. - On completion, the engine now registers the output as a real LibrarySong (streamable, searchable, playlist-able, same as any other library entry) and creates a Post referencing it, so finished remixes actually show up in the social feed. - parent_post_id links to the first library-sourced input's most recent existing Post, if any - the schema only supports one parent per post (a tree, not a DAG), so with multiple library-sourced inputs only the first is represented as the "parent." - RemixJob gained result_song_id/result_post_id columns, surfaced in the GET /remix/{id} response once done. Added a lightweight automatic migration in database.py (create_all only creates missing tables, never ALTERs existing ones for new columns - this bit dev's own already-running database the moment these columns were added). Also fixed two real bugs hit while testing this end-to-end against the live Gemini API (not caught by mocked tests, since they're about the actual shape of model output): - gain_db came back as a per-stem dict ({"drums": -6.0, "other": 0.0}) instead of the single float the schema asks for, when a role listed multiple stems - added _coerce_gain_db to average/sanitize whatever comes back rather than assuming schema compliance is guaranteed even with response_mime_type=application/json. - Gemini occasionally returns syntactically invalid JSON outright (a missing comma mid-response) - added a 3-attempt retry around generation+parsing, the standard mitigation for this class of transient flakiness. Verified end-to-end against the real API: submitted a remix using two pre-existing library songs (one with an existing social Post), and confirmed GET /social/posts/{id}/tree shows the finished remix as a real child post with the correct caption and parent linkage. Co-Authored-By:Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
-
Aryan Noshirvani authored
src/telegram_bot/bot.py has called src.core.database.init_db() and log_correction() since before this session started - neither function existed anywhere in the codebase, not even in the original pre-reorg flat-file layout. The bot was never deployed, so this never surfaced, but it would have crashed immediately on first use. Implemented rather than just removing the calls, since they represent real intended behavior: - init_db(): idempotent wrapper around the table creation that already runs at module import time - a defensive check for the bot running as a standalone process that might start before the API ever has. - log_correction(): a new Correction model + write, recording a user's manual song-ID correction (picked from candidates, typed manually, or confirmed a Gemini guess) as a simple audit trail - what the call site's arguments (user_id, title, artist, source) clearly imply was the original intent. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
-
Aryan Noshirvani authored
Ports the same fix already tested and running on dev to main: - Removes the hardcoded plaintext admin/stax123 cookie-login flow and its fixed "valid_token_xyz" session-bypass cookie, replacing it with standard HTTP Basic Auth on /docs and /openapi.json, credentials from DOCS_USERNAME/DOCS_PASSWORD env vars (secrets.compare_digest). - Replaces stock Swagger UI with the custom branded console (dark/neon theme matching the Flutter app), minus the AI Remix panel - main doesn't have the /remix router, so that panel would just point at a 404. Kept the Tag & Identify panel (main's /music/upload is real) and the generic OpenAPI-driven endpoint explorer. Tested locally end-to-end before this commit: full test suite 21/21 green, and manually verified on a scratch port (401 with no credentials, 200 with correct ones, console renders without the remix panel, /openapi.json lists main's actual routes). Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
-
Aryan Noshirvani authored
Per direction: no Claude. Merged the two-step Gemini-describes/Claude- plans pipeline back into one Gemini call that both listens to every song's real audio preview and produces the full structured plan (sections, target key, sidechain, style) directly - simpler than two model calls, and the audio-perception advantage that motivated the two-step design in the first place only mattered when comparing against a text-only Claude call anyway. Tried gemini-2.5-pro for better reasoning first (background job, can absorb the latency) - live 429 confirmed this API key's free tier has a hard zero quota for -pro ("limit: 0", not exhausted), so reverted to gemini-2.5-flash, which the rest of this app already runs on successfully. Removed the anthropic dependency and ANTHROPIC_API_KEY entirely rather than leaving unused Claude plumbing around. Verified end-to-end against the real API: a "house remix with a big sidechain pump and a proper build-drop structure" request produced 5 real sections (intro/build/drop/breakdown/outro) with genuinely different stems active per section, sidechain enabled and targeting the correct song's drums, style set to house, and a valid ~9s tagged MP3 out the other end. Co-Authored-By:Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
-
Aryan Noshirvani authored
The old engine picked stems and slapped a static reverb+compressor on top for the full duration - "change pitch and speed and call it a day," per the ask. This is a genuine rewrite of the DSP core: - Real key detection (Krumhansl-Kessler chroma-profile correlation) replaces AI-guessed pitch shifts. Semitone shifts are now computed from actual detected keys, so combined stems from different songs are harmonically correct instead of an arbitrary number the model picked with no data behind it. - Section-based arrangement: the plan now describes real structure (intro/build/drop/etc.) with different stems active per section instead of one static combination playing for the whole duration. Every stem is stretched/pitch-matched once and cached in memory; sections slice and sum from that shared pool with short crossfades at boundaries. - Sidechain ducking: one song's drums can rhythmically duck everything else (the "pump" that makes a mix actually groove), via a vectorized lowpass-filtered envelope follower - not a per-sample Python loop, which would be far too slow on this CPU's unaccelerated math. - Style presets (lofi/trap/house) apply genre-appropriate processing chains instead of one generic effects chain for every request. Two-step AI pipeline, split by what each model actually can/can't do: Gemini listens to a real audio preview of each song and writes a text description (mood, energy, instrumentation) - Claude's API has no audio input at all, so this is the only way it gets that context. Claude then takes those descriptions plus real BPM/key data and the user's prompt and directs the actual arrangement: sections, target key, sidechain routing, style. Perception on Gemini, instruction- following and structured reasoning on Claude - not asking one model to do both. Needs ANTHROPIC_API_KEY to actually run plan_remix - not yet set in this environment, so the full pipeline is implemented and unit-tested but not yet verified end-to-end. All DSP pieces (key detection, semitone math, sidechain envelope, tiling) have deterministic unit tests against a committed fixture (tests/fixtures/tone.wav, plain numpy+soundfile, no ffmpeg dependency). Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
-
Aryan Noshirvani authored
Root cause of the reported polling failure: two remix jobs submitted close together both landed in separate_stems() around the same time and hung indefinitely - confirmed via direct DB inspection, both stuck at "separating" with zero progress and low process CPU for 30+ seconds straight, not just slow. Each call was also instantiating a brand new demucs.api.Separator (reloading model weights from disk) every single time, with no thread-safety guarantee from demucs/HF Hub's model caching under concurrent access - the likely deadlock source. Fixed by caching a single lazily-created Separator instance and wrapping all separation calls in a threading.Lock, so only one Demucs pass runs at a time process-wide; concurrent jobs now queue instead of racing. This VPS's CPU has no SSE3/SSE4/AVX and would thrash badly running two Demucs passes concurrently anyway, so serializing is also just the right call for this hardware, independent of the hang. Verified with two remix jobs submitted ~simultaneously via Playwright against separate browser contexts - both now complete cleanly instead of hanging. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
-
Aryan Noshirvani authored
The actual root cause of the CI-only 500, once the diagnostic from the last commit surfaced it: [Errno 18] Invalid cross-device link. This was never an environment/ffmpeg issue - it's a genuine pre-existing bug in tag_and_convert_audio. os.rename() (the rename(2) syscall) cannot move a file across filesystems/mounts; it only happened to work on this dev VPS because /root/antigrav-stax-audio/temp and the app's working directory share one partition. In CI, the build's working directory is a separate volume from /root, so the exact same code path fails every time. /music/upload's success path had zero test coverage before this session, so nothing had ever actually exercised this rename in an environment where it could fail. Fixed with shutil.move(), which transparently falls back to copy+delete when the destination isn't on the same filesystem - correct regardless of deployment topology, not just this one VPS's current partition layout. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
-
Aryan Noshirvani authored
Still 500ing in CI even with the pre-committed fixture from the last commit, so the ffmpeg-encoding theory was wrong. Need to actually see the error detail instead of guessing - the assertion only showed the status code, not the response body. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
-
Aryan Noshirvani authored
Passed locally (Python 3.12, full ffmpeg with libmp3lame) but 500'd in CI (python:3.10-slim + apt --no-install-recommends ffmpeg, which lacks mp3 encoding support on Debian - lame isn't in main due to licensing). The test was generating its MP3 fixture via pydub -> ffmpeg encoding at test time; swapped that for a small pre-committed real MP3 file instead. mutagen only needs to *read* a valid MP3 to tag it, which has no such encoder dependency, so this sidesteps the environment gap entirely rather than trying to get CI's ffmpeg build to match local. Co-Authored-By:
Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
-
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 9 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
-