feat: docket background tasks, atproto refactor, header stats styling (#534)
* feat: add pydocket for background task infrastructure
- add pydocket dependency for Redis-backed background tasks
- add DocketSettings to config (defaults to memory:// for local dev)
- create background.py with docket initialization and worker lifespan
- create background_tasks.py with scan_copyright task
- migrate copyright scan from asyncio.create_task to docket.add()
- add Redis to test docker-compose
- update AGENTS.md with test command note
the copyright scan is the first task migrated to docket. upload processing
still uses FastAPI BackgroundTasks pending auth session refactoring.
๐ค Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: make docket opt-in, add fallback to asyncio.create_task
- change DOCKET_URL default from "memory://plyr" to "" (disabled)
- add is_docket_enabled() check function
- update background_worker_lifespan() to yield None when disabled
- uploads.py: check is_docket_enabled(), fallback to asyncio.create_task
- remove stub process_upload from background_tasks.py
memory mode won't work in production with multiple machines, so docket
must be explicitly enabled with a Redis URL. when disabled, copyright
scans fall back to fire-and-forget asyncio.create_task().
๐ค Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor: clean up upload background processing
- extract featured artist resolution to handles.py
- extract schedule_copyright_scan to unify docket/asyncio branching
- break _process_upload_background into smaller helper functions:
- _save_audio_to_storage
- _save_image_to_storage
- _add_tags_to_track
- _send_track_notification
- fix sketchy json.JSONDecodeError pass with proper logging
- add compose.yaml for local redis
- add just commands: dev-up, dev-down, dev
๐ค Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* chore: simplify just dev to single command
removes dev-up/dev-down, just use 'just dev' which starts redis,
backend (with DOCKET_URL set), and frontend.
๐ค Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* docs: add background tasks and redis documentation
- add docs/backend/background-tasks.md covering docket/redis setup
- update configuration.md with docket settings
- update environments.md with redis instances per environment
- created Upstash Redis instances:
- plyr-redis-prd (production, iad region)
- plyr-redis-stg (staging, iad region)
note: DOCKET_URL not yet wired to fly secrets - will test in dev first
๐ค Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor: use UploadContext dataclass for background processing
- replace 12 function arguments with single UploadContext dataclass
- cleaner interface for _process_upload_background
- update just commands: dev-services / dev-services-down
- update local dev docs to reflect separate terminal workflow
๐ค Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor: reorganize atproto module by lexicon namespace
- split monolithic records.py (1000+ lines) into focused modules:
- client.py: PDS request/auth logic, token refresh with per-session locks
- records/fm_plyr/: plyr.fm lexicons (track, like, comment, list, profile)
- records/fm_teal/: teal.fm lexicons (play, status)
- sync.py: high-level sync orchestration
- maintain backward compatibility via re-exports in records/__init__.py
- update test patch paths for new module locations
- add dev-services commands for local redis via docker compose
๐ค Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* style: make header stats smaller and evenly distributed
- reduce stats font size (0.75rem โ 0.65rem) and icons (14px โ 12px)
- distribute stats and search evenly across left margin with space-evenly
- margin width responds correctly when queue panel opens
๐ค Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* fix: resolve docket startup and logging issues
- rename 'name' to 'docket_name' in log extra dict (conflicts with LogRecord.name)
- suppress docket logger noise by setting level to WARNING
- remove unnecessary sleep(0.1) from worker shutdown
๐ค Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* refactor: make suppressed loggers configurable
- add LOGFIRE_SUPPRESSED_LOGGERS setting (defaults to "docket")
- iterate over setting in main.py instead of hardcoding
๐ค Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
authored by
zzstoatzz.io
Claude
and committed by
GitHub
c498199d
9f856c67