mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-12-02 01:48:08 +09:00
36b331f3d7411ecf97c05bf15146e83161ab94de
68
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
36b331f3d7 |
feat(requests-board): admin history view + fix community publish transition (#1008)
## Why Andrew asked whether we can see past community-requests-board submissions and whether our first real user got a video. Investigation surfaced: - **First real user was fully served.** `tas041964@gmail.com` requested *Sam Cooke and the Soul Stirrers – Wonderful* (Sep 15); it was auto-picked, generated, published to YouTube (NOMAD-1650), and he got the completion email + emailed thanks. ✅ - **No admin view existed** to see this — you had to query Firestore directly. - **A real bug:** the community publish fan-out (`mark_published` + voter emails) fired **only** on the `youtube_upload_queue` path. Jobs published via the direct video-worker distribution path (like Sam Cooke's) bypassed it, so the request stayed `in_progress`, never lit up the board's public "Recently made" list, and other up-voters would silently miss their "track is live" email. ## What 1. **Fix the publish transition** — extract the fan-out into `backend/services/community_publish.py` and call it from **both** publish paths (`youtube_queue_processor` + `video_worker`). Also fixes a latent `len(int)` crash in the log line. 2. **Backfill / safety net** — `POST /api/internal/community-requests/reconcile`: idempotent, publishes any `in_progress` pick whose job is already live on YouTube. (Will be run in prod post-deploy to fix the Sam Cooke request.) 3. **Admin history view** — `GET /api/admin/community-requests` + a `/admin/community-requests` page: every request, all statuses, with requester, votes, and job + YouTube links. The public board's "Recently made" section already existed in the UI — it was empty only because of bug #1; fixing the transition (+ reconcile backfill) lights it up. ## Testing - `backend/tests/test_community_voter_notify.py` — fan-out from the shared module, both-path idempotency, voter dedupe/retry, YouTube-url resolution, and the reconcile scan. - `backend/tests/test_community_review_admin.py` — the new admin history endpoint maps all statuses. - All 31 requests-board + 158 worker tests pass. The one unrelated failure in `test_audio_processor_local_gpu.py` is pre-existing (confirmed with changes stashed). ## Notes - Admin surface is English-only (no i18n changes); no `en.json` strings added. - Local CodeRabbit review couldn't run (CLI requires life360-org SSO; no seat on this repo) — leaving to the GitHub bot. Plan: `docs/archive/2026-09-17-requests-board-history-and-publish-transition-plan.md` 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added an admin Community Requests history page covering all statuses, votes, submitters, review details, linked jobs, and YouTube videos. - Added admin reconciliation for eligible requests with live videos. - Added automatic voter email notifications after community-request publication. - **Bug Fixes** - Improved publication handling across direct and queued video workflows. - Added recovery for incomplete voter notifications and missed publication transitions. - **Documentation** - Documented the community-request history and reconciliation API endpoints. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> |
||
|
|
bedbcdc3bd |
Requests board: skip songs with existing community karaoke versions (submit + pick time) (#979)
## Summary Stops the requests board from spending a free track — or wasting voters' time — on a song that **already has a good community karaoke version online**, reusing the same KaraokeNerds check the normal job-submission flow uses, at two points. Follow-up to the requests-board Phase 2 automation (#977). Addresses Andrew's two asks: **A) Submission time (soft, non-blocking).** As a signed-in user types an artist/title on the board, we debounce-check KaraokeNerds and surface any existing community versions in a dismissible banner with YouTube links. They can still request it — but many will just watch the existing one. Reuses the existing `POST /api/catalog/community-check` endpoint + `CommunityVersionBanner` component (added an optional board-appropriate subtitle). **B) Pick time (review).** A song may have had no version when requested but gained one by the time it's upvoted to the top. So the daily picker now KaraokeNerds-checks each candidate **in rank order**: - A candidate that already has a community version is **flagged for review** (`review_state=pending`) instead of auto-made, and the picker **skips to the next clean request** — so a fresh, non-duplicate free track still ships that day. - Andrew is emailed a summary and resolves held picks at **`/admin/community-reviews`**: **Make ours anyway** (creates the job like a normal pick), **Reject** (declines and emails every up-voter a link to the existing version), or **Keep on board** (leaves it votable, snoozing re-review for 30 days). - Held requests stay visible/votable on the board; they just aren't auto-made. Flag/email is idempotent (no daily re-nag). ## Andrew's decisions (via AskUserQuestion) Held pick → **skip to next clean request**. Review surface → **admin queue page + email**. "Keep" → **return to board, snooze re-review (30 days)**. ## Changes - **Model:** `SongRequest.review_state` (pending|snoozed), `community_versions`, `community_checked_at`, `review_snoozed_until`. - **Service:** `list_pick_candidates` (skips review-blocked), `set_review_pending` (transactional/idempotent), `snooze_review`, `clear_review`, `reject_request`, `list_pending_reviews`. - **Picker:** candidate loop + community check; extracted `_provision_and_start` shared by the picker and the admin "make" action. - **Admin:** `GET/POST /api/admin/community-reviews`, `/admin/community-reviews` page + sidebar item. New existing-version email to up-voters (33 locales). - **Frontend:** board submit form debounced check + banner. ## Testing - Picker candidate loop (flag dup → make next clean; all-dup → empty + flagged; resume skips re-check), admin actions (make/reject/keep, 404, 500), emulator coverage for the new service methods. 86 passing across touched suites; frontend typechecks clean; 32/32 locale parity. ## Deploy No `infrastructure/` changes — merge deploys it. The daily picker is already enabled in prod, so the pick-time check goes live with the backend deploy; the submission banner ships with the frontend. ## Review CodeRabbit reviewed locally (one minor grammar nit, fixed). @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> |
||
|
|
af36975db7 |
Admin create/manage tenants: album batch via tenant bulk flow + full theme customisation (#971)
## Why
Enables the "album for one client" use case: a batch of tracks with
audio provided up front, a client-supplied instrumental per track, and
one shared theme. That pipeline already exists as the **tenant bulk
flow** (folder pick → LLM pairs mixed↔instrumental → resumable uploads →
skip separation → locked theme on every job) — the only missing piece
was an easy way to **mint a tenant** (previously a hand-run
`scripts/setup-*-tenant.py`). This adds admin create **and** manage, so
a client's feedback can be iterated on (edit theme, re-render).
## What
**Backend** (`backend/services/tenant_admin_service.py` +
`backend/api/routes/tenant_admin.py`):
- `POST /api/admin/tenants` (multipart) — mint a tenant: derives a
**self-contained theme** from the default Nomad theme (copies its assets
so every `background_image` basename resolves), applies colour
overrides, overlays uploaded backgrounds, registers the theme, writes
`tenants/{id}/config.json` with B2B defaults (private, no
YouTube/GDrive, locked theme). Reserves the config **create-only before
any theme write**, with rollback on failure.
- `GET /api/admin/tenants` / `GET /api/admin/tenants/{id}` / `GET
/api/admin/tenants/_template` — list, full detail (config + theme
`style_params` + assets), and the default theme JSON as a template.
- `PUT /api/admin/tenants/{id}` (multipart) — **full theme
customisation**: merge config (one level, `id` immutable), replace the
entire `style_params.json`, upload/replace assets (images **or fonts**),
update logo.
- Full `style_params` override accepted on create too. Theme docs
validated to `intro/karaoke/end/cdg`. Guards against a tenant id
colliding with an existing theme.
**Frontend** (`/admin/tenants`):
- Tenants list + **Create** dialog (name→auto-slug, colours,
backgrounds, Dropbox/delivery, logo, + an "Advanced: full theme JSON"
editor seeded from the Nomad template).
- **Manage** dialog: editable config fields + a validated full **theme
JSON editor** + asset list & upload.
- New tenants are driveable immediately via **`?preview_tenant=<id>`** —
no DNS needed.
- Sidebar "Tenants" entry;
`adminApi.listTenants/createTenant/getTenant/updateTenant/getThemeTemplate`.
## Testing
- 36 backend tests (`test_tenant_admin_service.py`,
`test_tenant_admin_route.py`) + 4 frontend tests
(`admin-tenants-page.test.tsx`), incl. atomic-reservation /
conflict-no-clobber / rollback / theme-collision / full-theme-edit.
- Full `make test` green locally (backend + 1245 frontend); typecheck
clean.
- Reviewed locally with CodeRabbit (2 cycles, all findings addressed).
## Notes
- Admin is English-only → no i18n locale files touched.
- Follow-up (out of scope): saved **user** themes in the Custom Video
Style dialog (reuses this theme-derivation core); and an optional
"re-apply theme + re-render existing job" action.
@coderabbitai ignore
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
|
||
|
|
feb4c86842 |
gen: vanity referral request approve/deny queue (rename-in-place) (#967)
## Problem When a user requests a custom vanity referral code, the backend only emailed the admin — nothing was persisted. To "approve," the admin had to open **Create Vanity Link** and hand-retype the owner email + desired code, which created a *second* link alongside the user's auto-generated one (split stats, two live codes). The **Edit** modal can't change a link's code. There was no approve/deny concept and no notification to the requester. Confusing and unintuitive (reported first-hand while setting up the YouTube referral link). ## Solution User vanity requests now persist to Firestore and surface as a **"Pending Vanity Requests"** banner at the top of `/admin/referrals` with one-click **Approve** / **Deny**. - **Approve** = renames the user's existing link *in place* (`odu4brd8` → `youtube`): stats/earnings preserved, referral attribution (`referred_by_code` + earnings) migrated, old code disabled as a breadcrumb (stats zeroed so admin totals don't double-count), and the requester is **emailed** that their link is live. - **Deny** = marks the request denied. - One unified code per user — no more duplicate links or split stats. ## Changes **Backend** - `VanityRequestDoc` model (`referral_vanity_requests`, keyed by owner_email so a re-request overwrites). - `referral_service`: `create_vanity_request` / `list` / `get` / `approve` / `deny` + `rename_link` (atomic `create()` to close the destination-code race; migrates attribution; zeroes old-alias stats). `get_or_create_link` now prefers enabled links so the renamed alias never resurfaces. - 3 admin endpoints: `GET/POST /admin/vanity-requests[...]`. `request_vanity_url` now validates the code up-front (before link creation) and persists the request. **Frontend** (`/admin/referrals` is English-only, no i18n) - Pending-requests banner card + `adminApi.listVanityRequests/approveVanityRequest/denyVanityRequest` + `VanityRequest` type. ## Testing - Backend unit/route: **21** (approve/deny/list, request validation, 404/400 paths) - Emulator (real Firestore): **11** (rename preserves stats + migrates attribution + disables/zeroes old alias; atomic create blocks taken codes; approve/deny/re-request) - Frontend: **4** (banner renders, approve/deny wiring, hidden when empty) - Version `0.214.0` → `0.215.0`. Local CodeRabbit review completed (2 fix cycles). @coderabbitai ignore --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> |
||
|
|
b5461132d0 |
feat(admin): create users from admin UI + auto-create account on job user_email reassignment (#936)
## Summary
Lets admins provision user accounts before the user has ever logged in —
so we can grant free credits, submit jobs on their behalf, and
impersonate them — and fixes the gap where reassigning a job's
`user_email` to an unknown email left the job orphaned (no account, no
credits, impersonation 404s).
### Changes
- **`POST /api/users/admin/users`** — create a user account directly:
`email` (required), `display_name`, `initial_credits` (0-1000),
`credit_reason`. Returns 409 on duplicate. Initial credits set
`welcome_credits_granted` so the user doesn't also get the automatic
welcome credit on first login.
- **`PATCH /api/admin/jobs/{id}`** — `user_email` is now trimmed +
lowercased (account doc IDs are lowercased emails; mixed case would
silently orphan the job), blank/invalid values are rejected with 400,
and a `gen_users` account is auto-created when none exists. Response
message notes the creation.
- **Admin users page** — "Create User" button + dialog; on success the
list filters to the new user so Impersonate / Add Credits work
immediately.
- **Admin jobs page** — field-save toast surfaces the account-created
message; local state mirrors the backend's email normalization.
### Testing
- New `backend/tests/test_admin_create_user.py` (9 tests) +
`TestUpdateJobUserEmailAutoCreate` (5 tests) in
`test_admin_job_update.py`
- Full backend suite: 3917 passed. Frontend: 1151 Jest tests passed;
eslint/tsc clean on touched files
- CodeRabbit local review: 2 cycles, all findings addressed (PII
redaction, blank-email 400, masked audit log, normalized local state)
Version bump: 0.198.3 → 0.199.0
@coderabbitai ignore
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
|
||
|
|
1e99f9e0d5 |
feat(admin): per-job/user locale badge + "emails sent to user" history (#930)
## Summary
Two admin-only features so support/intervention work can (a) know what
language/country a user is using the product in, and (b) see the exact
emails ever sent to a user, rendered as they appeared in the inbox with
full delivery metadata.
### A — Language / country visibility (admin-only)
- New `get_full_locale_from_request()` captures the real UI language
(any of 33, not the narrowed en/es/de email locale) on **every**
job-creation path (URL, upload, audio-search, bulk, made-for-you via
Stripe metadata). Stored as `Job.locale` (+ added to the dashboard
summary projection) and `User.ui_locale` (kept separate from
`User.locale`).
- `LocaleBadge` (flag + language) shown in the admin jobs table, admin
job detail (+ country via the existing `IpInfo` on the creation IP), the
user-detail header, and the customer `JobCard` **gated to admins only**
— regular users never see it.
- Country is derived from IP (existing `ip_geolocation_service`); no new
capture.
### B — "Emails sent to this user"
- Every send routes through one `EmailService._log_and_send` chokepoint
that persists each email to a new Firestore `email_log` collection
(rendered HTML + Postmark MessageID), best-effort so it can never break
or delay a send. Single-use auth/capability tokens (magic-link, review,
referral) are **redacted** before persistence.
- `PostmarkAdminService` merges the Postmark Messages API (last ~45
days: exact HTML + opens/clicks/bounce/delivery status, paginated) with
the Firestore log (permanent), de-duplicated by message id.
- Endpoints `GET /api/admin/users/{email}/emails` and `GET
/api/admin/emails/{id}`; the user-detail "Emails Sent" card opens a
modal rendering the email in a sandboxed `<iframe srcDoc>` with a
metadata side panel.
- New Firestore composite index (`email_log` recipient + created_at)
added to Pulumi.
## Testing
- **41 new backend tests** (locale capture incl. q=0, email logging +
token redaction, PostmarkAdminService incl. pagination + 45-day
fallback, job-locale persistence, admin endpoints) — all pass.
- **10 new frontend tests** (LocaleBadge, UserEmailsCard list +
sandboxed-iframe modal) — all pass.
- Regression sweep on related existing suites: green. Preview-email flow
smoke-tested through the new chokepoint.
## Notes
- `pulumi up` for the new `email_log` index should be applied before
merge (done locally).
- `Job.locale` populates for new jobs going forward; historical jobs
fall back to the submitting user's locale where shown.
Local CodeRabbit review completed and addressed (token redaction,
pagination, row a11y, locale-overwrite guard, q=0 handling).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
@coderabbitai ignore
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
|
||
|
|
0497168dda |
feat(admin): UX/UI overhaul — overflow fixes, mobile responsiveness, clickable dashboard (v0.197.0) (#928)
## Summary UX/UI overhaul of the admin pages, focused on the most-used surfaces (dashboard, jobs list/detail, users list/detail), fixing reported overflow bugs and making everything usable on mobile. ### Job detail page (`/admin/jobs?id=...`) - **Status timeline**: long timelines (retries/edits) collapse to the last 6 stages behind a `+N earlier (M failed)` expander chip, with a Collapse chip when expanded; resets when switching jobs - **Source field overflow fixed**: info-grid cells get `min-w-0` so long source strings truncate instead of bleeding across Created/Progress/Total Time - **Audio Source Details modal**: rebuilt with stacked wrap-safe rows (no clipped values), scrollable, plus a prominent "Open in YouTube/Spotify" link built from provider + source ID - **Configuration fields**: click-to-edit values with always-visible pencil (was hover-only); empty values show "— click to set" - **Bug fix**: "Trigger Now" in the reset-result dialog called a deleted `handleTriggerWorker` (runtime crash); reimplemented via `adminApi.triggerWorker` - 404 job load no longer shows a redundant error toast (also fixes a pre-existing flaky e2e) - Skips loading the 100-job list while viewing a single job - `generating_screens` status gets a label + filter option ### Jobs list - Search box jumps straight to the detail page when given a job ID - Status filter synced to URL (`?status=failed` is shareable/linkable) - Compact created dates; User/Progress/Created columns hidden on small screens ### Dashboard - Stat cards link to their pages; Job Status Breakdown rows link to the pre-filtered jobs list ### Users list/detail + layout - Responsive columns, truncation-safe email cells, mobile-stacking detail header, break-all for long emails/fingerprints - Breadcrumb shows "User Detail" instead of raw "detail" segment; header no longer overflows on phones ## Testing - 4 new e2e tests (timeline collapse/expand, short-timeline no-collapse, provider link from source ID, job-ID search jump); full admin-job-detail spec 28/28 passing - Full regression e2e suite: 171 passed; frontend unit tests: 1132 passed - Visually verified at 1280px and 390px widths with mocked-API renders (worst-case long timeline + long source strings) @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> |
||
|
|
fe8430d990 |
fix(admin): allow regen-screens from in_review state + surface errors via toast (#793)
## Summary - Fixes a 400 when regenerating title/end screens for a job the user has opened in the review UI (`in_review` state). - Fixes the root cause behind "click Regenerate Screens → modal just closes, no error": `<Toaster />` was never mounted, so **all** `toast()` calls (success and error) silently no-op'd. ## Changes - **Backend:** add `in_review` to `REGENERATE_SCREENS_ALLOWED_STATES` in `backend/api/routes/admin.py`. The sibling `/restart` endpoint already allows `in_review`; this restores parity. Updated `docs/API.md`. - **Frontend:** mount the shadcn `<Toaster />` (same `@/hooks/use-toast` store) in the root `app/layout.tsx` so admin toasts render app-wide. - **Frontend:** give the regen-screens handlers specific, human-readable failure titles/messages (admin dashboard + compact `AdminJobActions` toolbar). - Version bump `0.174.12` → `0.174.13`. ## Testing - [x] Backend: `tests/unit/test_regenerate_screens.py` — allow-list membership, `in_review` → 200, invalid state → 400, missing job → 404 (4 pass). - [x] Frontend: `AdminJobActions.test.tsx` — error-toast path now covered (5 pass). - [x] CodeRabbit CLI review: 0 findings. - [x] Typecheck: no new errors from these changes (pre-existing errors unrelated). ## Review - [x] CodeRabbit CLI review completed locally - [x] Issues addressed @coderabbitai ignore --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|
|
983c5eb4c0 |
fix(admin): rename crash-test folder (underscore was blocking route) (#726)
@coderabbitai ignore Follow-up to #725. Verified in prod that \`/admin/_crash-test/\` returns 404 because Next.js excludes underscore-prefixed folders from routing (they're treated as private/internal, alongside \`_app\`, \`_document\`, etc.). Confirmed by inspecting \`frontend/out/admin/\` locally: the \`_crash-test\` directory is not emitted by the static export. Rename fixes it — route is now \`/admin/crash-test/\`. ## Test plan - [ ] Deploy, visit \`https://gen.nomadkaraoke.com/admin/crash-test/\` as admin — expect the three-button page. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
6445864534 |
feat: frontend crash reporting → Discord alerts + auto cache bust (#725)
@coderabbitai ignore ## Summary Gives us long-term peace of mind that frontend errors never reach users silently. Every client-side crash is captured, shown to the user with useful debug info, reported to the backend, alerted via the existing Discord error channel, and — critically — after a fix ships, affected users pick it up automatically. ## What this does - **Backend endpoint** `POST /api/client-errors` — normalises inbound reports and upserts into the same `error_patterns` Firestore collection the backend already uses. No new Discord wiring needed: `service="frontend"` patterns flow through the existing error-monitor Cloud Run Job → Discord pipeline. - **Three capture layers on the frontend**: - Global `window.onerror` + `unhandledrejection` listeners (mounted once per tab via `ClientErrorInit` in the locale layout) - Next.js App Router `error.tsx` (per-locale) + `global-error.tsx` (last-resort root) - React `CrashReportBoundary` wrapping `LyricsReviewWrapper` + `InstrumentalReviewWrapper` so a crash there renders in place rather than white-screening the route - **User-facing `CrashReport` card** — shows error name/message + collapsible stack + debug info + build SHA; auto-sends on mount (catches bugs in the wild without user action); has Copy / Send again / Try again / Back buttons. - **Version-aware cache busting** so the next bug I fix actually reaches affected users: - `public/version.json` emitted at build time via a new `prebuild` hook. - `isStale()` compares the compiled `NEXT_PUBLIC_COMMIT_SHA` against the live `/version.json`. - `ChunkLoadError` in the global handlers triggers a hard reload (unregisters SWs, clears caches, navigates with `?_v=<sha>` query-string) behind a 60 s circuit breaker to prevent reload loops. - `CrashReport` shows a prominent "A newer version is available — Update now" banner when stale; demotes "Try again" to secondary in that case. - Ambient 10-minute poll dispatches a `karaoke:stale-version` CustomEvent (no auto-reload ambient — only on crash). - **Admin `/admin/_crash-test` page** — three buttons that fire async throw / unhandled rejection / render-time throw, for post-deploy pipeline verification. - **Rate limiting** on the endpoint: 60/min per IP sliding window, plus pattern-hash dedup collapsing viral bugs to a single pattern. - **Privacy**: URL query strings + fragments stripped; user email only sent if authenticated; no cookies / localStorage / form-value capture. - **i18n**: `crashReport` namespace in `en.json` translated into all 32 locales. Reuses existing env var `NEXT_PUBLIC_COMMIT_SHA` — no new build config. ## Review & verification - 49 Jest suites / 800 tests pass (`make test`). - New unit tests: `crash-reporter.test.ts`, `CrashReport.test.tsx`, `CrashReportBoundary.test.tsx`, `version-check.test.ts`, `test_frontend_ingestion.py`, `test_client_errors.py` — all green. - Implemented task-by-task via subagent-driven workflow with spec + code quality review per task (see `docs/archive/2026-04-19-frontend-crash-reporting-plan.md`). - E2E Playwright test deferred — the admin crash-test page covers manual post-deploy verification. ## Test plan - [ ] Deploy to prod. - [ ] Visit `https://gen.nomadkaraoke.com/admin/_crash-test` as admin; click each of the three buttons. - [ ] Confirm a Discord alert arrives in the error channel (may take up to ~15 min per the monitor Cloud Run schedule). - [ ] Verify Firestore `error_patterns` contains 3 new docs with `service="frontend"`. - [ ] In a separate browser session already open to the app, simulate a stale-bundle scenario (edit `public/version.json` on the CDN, or use an older tab after a new deploy) — confirm `CrashReport` shows the "Update now" banner if an error is thrown. - [ ] Test the original Firefox Android bug (if it reproduces) and verify the crash now lands in Discord with a usable stack trace. ## Follow-ups - Source-map upload for readable production stacks (`Task 15` in the plan). - Consider forwarding the `source` payload field into `PatternData.sample_message` if finer-grained Discord triage (`window.onerror` vs `unhandledrejection` vs boundary) becomes valuable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|
|
3fac565c76 |
feat: referral flyer customisation with tabbed QR/flyer dialog (#708)
## Summary - Expand the QR Code Generator dialog into a tabbed **Referral Tools** dialog with **QR Code** and **Printable Flyer** tabs - Add a live flyer preview with extensive customisation: colors, text overrides, section visibility, custom branding, and print layout (1/2/4 per page) - Client-side export to PDF, HTML, and PNG (replaces server-side flyer generation) - Preset themes (Light/Dark) with save/load custom presets via localStorage ## Changes - **New components:** `ReferralToolsDialog`, `QRCodeTab`, `FlyerTab`, `FlyerPreview`, `FlyerControls`, `FlyerExport`, `flyer-presets` - **Removed:** `QRCodeDialog` (replaced by `ReferralToolsDialog`) - **Modified:** `ReferralDashboard.tsx`, `admin/referrals/page.tsx` (import updates) - **Dependencies:** Added `html2canvas`, `jspdf` for client-side export - **i18n:** 30+ new translation keys across all 33 locales ## Testing - [x] 32 referral-specific tests pass (presets, export, dialog interaction) - [x] 743/743 total frontend tests pass - [x] TypeScript compilation clean (no new errors) - [x] CodeRabbit CLI review completed locally, feedback addressed ## Review - [x] Local CodeRabbit review completed (10 findings, 6 fixed, 4 skipped as nitpicks) - [x] Review feedback addressed in dedicated commit @coderabbitai ignore --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
3a1fd08c96 |
fix: apply discount dropdown, credit pricing, checkout state (#700)
## Summary - **Apply Discount modal**: referral code dropdown was empty — `loadReferralLinks()` was in `onOpenChange` which doesn't fire for controlled Dialog open prop changes. Moved to button onClick. Also replaced `Select` with searchable `Combobox` (Popover+Command) to scale with many referral codes. - **Buy Credits dialog**: discounted prices showed contradictory values (e.g. "$9" and "$8.50/video") because `formatPrice` used `toFixed(0)` rounding. Now shows cents when price isn't a whole dollar. - **Buy Credits dialog**: "Redirecting to payment..." persisted after closing/reopening because `checkoutLoading` wasn't reset on dialog open. ## Test plan - [x] Build passes - [x] 721 tests pass - [x] CodeRabbit: no findings - [ ] Manually verify Apply Discount modal loads and filters referral codes - [ ] Manually verify Buy Credits shows correct discounted prices (e.g. $8.50 not $9) - [ ] Manually verify closing/reopening Buy Credits resets checkout button state @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
8ef587e7e3 |
feat(referral): fix discount checkout bug, show discounted prices, admin UX (#699)
## Summary - **Fix**: Referral discount silently dropped at Stripe checkout due to timezone-aware vs naive datetime comparison (same bug previously fixed in `_build_user_public` but missed in `should_apply_discount`) - **Admin UX**: Replace free-text referral code input in Apply Discount dialog with dropdown of active codes (prevents typos/nonexistent codes) - **Buy Credits modal**: Show discounted prices with strikethrough originals when user has active referral discount - **Dashboard banner**: Make referral discount banner dismissable (X button, localStorage) - **User menu**: Show "X% discount active" in the dropdown so discount info persists after banner dismissal ## Test plan - [ ] Verify referred user sees discounted prices in Buy Credits modal - [ ] Verify Stripe checkout session includes the coupon (discount actually applied) - [ ] Verify discount banner can be dismissed and stays dismissed on reload - [ ] Verify user menu shows discount status - [ ] Verify admin Apply Discount dialog shows dropdown of active referral codes @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
3a9438f3e4 |
fix(referrals): use nomadkaraoke.com/r/ for QR codes and referral URLs (#698)
## Summary
QR codes and referral link displays were using
`gen.nomadkaraoke.com/r/{code}` which 404s. The `/r/` short URLs live on
`nomadkaraoke.com` (which redirects to gen). Fixes all referral URL
generation in both user dashboard and admin QR dialog.
@coderabbitai ignore
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
||
|
|
404caa624a |
feat(admin): full QR/flyer dialog on admin referrals page (#697)
## Summary Replace the simple flyer download button on the admin referrals page with the full QRCodeDialog modal — same one users see on their referrals page. Supports customizable QR styles, colors, center logos, and light/dark flyer themes. - Add `onGenerateFlyer` and `flyerFilename` props to `QRCodeDialog` so admin can use the admin flyer endpoint - Wrap dialog in `NextIntlClientProvider` since admin pages don't have the i18n provider ## Test plan - [x] Build passes - [ ] Click QR icon on any referral row → full dialog opens - [ ] Customize QR, generate flyer → downloads PDF for that code @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
e441b854c6 |
feat(referral): marketing flyer PDF generator (#688)
@coderabbitai ignore
## Summary
- **Marketing Flyer Generator**: Print-ready PDF flyers (light + dark
themes) with personalized referral code, discount, and styled QR code
- Server-side rendering via headless Chromium (added to Dockerfile)
- Available from QR Code dialog (user) and admin referrals table (admin)
## Changes
### Backend
- **New:** `flyer_service.py` — Template rendering + headless Chromium
PDF generation
- **New:** `POST /api/referrals/me/flyer` — User flyer endpoint
- **New:** `POST /api/referrals/admin/links/{code}/flyer` — Admin flyer
endpoint
- **New:** Light + dark HTML flyer templates (from kjbox printables)
- **Modified:** `Dockerfile.base` — Added `chromium` package
### Frontend
- **Modified:** `QRCodeDialog.tsx` — Theme picker + Generate Flyer
button, error handling
- **Modified:** Admin referrals page — Flyer button per row
- **New:** `generateFlyer()` API client function (user + admin)
- **i18n:** 5 new flyer-related strings
### Infrastructure
- **Dockerfile.base change** — Adds Chromium (~200MB). Base image
rebuild required.
## Test plan
- [x] 8 backend unit tests (template substitution, validation, Chromium
flags)
- [x] 11 frontend tests (QR dialog + flyer controls)
- [x] 721 total frontend tests passing
- [x] Local Chrome PDF verification (user confirmed)
- [x] Docker container PDF verification (Chromium 146, fonts + gradients
correct)
- [x] End-to-end test with real styled QR code (user confirmed
scannable)
- [ ] Manual: QR dialog → pick theme → Generate Flyer → verify PDF
- [ ] Manual: Admin referrals → flyer button → verify PDF
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
||
|
|
7bf000eb81 |
feat(referral): add duration fields to admin and user referral UIs (#684)
## Summary - Admin edit/create dialogs: now include discount duration and earning duration fields - Admin table: shows durations below rates (e.g. "10% / 20%" with "30d / 365d" below) - User dashboard: new "Link Terms" section showing discount %, discount window, kickback %, earning window @coderabbitai ignore --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
817f2aa1bd |
feat(admin): add Apply Discount to user detail page (#681)
## Summary Admins can apply a referral discount to any user from the user detail page — useful for grandfathering existing users when raising prices. ## Changes ### Backend - New endpoint: `POST /api/referrals/admin/apply-discount` — sets discount %, duration, and referral code on any user - `UserDetailResponse` now includes `referred_by_code`, `referral_discount_expires_at`, `referral_code` ### Frontend - "Apply Discount" button on user detail page (next to Add Credits) - Dialog with discount %, duration (days), and referral code inputs - Current discount status shown on user detail page if active ## Usage - Go to Admin → Users → click a user → "Apply Discount" - Set 50% off for 3650 days with code "loyalty" to grandfather a user @coderabbitai ignore --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
af50b53cd8 |
feat(admin): add edit dialog for referral links (#678)
## Summary Adds a pencil icon button on each row in the admin referrals table that opens an edit dialog to modify display name, custom message, discount %, and kickback %. ## Changes - `frontend/app/admin/referrals/page.tsx` — Edit button + dialog with form fields, uses existing `adminApi.updateReferralLink` endpoint @coderabbitai ignore --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
1154adc150 |
feat(admin): add referral links management page (#670)
## Summary - Add Referrals page to admin dashboard for managing referral links - Stats overview: total links, clicks, signups, earnings - Links table with enable/disable toggle and copy-to-clipboard - Create Vanity Link dialog with custom discount/kickback rates ## Changes - `frontend/app/admin/referrals/page.tsx` — New admin referrals page - `frontend/components/admin/admin-sidebar.tsx` — Added Referrals nav item - `frontend/app/admin/layout.tsx` — Added breadcrumb support - `frontend/lib/api.ts` — Added 3 admin referral API methods ## Testing - [x] Frontend build passes - [x] 710 frontend unit tests pass - [x] No backend changes @coderabbitai ignore --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
14a6b767ce |
fix: improve cancelled job UX and fix /dashboard redirects (#633)
## Summary - Allow downloading files from cancelled jobs (backend no longer requires job to be complete if the file exists in GCS) - Hide cancelled jobs from default recent jobs view alongside completed jobs; visible via "Show all jobs" toggle - Fix stale `/dashboard` routes → `/app` (including impersonation redirect that 404'd) - Show accurate total job count and helpful empty state when jobs are filtered out ## Test plan - [x] Backend unit tests pass (2837 passed) - [x] Frontend unit tests pass (717 passed, 39 suites) - [ ] Verify cancelled job download works in prod after deploy - [ ] Verify impersonation redirects to /app correctly - [ ] Verify "Show all jobs" toggle shows/hides cancelled and completed jobs - [ ] Verify empty state message shows correct total and eye icon hint @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
8e33c4b6aa |
Rework abuse investigation with cross-account correlations (#582)
## Summary - **Fix** broken user profile link URL (was 404, now goes to correct detail page) - **Add** internal/test account filtering — excludes @nomadkaraoke.com, @beveridge.uk, @inbox.testmail.app from all abuse views - **New** Correlations tab (now default) showing fingerprint clusters (RED flag) and IP clusters (ORANGE flag), with user agent matching highlighted (YELLOW signal) - **Demote** old "Suspicious Accounts" to secondary tab ## Motivation The existing "Suspicious Accounts" view flagged too many false positives — legitimate users who just used their 2 free credits, internal test accounts, etc. The real abuse signal is **cross-account correlation**: multiple accounts sharing the same device fingerprint or signup IP. ## Changes | File | What | |------|------| | `backend/utils/test_data.py` | Add internal email domain filtering | | `backend/services/user_service.py` | New `find_account_correlations()`, filter suspicious accounts | | `backend/api/routes/admin.py` | New `GET /api/admin/abuse/correlations` endpoint | | `frontend/lib/api.ts` | New types + API client method | | `frontend/app/admin/abuse/page.tsx` | Fix link URL, new Correlations tab, restructure tabs | | `backend/tests/test_anti_abuse_investigation.py` | 10 new tests | ## Test plan - [x] 27 anti-abuse investigation tests pass (10 new) - [x] 2749 backend tests pass - [x] Frontend dev server starts without errors - [ ] Manual: verify correlations tab shows real data in prod @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
c9e434037b |
feat: admin feedback visibility — page + email notification (#581)
<!-- @coderabbitai ignore --> ## Summary - **Admin feedback page** at `/admin/feedback` — browse all user feedback submissions with star ratings, text fields, search, pagination, and aggregate stats - **Email notification** to admin@nomadkaraoke.com whenever a user submits new feedback (configurable via `ADMIN_NOTIFICATION_EMAIL` env var) - **Admin API endpoint** `GET /api/admin/feedback` with pagination, search, test-data filtering, and average ratings ## Context User feedback was stored in Firestore (`user_feedback` collection) but completely invisible to the admin — the admin panel only showed a boolean "Feedback Submitted: Yes/No" badge per user. This PR closes that gap. ## Changes **Backend:** - `GET /api/admin/feedback` endpoint with pagination, search, `exclude_test` filter, aggregate rating averages - `send_feedback_notification()` method on `EmailService` — sends HTML email with star ratings, all text fields, link to admin page - Wired into `submit_user_feedback` as fire-and-forget (won't block user response) **Frontend:** - New admin page with aggregate stat cards, searchable/paginated table, visual star ratings, expandable rows for text detail - "Feedback" sidebar nav item with MessageSquare icon - `adminApi.listFeedback()` client method + TypeScript types **Tests:** 14 tests covering endpoint (pagination, search, filtering, aggregates, empty state, datetime edge cases), email (content, subject, custom admin, failure), and caller-callee contract integration ## Test plan - [x] `make test` — 712 tests pass (39 suites) - [x] 14 new tests in `test_admin_feedback.py` - [ ] Manual: verify admin page renders at `/admin/feedback` after deploy - [ ] Manual: submit feedback → verify email arrives at admin@nomadkaraoke.com 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
be4acbe915 |
IP geolocation enrichment for admin UI (#570)
Enrich all admin IP displays with country flag + ISP inline, hover popover for full details. Backend caches via ip-api.com in Firestore. @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
de02570514 |
fix: real client IPs + user detail identity info (#567)
## Summary Two fixes: 1. **Real client IPs** — All stored IPs were `169.254.169.126` (Cloud Run LB). Now uses `X-Forwarded-For` header via shared `get_client_ip()` helper. Fixed in magic link, verify, and job creation endpoints. Backfill endpoint updated to clear bad IPs and re-fetch. 2. **User detail identity info** — Admin user detail page now shows: - Identity & Security card: signup IP, device fingerprint, welcome credits status - Active sessions: IP, user agent, fingerprint, last activity - Total spent and feedback status After deploy, re-run backfill to fix the bad IPs: ```bash curl -X POST .../api/admin/abuse/backfill-ips -H "Authorization: Bearer $TOKEN" ``` @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
ede4538276 |
Admin abuse UI: sortable columns + IP backfill (#562)
Sortable table columns + backfill endpoint for existing user IPs. After deploy, run: `curl -X POST .../api/admin/abuse/backfill-ips -H "Authorization: Bearer $TOKEN"` @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
a05cc7ce6c |
Admin UI: Abuse Investigation panel (#555)
## Summary New admin panel at `/admin/abuse` for investigating potential free-credit abuse patterns. ## Features ### Suspicious Accounts tab - Table of accounts with many jobs but no spend (configurable thresholds) - Shows: email, jobs, credits, spend, feedback, signup IP, fingerprint, created date - Click any row to drill into related accounts ### Lookup tab - Search by email, IP address, or device fingerprint - Email search opens the related accounts view - IP/fingerprint search returns a table of all matching users ### Related Accounts view - Target user details (IP, fingerprint, credits, jobs, spend) - Linked accounts grouped by shared IP and shared fingerprint - Clickable drill-down to investigate any related account - Link to full user profile page ## Changes - `frontend/app/admin/abuse/page.tsx` (new) — full page with 3 views - `frontend/components/admin/admin-sidebar.tsx` — Fingerprint icon + nav entry - `frontend/app/admin/layout.tsx` — breadcrumb support - `frontend/lib/api.ts` — 4 adminApi methods + TypeScript types ## Testing - [x] Frontend build passes - [x] All tests pass (707 frontend + all backend) - [x] No backend changes (uses endpoints from PR #553) @coderabbitai ignore --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
05cb7a9bec |
feat: auto-sync disposable email blocklist from community repo (#546)
## Summary - Add daily auto-sync of disposable email domains from the [disposable-email-domains](https://github.com/disposable-email-domains/disposable-email-domains) community repo (~4,800 domains vs previous 160 hardcoded) - Restructure Firestore blocklist into three layers: external (auto-synced), manual (admin-added), allowlisted (admin overrides) - Admin UI updated with separate sections for each domain source + "Sync Now" button ## Changes ### Backend - New `disposable_domain_sync_service.py` — fetch, parse, and sync external blocklist with migration support - Updated `email_validation_service.py` — effective set = (external + manual) - allowlisted, new allowlist CRUD, backward-compatible `get_blocklist_config()` - New API endpoints: `POST /blocklists/sync`, `POST/DELETE /blocklists/allowlisted-domains`, `POST /internal/sync-disposable-domains` - Updated `GET /blocklists` response with `external_domains`, `manual_domains`, `allowlisted_domains`, `last_sync_at`, `last_sync_count` ### Frontend - Admin rate-limits page: three sub-sections (external/manual/allowlist) with sync status bar - Updated API client types and methods ### Infrastructure - Cloud Scheduler job for daily sync at 3:00 AM UTC (Pulumi) ### Migration - First sync automatically migrates from old `disposable_domains` field - Hardcoded `DEFAULT_DISPOSABLE_DOMAINS` replaced with empty set (external sync takes over) ## Testing - 47 new/updated tests across 3 test files (54 total for email validation + sync) - 2584 tests pass in full suite - CodeRabbit CLI: no findings @coderabbitai ignore --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
694a7ff04e |
feat: add audio source details modal to admin panel (#528)
## Summary - **Fix source detection**: `getJobSource` now checks `audio_source_type` field first, correctly identifying audio search jobs even when `audio_search_artist`/`audio_search_title` are null (was showing upload icon for RED audio search jobs) - **Add source details modal**: Clicking the source text opens a dialog showing all available source metadata (type, provider, source ID, filename, target file, download URL, etc.) - **Add source fields to API**: Backend now includes `audio_source_type`, `source_name`, `source_id`, `target_file`, `download_url` in the summary field projection ## Test plan - [x] Backend: Regression test asserting all source fields are in `SUMMARY_FIELD_PATHS` (11 tests pass) - [x] E2E regression: 3 new tests for source modal (audio search, YouTube, file upload) - [x] E2E regression: Updated existing YouTube source test for new modal behavior - [x] Full admin-job-detail E2E suite: 24/24 passing <!-- @coderabbitai ignore --> 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
6c120b709c |
feat: audio edits admin dashboard + reset-to-audio-edit button (#521)
## Summary
- New admin page at `/admin/audio-edits` to view and inspect audio
editing sessions
- "Audio Edit" reset button in admin job actions to reset any job back
to audio edit phase
- Backend API endpoints for listing/viewing audio edit reviews
## Changes
### Admin Dashboard (`/admin/audio-edits`)
- List view: jobs with audio edits, searchable by artist/title/email
- Detail dialog with 3 tabs: Edit Stack, Sessions, Audio playback
- Raw data dialog with JSON copy
- Follows existing edit-reviews page pattern
### Reset to Audio Edit
- New "Audio Edit" button in admin job actions (between Audio and
Review)
- **Critical safety**: restores `input_media_gcs_path` to original when
resetting (the submit endpoint overwrites this with edited audio)
- Clears edit stack, redo stack, uploads, and all downstream processing
flags
### Backend
- `GET /api/admin/audio-edit-reviews` - list jobs with audio edits
- `GET /api/admin/audio-edit-reviews/{job_id}` - full detail with
sessions, signed audio URLs
## Test plan
- [x] All 64 backend tests pass (admin reset + audio edit routes)
- [x] All 701 frontend Jest tests pass (38 suites)
- [x] Reset to `awaiting_audio_edit` properly clears state data keys
- [x] `input_media_gcs_path` restored to original on audio edit reset
<!-- @coderabbitai ignore -->
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
|
||
|
|
d762055e1e |
fix: admin payment history + impersonation UX (#494)
## Summary - **Fix payment history** on admin user detail page showing "0 payments" — missing Firestore composite index on `stripe_payments(customer_email, created_at)` caused the query to silently fail. Added index in Pulumi + backend fallback for immediate fix. - **Add "Impersonate User" button** to admin user detail page - **Redesign impersonation banner** — subtle purple strip instead of bright amber bar that broke header readability - **Add "Back to Admin" button** in both banner and app header for one-click return to admin (previously required logout/login) ## Test plan - [x] Frontend build passes - [x] 555 frontend tests pass - [x] 2100 backend tests pass (21 stripe admin service tests pass) - [ ] Manual: verify payment history loads for user with payments - [ ] Manual: verify impersonate button works from user detail page - [ ] Manual: verify impersonation banner is subtle and readable - [ ] Manual: verify "Back to Admin" returns to admin dashboard @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
83e353438a |
feat: admin lyrics review dashboard (#492)
@coderabbitai ignore
## Summary
- Add "Edit Reviews" section to admin dashboard for reviewing user
lyrics corrections
- New backend endpoints: `GET /api/admin/edit-reviews` (list) and `GET
/api/admin/edit-reviews/{job_id}` (detail snapshot)
- Three frontend views: read-only lyrics review, edit log replay with
step-through, raw data JSON viewer
- All endpoints are strictly read-only (no state mutations, no
Firestore/GCS writes)
- 7 backend unit tests covering filtering, search, pagination, test
exclusion, error handling
## Motivation
Users are now making lyrics corrections during the review phase, and
we're collecting edit logs. This dashboard lets admins:
1. See what users experienced (original vs corrected lyrics in read-only
LyricsAnalyzer)
2. Replay user edits step-by-step to evaluate quality
3. Review raw human edits data for potential AudioShake data sharing
## Test plan
- [x] 7 backend unit tests pass (list filtering, search, pagination,
test exclusion, 404, full snapshot, missing files)
- [ ] Manual: navigate to /admin/edit-reviews, verify list loads
- [ ] Manual: click View Review, verify read-only LyricsAnalyzer renders
- [ ] Manual: click View Edit Log, verify step-through works
- [ ] Manual: click View Raw Data, verify JSON tabs render
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
|
||
|
|
f6903911d1 |
feat: admin dashboard UX improvements (#476)
## Summary - **Clickable links**: Job detail user email navigates to user detail; source field shows clickable YouTube URLs / artist-title / filename; fixed broken job links on user detail page - **New columns**: Users list now shows Created, Last Login, Spent columns with relative time display and sortable headers - **Data fixes**: `total_jobs_completed` counter now incremented when jobs complete; `total_spent` cached on user documents; payment email normalization on storage - **Tooltips & cursors**: Audit across all admin pages; private mode checkbox warns about output deletion - **E2E tests**: 15 new tests (8 regression for users page, 4 for job detail, 3 production tests) ## Post-deploy steps After merging, run these one-time backfill endpoints: 1. `POST /api/admin/payments/normalize-emails` - Lowercase existing payment emails 2. `POST /api/admin/backfill/user-stats` - Recalculate total_jobs_completed and total_spent for all users ## Test plan - [x] All 189 regression tests pass - [ ] Verify admin dashboard loads in production - [ ] Verify clickable email on job detail navigates correctly - [ ] Verify new columns visible on users list - [ ] Run backfill endpoints post-deploy - [ ] Run production E2E tests @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
04950345bc |
Remove legacy per-user job rate limiting (#475)
@coderabbitai ignore ## Summary - Remove the "5 jobs per day" per-user rate limiting system, which is no longer needed since credits now control usage - Delete `rate_limit_service.py` and all associated tests - Remove `RateLimitExceededError` exception and all references across backend routes - Remove rate limit config fields (`enable_rate_limiting`, `rate_limit_jobs_per_day`) - Clean up frontend admin page: remove Overview tab (rate limit stats) and User Overrides tab - Keep all blocklist management (domain/email/IP blocking) and YouTube queue features intact - Update API and README docs to reflect the change ## Changes - **3 files deleted**: `rate_limit_service.py`, `test_rate_limit_service.py`, `test_rate_limits_api.py` - **13 files edited** across backend and frontend - **Net**: ~56 insertions, ~2,465 deletions ## Test plan - [x] All backend tests pass (1086 core + unit tests) - [x] All frontend tests pass (176 tests) - [x] Verified no remaining references to `RateLimitExceededError` or `rate_limit_service` - [x] Blocklist endpoints preserved and tested - [x] YouTube queue endpoints preserved and tested - [x] Credit enforcement tests updated (removed rate limit fixtures) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
0184237242 |
feat: simplify YouTube quota — GCP Cloud Monitoring as single source of truth (#467)
## Summary - Replace dual Firestore self-tracking + GCP monitoring with **GCP Cloud Monitoring as the single source of truth** for YouTube API quota usage - Add lightweight Firestore **pending buffer** for the ~7-minute delay before GCP reflects new uploads - Simplify callers from 3x `record_operation()` to 1x `record_upload()` per upload - Add `youtube_quota_gcp_usage` and `youtube_quota_pending_units` to admin API response - Show "GCP: X + Pending: X" breakdown on admin dashboard below progress bar ## Test plan - [x] All backend tests pass (quota service, API, queue processor) - [x] All frontend tests pass (19 rate-limits page tests including new GCP+Pending breakdown) - [x] Full test suite passes (`make test` — 182 frontend + backend) - [ ] After deploy: verify `GET /api/admin/rate-limits/stats` returns `youtube_quota_gcp_usage` matching GCP Console - [ ] After deploy: verify dashboard progress bar shows real GCP number <!-- @coderabbitai ignore --> 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
b4be5968c2 |
fix: payment dashboard date handling, chart rendering, and sidebar padding (#466)
@coderabbitai ignore
## Summary
- **Revenue chart showed nothing**: `store_payment()` used
`datetime.utcnow()` for `created_at` instead of the Stripe session's
actual `created` timestamp. All backfilled payments appeared on a single
date. Fixed to use `session["created"]`.
- **Single data point invisible**: Recharts AreaChart doesn't render a
visible area with only one point. Added `dot={chart.length === 1}` so
single points show as dots.
- **Payment detail sidebar had no padding**: `SheetContent` had no
padding class. Added `p-6`.
- **Backfill date fix script**: Added `scripts/fix_backfill_dates.py`
(already run against production to correct 32 records).
## Test plan
- [x] All 32 payment tests pass locally
- [x] Revenue chart verified visually via dev server — shows proper date
distribution (Dec 2025 - Mar 2026)
- [x] Payment detail sidebar verified visually — proper padding on all
sides
- [x] Production API confirmed returning correct date-bucketed data
after fix script
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
|
||
|
|
937f8f7ec1 |
feat: YouTube quota GCP monitoring + legacy beta cleanup (#460)
## Summary - Remove the deprecated beta enrollment system (endpoints, models, email templates, admin UI, rate limits) — ~20 files cleaned - Remove legacy count-based YouTube upload tracking from rate_limit_service and dead blocklist methods - Add GCP Cloud Monitoring integration to cross-reference YouTube API quota usage with Firestore tracking - Add drift detection (alerts when GCP reported vs Firestore tracked differs >10%) - Display GCP quota data in admin rate-limits dashboard ## Changes ### Backend (15 files) - **Removed:** 5 beta endpoints, `BetaTesterStatus` enum, beta User fields, beta email templates, `validate_email_for_beta()`, deprecated YouTube/beta rate limit methods, dead blocklist CRUD methods - **Added:** `get_gcp_quota_usage()` to `YouTubeQuotaService` with Cloud Monitoring API query, 5-min cache, and drift detection - **Updated:** Rate limits API response model with GCP quota fields (`gcp_quota_available`, `gcp_quota_units_consumed`, `quota_drift`, `quota_drift_alert`) ### Frontend (11 files) - **Deleted:** `frontend/app/admin/beta/page.tsx` (entire beta admin page) - **Removed:** Beta sidebar nav, layout breadcrumb, admin stats card, beta types/API methods, legacy YouTube stats cards - **Added:** GCP Cloud Monitoring section in rate-limits page showing reported usage, delay, and drift alerts ### Tests (4 files) - Removed 8 obsolete tests for deprecated methods - Created `test_gcp_quota_monitor.py` with 10 tests covering GCP quota querying, caching, fallbacks, and drift detection - Updated mock data and assertions across test files ### Docs (3 files) - Removed beta endpoint docs from API.md, added GCP quota fields - Updated ARCHITECTURE.md with Cloud Monitoring integration - Removed beta program section from PRODUCT-VISION.md ## Test plan - [x] All 2265 backend tests pass (1 pre-existing failure unrelated) - [x] All 516 frontend Jest tests pass - [x] New GCP quota monitor tests cover success, caching, fallbacks, drift alerts - [ ] Verify admin rate-limits page no longer shows beta/legacy cards - [ ] Verify GCP quota section shows "unavailable" gracefully when monitoring data not yet populated @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
d91c2c2b4e |
feat: Stripe admin dashboard with revenue analytics and payment management (#461)
<!-- @coderabbitai ignore --> ## Summary - Full Stripe payment admin dashboard with revenue analytics, payment history, refund management, payout tracking, dispute monitoring, and webhook event audit log - New `StripeAdminService` backend service for payment data storage and analytics - Enhanced webhook handler to store enriched payment data and handle refunds/disputes - User payment history integration on admin user detail page - Backfill script for migrating existing payment data - 32 new unit/endpoint tests covering all P0 critical paths (refund logic, payment storage, credit deduction) - Production E2E tests for payments page and API endpoints - Bug fix: `auth_data[0]` subscript error in refund endpoint (AuthResult not subscriptable) ## Changes ### Backend (7 phases) - **New:** `backend/services/stripe_admin_service.py` - Core payment admin service (store, list, detail, refund, revenue summary, payouts, disputes, webhook events) - **New:** `scripts/backfill_stripe_payments.py` - One-time migration script for existing payments - **Modified:** `backend/api/routes/admin.py` - 9 new admin endpoints with Pydantic models - **Modified:** `backend/api/routes/users.py` - Enhanced webhook handler with payment storage, refund/dispute handling, event logging ### Frontend - **New:** `frontend/app/admin/payments/page.tsx` - 4-tab payments page (Revenue, Transactions, Payouts, Webhooks) - **New:** `frontend/components/admin/payment-detail.tsx` - Payment detail slide-out sheet - **New:** `frontend/components/admin/refund-dialog.tsx` - Refund dialog with credit deduction warning - **Modified:** `frontend/lib/api.ts` - 11 new TypeScript interfaces + adminApi methods - **Modified:** `frontend/app/admin/users/detail/page.tsx` - Payment history section - **Modified:** `frontend/components/admin/admin-sidebar.tsx` - Payments nav item - **Modified:** `frontend/app/admin/page.tsx` - Revenue card on dashboard ### Tests - **New:** `backend/tests/test_stripe_admin_service.py` - 21 unit tests - **New:** `backend/tests/test_admin_payment_endpoints.py` - 11 endpoint tests - **New:** `frontend/e2e/production/admin-payments.spec.ts` - Production E2E tests ## Post-deploy steps 1. Register webhook events in Stripe Dashboard: `charge.refunded`, `charge.dispute.created`, `charge.dispute.closed` 2. Run backfill: `python scripts/backfill_stripe_payments.py` 3. Create Firestore indexes if prompted ## Test plan - [x] 32 new tests pass (service + endpoint) - [x] 181 total tests pass (full suite, 1 pre-existing skip) - [ ] Visual verification of payments page after deploy - [ ] Backfill script dry-run against production - [ ] Verify webhook events are logged after deploy 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
98b6590658 |
feat: YouTube quota-aware upload system with deferred queue (#456)
## Summary - Replace hard-coded 10 uploads/day limit with YouTube API quota unit tracking (10,000 units/day, ~33 uploads) - Queue uploads when quota is exhausted instead of silently skipping them - Process queued uploads hourly via Cloud Scheduler, notify users via email when complete - Add admin dashboard for quota monitoring and queue management ## Changes ### Backend - New Services - `youtube_quota_service.py` — Tracks YouTube API quota units per day in Firestore (`youtube_quota` collection, date-keyed by Pacific Time) - `youtube_upload_queue_service.py` — Manages deferred upload queue in Firestore (`youtube_upload_queue` collection) with atomic claiming, retry logic, and failure handling - `youtube_queue_processor.py` — Worker that processes queued uploads when quota available (downloads from GCS, uploads to YouTube, sends notification) ### Backend - Modified - `video_worker_orchestrator.py` — Queue on quota exhaustion instead of skip; record quota units after each API call - `rate_limit_service.py` — Deprecated YouTube methods delegate to new quota service with legacy fallback - `job_notification_service.py` + `template_service.py` + `email_service.py` — Follow-up email when deferred upload completes - `rate_limits.py` — 3 new admin endpoints: GET queue, POST retry, POST process - `internal.py` — Internal endpoint for Cloud Scheduler to trigger queue processing - `config.py` — New settings: `youtube_quota_daily_limit`, `youtube_quota_upload_cost`, `youtube_quota_safety_margin` ### Frontend - `rate-limits/page.tsx` — YouTube Queue tab with quota progress bar, queued uploads table, retry/process buttons - `api.ts` — Types and API methods for queue management ### Infrastructure (Pulumi) - Cloud Tasks queue `youtube-upload-queue` - Cloud Scheduler job: hourly, Pacific Time, calls internal process endpoint ### Tests (90 passing) - `test_youtube_quota_service.py` — 16 tests - `test_youtube_upload_queue_service.py` — 15 tests - `test_youtube_queue_processor.py` — 14 tests (async) - `test_rate_limits_api.py` — 4 new endpoint tests - `test_rate_limit_service.py` — 5 updated/new delegation tests ### Docs - Updated ARCHITECTURE.md, API.md, README.md, LESSONS-LEARNED.md ## Motivation 4 jobs on 2026-03-03 had YouTube uploads silently skipped because the hard-coded rate limit of 10 uploads/day was reached. Users expected uploads but got none with no notification. The actual YouTube API quota (10,000 units/day) supports ~33 uploads — the rate limit was overly conservative. ## Testing - [x] 90 targeted backend tests pass (4.03s) - [x] Frontend Jest tests pass (503 tests) - [x] CodeRabbit CLI review completed, feedback addressed @coderabbitai ignore --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
0ba5193601 |
fix: recycle brand codes on delete-outputs and job deletion (#437)
## Summary
- E2E happy path test now uses **private mode** (NOMADNP prefix) so test
jobs never consume public NOMAD brand codes or upload to GDrive/YouTube
- `delete-outputs` admin endpoint now **recycles brand codes** after
successful Dropbox + GDrive cleanup
- `DELETE /api/jobs/{id}` endpoint now **recycles brand codes** before
deleting the job record
- Frontend delete-outputs dialog accurately shows brand code recycling
status (recycled/skipped/failed)
## Context
Test jobs ("piri - dog") consumed NOMAD-1275 and NOMAD-1276 brand codes.
When manually deleted via `delete-outputs`, the brand codes were not
recycled back to the counter. This caused the GDrive validator to detect
sequence gaps at 1275/1276 when NOMAD-1277 was later uploaded.
## Test plan
- [x] 7 new unit tests for brand code recycling in both endpoints
- [x] All 490 existing tests pass (483 frontend + backend)
- [x] Frontend builds successfully (TypeScript types updated)
- [ ] Manual: run E2E test, verify job uses NOMADNP prefix
- [ ] Manual: delete-outputs on a test job, verify brand code recycled
in response
<!-- @coderabbitai ignore -->
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
|
||
|
|
9511d03912 |
Add delete user to admin dashboard (#433)
## Summary
- Adds backend `delete_user` method to UserService that deletes user
document, sessions, and magic links (prevents deleting admins)
- Adds `DELETE /admin/users/{email}` endpoint with admin auth
- Adds `deleteUser` to frontend API client
- Adds Delete User button + AlertDialog confirmation on admin user
detail page
Jobs are preserved as historical records — only user auth data is
removed.
## Test plan
- [ ] Navigate to admin user detail page for a non-admin test user
- [ ] Verify "Delete User" button appears (should not appear for admin
users)
- [ ] Click delete, verify confirmation dialog appears
- [ ] Confirm deletion, verify success toast and redirect to user list
- [ ] Verify user no longer appears in the list
@coderabbitai ignore
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
|
||
|
|
fa9bc8eeeb |
Add private (non-published) tracks option (#403)
@coderabbitai ignore ## Summary - Add `is_private` flag to jobs that changes distribution behavior for non-published tracks - Private jobs upload to Dropbox `Tracks-NonPublished` folder with `NOMADNP` brand prefix - Private jobs skip YouTube and Google Drive uploads entirely - Completion emails omit YouTube section for private jobs - Available to all users at job creation; admin can toggle on existing jobs - When admin toggles completed job to private, existing outputs are auto-deleted ## Changes ### Backend - **Job model**: Added `is_private: bool = False` to `Job` and `JobCreate` - **Config**: Added `DEFAULT_PRIVATE_DROPBOX_PATH` and `DEFAULT_PRIVATE_BRAND_PREFIX` settings - **Distribution helper**: New `get_effective_distribution_for_job()` in `job_defaults_service.py` applies private overrides at runtime - **Orchestrator + native paths**: Both distribution code paths use the helper (per "Fix Both Sides" lesson) - **Email template**: YouTube section conditionally removed when `is_private=True` - **Credential pre-validation**: Skip YouTube/GDrive credential checks for private jobs - **API endpoints**: All 4 job creation endpoints accept `is_private`; admin can PATCH it - **Admin auto-delete**: Toggling completed job to private triggers output deletion ### Frontend - **Job creation form**: "Private (Non-Published)" checkbox on all 3 tabs (upload, URL, search) - **Admin dashboard**: Private toggle in job configuration section - **API interfaces**: Updated TypeScript interfaces and API methods ### Tests - 23 unit tests covering model, distribution overrides, email template, notification service, request models, admin toggle, and orchestrator config - Fixed MagicMock truthiness issue in existing tests ## Test plan - [x] All 23 private tracks tests pass - [x] All 1794 existing backend tests pass (1 flaky unrelated test) - [x] CodeRabbit review: credential pre-validation issue found and fixed - [ ] Manual: Create private job end-to-end, verify Dropbox folder - [ ] Manual: Verify completion email has Dropbox link but no YouTube section - [ ] Manual: Admin toggle on completed job deletes outputs 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
b7b5d5c814 |
feat(admin): add MFY restart and override admin tools (#373)
## Summary
Add three new admin endpoints for better Made-For-You order management,
plus clean up the admin toolbar to remove confusing low-level buttons.
### New Endpoints
1. **`POST /api/admin/jobs/{job_id}/regenerate-screens`**
- Regenerates title/end screens with current artist/title metadata
- Use after editing artist/title to update screens without full
reprocessing
2. **`POST /api/admin/jobs/{job_id}/restart`**
- Full restart that actually triggers workers (fixes the "stuck in
pending" issue)
- Option to preserve audio stems for faster restart
- Handles YouTube, audio search, and file upload jobs appropriately
3. **`POST /api/admin/jobs/{job_id}/override-audio-source`**
- Switch from YouTube URL to audio search mode
- Allows finding higher quality audio for MFY orders
### Frontend Changes
- Add new toolbar buttons: **Regen Screens**, **Full Restart**, **Audio
Search**
- Remove confusing low-level buttons that could leave jobs in broken
states:
- "Reset to Start" (replaced by "Full Restart")
- "Clear Workers" (low-level escape hatch)
- "Trigger" (low-level escape hatch)
- Add confirmation dialogs with clear explanations
### Use Case
When a customer submits a Made-For-You order with:
- Wrong artist/title → Edit fields, click "Regen Screens"
- Low-quality YouTube URL → Click "Audio Search" to switch to audio
search mode
- Job stuck after reset → Click "Full Restart" to actually trigger
workers
## Test plan
- [ ] Verify new endpoints return proper responses
- [ ] Verify "Regen Screens" regenerates screens with updated metadata
- [ ] Verify "Full Restart" with preserve_audio_stems=true triggers
screens worker
- [ ] Verify "Full Restart" with preserve_audio_stems=false re-downloads
YouTube audio
- [ ] Verify "Audio Search" transitions job to awaiting_audio_selection
- [ ] Verify old confusing buttons are removed from toolbar
🤖 Generated with [Claude Code](https://claude.ai/claude-code)
@coderabbitai ignore
---------
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
|
||
|
|
5901137724 |
feat: make state machine transitions robust with explicit failure handling (#370)
## Summary Jobs 06cfea29 and 984da08b got stuck at `pending` status because state transitions failed silently. This comprehensive fix makes the state machine more robust through several improvements: - **Explicit failure handling**: `transition_to_state()` now raises `InvalidStateTransitionError` by default instead of returning False silently - **Centralized processing pattern**: New `start_job_processing()` helper ensures atomic transition + worker trigger across all handlers - **Worker validation**: All workers now validate job status before processing via `validate_worker_can_run()` - **Runtime consistency checks**: New `job_health_service.py` detects stuck jobs and state inconsistencies - **Health endpoint**: `/health/job-consistency` endpoint for admin dashboard integration - **Admin button fixes**: Reset to pending now clears parallel processing flags; removed deprecated states ## Changes ### Core Services - `services/job_manager.py`: Added `InvalidStateTransitionError`, `start_job_processing()`, and updated `transition_to_state()` to raise by default - `services/job_health_service.py`: New service for consistency checks and worker validation - `exceptions.py`: Added `InvalidStateTransitionError` exception class ### API Routes - `routes/health.py`: Added `/health/job-consistency` endpoint - `routes/admin.py`: Updated STATE_DATA_CLEAR_KEYS and ALLOWED_RESET_STATES - `routes/audio_search.py`: Fixed to properly transition from DOWNLOADING_AUDIO to DOWNLOADING - `routes/users.py`: Added error handling for state transition failures - `routes/file_upload.py`: Uses centralized `start_job_processing()` ### Workers - All workers (audio, lyrics, screens, video, render_video): Added status validation via `validate_worker_can_run()` ### Frontend - `admin/jobs/page.tsx`: Replaced "Lyrics" + "Inst." buttons with combined "Review" button ### Tests - 26 tests for job_health_service - 11 integration tests for state machine flow - 4 tests for job-consistency endpoint - Updated existing tests for new exception behavior ### Documentation - `docs/LESSONS-LEARNED.md`: Added "Make State Transitions Loud, Not Silent" entry - `docs/ARCHITECTURE.md`: Added state machine robustness note - `docs/archive/2026-02-02-state-machine-robustness-plan.md`: Complete implementation plan ## Test plan - [x] All 1850+ unit tests pass - [x] CodeRabbit review issues addressed - [ ] Manual verification of admin reset buttons in staging - [ ] Verify stuck jobs are properly detected by `/health/job-consistency` 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- @coderabbitai ignore --> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
3413afc722 |
feat(admin): improve reset job feedback and add manual worker trigger (#344)
## Summary
- Improve admin reset job feedback with transparent worker trigger
status
- Add manual trigger endpoint as fallback when auto-trigger fails
- Enhance frontend UI with detailed result dialogs and loading states
**Problem:** When using the admin "Reprocess" button (reset to
`instrumental_selected`), the job status reset correctly but the video
worker was NOT automatically triggered, leaving jobs stuck. The
auto-trigger could fail silently with no user feedback.
## Changes
### Backend (`backend/api/routes/admin.py`)
- Add `worker_triggered` and `worker_trigger_error` fields to
`JobResetResponse`
- Add try/except error handling around worker trigger in `reset_job()`
- Add new `POST /api/admin/jobs/{job_id}/trigger-worker` endpoint for
manual triggering
### Frontend (`frontend/app/admin/jobs/page.tsx`, `frontend/lib/api.ts`)
- Add "Trigger" button in admin toolbar for manual worker triggering
- Add detailed Reset Result Dialog showing:
- Status change (from → to)
- State data keys that were cleared
- Worker trigger status (for instrumental_selected)
- "What happens next" guidance
- "Trigger Now" button if worker wasn't triggered
- Add loading spinners for all async operations
### Tests (`backend/tests/test_admin_job_reset.py`)
- Add 14 new tests for worker trigger response fields and trigger-worker
endpoint
- All 38 tests pass
### Documentation
- Update `docs/API.md` with new endpoint and response fields
- Update `docs/README.md` recent changes
## Test plan
- [x] Backend tests pass (1756 passed)
- [x] TypeScript compiles without errors
- [ ] Manual: Reset a job to `instrumental_selected` via admin UI
- [ ] Manual: Verify response shows worker trigger status
- [ ] Manual: If trigger fails, verify error shown in UI
- [ ] Manual: Click "Trigger Worker" button and verify job starts
processing
@coderabbitai ignore
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
|
||
|
|
20932d811e |
feat: hide download buttons when outputs deleted, improve delete feedback (#342)
<!-- @coderabbitai ignore --> ## Summary - Hide download buttons (4K Video, 720p Video, With Vocals, CDG, TXT) and external links (YouTube, Dropbox) when outputs have been deleted by admin - Replace simple toast feedback with detailed result dialog showing exactly what was deleted from each service (YouTube unlisted, Dropbox deleted, Google Drive deleted) - Add loading spinner during delete operation ## Changes ### Frontend - **OutputLinks.tsx**: Check `job.outputs_deleted_at` to hide download buttons and external links when outputs are deleted - **admin/jobs/page.tsx**: - Add loading state (`deletingOutputs`) with spinner - Add detailed result dialog showing per-service deletion status with color-coded indicators (green checkmark for success, red X for errors, gray dash for skipped) - Replace toast notification with modal dialog for clearer feedback ### Tests - **OutputLinks.test.tsx** (new): 9 unit tests covering download visibility, hiding when deleted, admin link visibility, and edge cases - **admin-job-detail.spec.ts**: 4 new E2E tests for delete outputs dialog functionality ### Docs - **docs/README.md**: Updated Admin Delete Outputs entry noting UX improvements ## Test plan - [x] All 191 unit tests pass (`npm run test:unit`) - [x] All 20 E2E tests pass (`npm run test:e2e`) - [x] Build passes (`npm run build`) - [ ] Manual verification: Delete outputs on a test job, verify buttons disappear and detailed dialog shows correct status 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
9470a0801f |
fix: clear worker progress keys when re-reviewing or resetting jobs (#341)
## Summary
- **Fix critical bug**: When completed jobs are re-reviewed or reset,
worker progress keys were not cleared, causing workers to skip with
"already complete, skipping"
- **Add Clear Workers button**: Escape hatch in admin UI to manually
clear all worker progress markers
- **Add new API endpoint**: `POST
/api/admin/jobs/{job_id}/clear-workers` for programmatic access
- **Fix E2E test suite**: Update admin-job-detail.spec.ts tests to match
current UI patterns
## Test plan
- [x] Backend unit tests for new `delete_state_data_key(s)` methods pass
- [x] Backend tests for review re-submission and admin reset pass
- [x] Frontend E2E tests for Clear Workers button pass
- [x] All admin-job-detail E2E tests now pass (fixed 9 pre-existing
failures)
## Root cause
Jobs have worker progress keys like `render_progress: {stage:
'complete'}` in `state_data`. Workers check these for idempotency. When
re-reviewing a completed job:
1. Review interface only changed `status` to `in_review`
2. Worker progress keys remained with `stage: 'complete'`
3. Triggered workers saw "complete" and skipped execution
## Solution
- Clear worker progress keys in `review.py` when re-reviewing jobs that
were previously completed
- Add `job_manager.delete_state_data_key(s)` helpers
- Add admin UI button and API endpoint for manual intervention
<!-- @coderabbitai ignore -->
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
|
||
|
|
4e7f8bb3d8 |
feat(admin): add job reprocess option for re-encoding after output deletion (#329)
## Summary - Add "Reprocess" button to admin job reset toolbar - Enables re-encoding and re-distributing jobs with existing settings after deleting outputs - Automatically triggers video worker when resetting to `instrumental_selected` state ## Changes ### Backend (`backend/api/routes/admin.py`) - Add `instrumental_selected` to allowed reset states - Configure state data clearing (video_progress, encoding_progress, distribution, brand_code, etc.) - Auto-trigger video worker via WorkerService after reset ### Frontend (`frontend/app/admin/jobs/page.tsx`) - Add "Reprocess" button with RefreshCw icon to reset toolbar - Add tooltip explaining the action ### Tests (`backend/tests/test_admin_job_reset.py`) - Test successful reset to instrumental_selected - Test video worker trigger after reset - Test message reflects worker trigger success/failure - Test state data clearing ## Test plan - [x] Unit tests pass for new reset target - [x] All existing admin reset tests still pass - [x] CodeRabbit review completed ## Use case 1. Job completes but has quality issues 2. Admin uses "Delete Outputs" to remove YouTube/Dropbox/GDrive files 3. Admin clicks "Reprocess" button 4. Job re-encodes and re-distributes with same settings @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
2d687064b8 |
feat(admin): improve job detail page and fix Files tab (#317)
## Summary - Fix Files tab showing 0 files when file_urls contains relative paths (not `gs://` URIs) - Add timing stats (total time, processing time, waiting time) to job info grid - Combine Config and Metadata into single "Overview" tab for better space usage - Make timeline wrap on narrow screens instead of causing overflow ## Changes **Backend:** - `_extract_files_recursive` now handles both `gs://` URIs and relative paths starting with `jobs/` - Added error handling to prevent 500 errors when file extraction fails **Frontend:** - Added `getJobTimingStats()` to calculate total/processing/waiting times - Reorganized tabs: Overview (Config + Metadata side-by-side), Files, Debug - Timeline uses `flex-wrap` with `gap-y-2` for responsive wrapping - Layout uses `min-w-0 overflow-hidden` to prevent sidebar overflow ## Test plan - [x] Backend tests pass (`pytest backend/tests/test_admin_job_files.py`) - [ ] Verify Files tab shows files for jobs with relative paths in file_urls - [ ] Verify timing stats display correctly - [ ] Verify timeline wraps on narrow screens 🤖 Generated with [Claude Code](https://claude.com/claude-code) @coderabbitai ignore Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
df446ed2ba |
feat(admin): redesign job detail page for efficiency (#316)
## Summary Redesigns the admin job detail page to be more efficient for admin use, minimizing scrolling and making actions immediately accessible. **Key changes:** - Sticky action toolbar at top with reset buttons (Start, Audio, Lyrics, Inst.), Delete Outputs, Delete Job, and Logs button - Horizontal timeline with timestamps below each stage and consistent labeling - Labeled metadata grid (User, Source, Created, Updated, Progress, Theme) - Logs moved to modal with level filtering and search - Content organized into tabs (Files, Config, Metadata, Debug) - Debug data (State Data, File URLs, Raw Job Data) collapsed by default ## Test plan - [x] Build passes (`npm run build`) - [ ] Manual testing of job detail page layout - [ ] Verify action buttons work (reset, delete outputs, delete job) - [ ] Verify logs modal opens, scrolls, filters correctly - [ ] Verify timeline displays stages with timestamps - [ ] Verify metadata labels are clear @coderabbitai ignore 🤖 Generated with [Claude Code](https://claude.ai/code) --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> |