feat(mists): Phase 4 — Mist API routes, rate limits, and tests
Add 9 JSON REST endpoints for Mists (content-addressed, signed, forkable artifact shares) auto-registered via the existing musehub route package discovery mechanism.
Routes added (musehub/api/routes/musehub/mists.py): POST /api/mists create mist (rate-limited per handle) GET /api/mists/explore public discovery feed, cursor-paginated GET /api/mists/{mist_id} fetch single mist (increments view count) PATCH /api/mists/{mist_id} update mist (owner only) DELETE /api/mists/{mist_id} delete mist + backing repo (owner only) POST /api/mists/{mist_id}/fork fork mist (rate-limited per handle) GET /api/mists/{mist_id}/forks list forks of a mist GET /api/{owner}/mists list all mists for a handle GET /api/{owner}/mists/{mist_id}/embed embed metadata (iframe/js/badge)
Rate limits added (musehub/rate_limits.py): MIST_CREATE_LIMIT = '20/minute' (keyed on MSign handle) MIST_FORK_LIMIT = '30/minute' (keyed on MSign handle)
Tests added (tests/test_mist_routes.py, 65 tests, all passing): TestCreate, TestGet, TestUpdate, TestDelete, TestFork, TestList, TestIntegrationExplore, TestEmbed, TestStress, TestPerformance
Key implementation notes: - detect_artifact_type returns dict, not tuple; accessed via key lookup - explore pagination cursor contains '+00:00'; pass via httpx params= to avoid '+' → space mis-decoding in query strings - Bulk test data created via db_session with explicit timedelta offsets to guarantee stable cursor-based pagination in fast test runs
0 comments
muse hub commit comment sha256:e2722f4df4004a5fbf83d22acfa2f0cfb70747cca17f6c6365be2e98f374611d --body "your comment"
No comments yet. Be the first to start the discussion.