gabriel / musehub public
feat BREAKING mist task/mist-phase7-rate-limits #1 / 1
AI Agent gabriel · 142 days ago · May 1, 2026 · Diff

feat(mist): phase 7 — rate limiting audit for /api/mists/* endpoints

rate_limits.py: - Add MIST_UPDATE_LIMIT = '30/minute' (handle-keyed; content write = new commit) - Add MIST_DELETE_LIMIT = '10/minute' (handle-keyed; destructive, rarely frequent) - Add MIST_READ_LIMIT = '120/minute' (IP-keyed; public reads, anti-scraping guard)

mists.py: - Import MIST_UPDATE_LIMIT, MIST_DELETE_LIMIT, MIST_READ_LIMIT - Add @limiter.limit(MIST_UPDATE_LIMIT, key_func=get_msign_handle) to update_mist - Add @limiter.limit(MIST_DELETE_LIMIT, key_func=get_msign_handle) to delete_mist (also adds request: Request param required by slowapi) - Add @limiter.limit(MIST_READ_LIMIT) to explore_mists, get_mist, list_mist_forks, list_owner_mists, get_mist_embed (adds request: Request param to list_mist_forks which lacked it)

POST /api/mists and POST /api/mists/{id}/fork were already limited.

All 98 mist-domain tests pass (phases 1-7).

sha256:98670919a6561ac805da53299aa519b05a7729f601350b7f6b3de6362560009b sha
+29 ~11 symbols
sha256:e81053fcb1f8c8ec65094f79305789c1e181f1ddf46844f7d1035fd7dfccf429 snapshot
+29
symbols added
~11
symbols modified
0
dead code introduced
Semantic Changes 40 symbols
~ tests/test_mist_phase7_rate_limits.py .py 23 symbols added
+ TestMutatingEndpointsHaveLimiters class class TestMutatingEndpointsHaveLimiters L55–107
+ test_delete_mist_has_limiter_decorator method method test_delete_mist_has_limiter_decorator L74–85
+ test_delete_mist_uses_msign_key_func method method test_delete_mist_uses_msign_key_func L98–107
+ test_update_mist_has_limiter_decorator method method test_update_mist_has_limiter_decorator L56–72
+ test_update_mist_uses_msign_key_func method method test_update_mist_uses_msign_key_func L87–96
+ TestRateLimitConstants class class TestRateLimitConstants L29–48
+ test_mist_delete_limit_defined method method test_mist_delete_limit_defined L38–42
+ test_mist_read_limit_defined method method test_mist_read_limit_defined L44–48
+ test_mist_update_limit_defined method method test_mist_update_limit_defined L30–36
+ TestReadEndpointsHaveLimiters class class TestReadEndpointsHaveLimiters L114–145
+ _check_fn_has_limiter method method _check_fn_has_limiter L115–125
+ test_explore_mists_has_limiter method method test_explore_mists_has_limiter L127–129
+ test_get_mist_embed_has_limiter method method test_get_mist_embed_has_limiter L143–145
+ test_get_mist_has_limiter method method test_get_mist_has_limiter L131–133
+ test_list_mist_forks_has_limiter method method test_list_mist_forks_has_limiter L135–137
+ test_list_owner_mists_has_limiter method method test_list_owner_mists_has_limiter L139–141
+ TestReadEndpointsWorkUnderThreshold class class TestReadEndpointsWorkUnderThreshold L152–178
+ test_explore_returns_200_under_limit method async_method test_explore_returns_200_under_limit L154–158
+ test_get_nonexistent_mist_returns_404_not_429 method async_method test_get_nonexistent_mist_returns_404_not_429 L161–169
+ test_list_owner_mists_returns_200_under_limit method async_method test_list_owner_mists_returns_200_under_limit L172–178
+ AsyncClient import import AsyncClient L22–22
+ annotations import import annotations L19–19
+ pytest import import pytest L21–21
~ musehub/api/routes/musehub/mists.py .py 3 symbols added, 11 symbols modified
+ MIST_DELETE_LIMIT import import MIST_DELETE_LIMIT L40–40
+ MIST_READ_LIMIT import import MIST_READ_LIMIT L40–40
+ MIST_UPDATE_LIMIT import import MIST_UPDATE_LIMIT L40–40
~ musehub/rate_limits.py .py 3 symbols added
+ MIST_DELETE_LIMIT variable variable MIST_DELETE_LIMIT L76–76
+ MIST_READ_LIMIT variable variable MIST_READ_LIMIT L79–79
+ MIST_UPDATE_LIMIT variable variable MIST_UPDATE_LIMIT L75–75
← Older Oldest on task/mist-phase7-rate-limits
All commits
Newer → Latest on task/mist-phase7-rate-limits

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:98670919a6561ac805da53299aa519b05a7729f601350b7f6b3de6362560009b --body "your comment"