gabriel / musehub public
refactor patch task/read-object-bytes-adapter #1 / 1
AI Agent gabriel · 144 days ago · May 1, 2026 · Diff

refactor: canonical read_object_bytes adapter — sweep all s3/local dispatch sites

Add read_object_bytes(obj) to musehub/storage/backends.py as the single canonical path for reading object bytes regardless of backend. Replace all manual content_cache → s3:// → local disk dispatch patterns across:

- musehub/services/musehub_governance.py (delete _read_object_bytes, use canonical) - musehub/api/routes/api/identities.py (replace inline dispatch block) - musehub/services/musehub_orgs.py (was local-only, now handles S3 correctly) - musehub/services/musehub_auth.py (was local-only, now handles S3 correctly)

Also fix test_reads_from_s3_when_s3_uri: remove dead asyncio.coroutine line (removed in Python 3.14) that was immediately overridden by _fake_get anyway.

All 98 tests pass.

sha256:dd2af10145b84389dfb32cba2d619d233cb59fdeaff60e343886f7090fce1547 sha
+11 ~5 symbols
sha256:b67e98a8625c86d548879dee53b565c4933322cd135eb113a2c1c9e617de0d12 snapshot
+11
symbols added
~5
symbols modified
0
dead code introduced
Semantic Changes 16 symbols
~ musehub/services/musehub_governance.py .py 1 symbol added, 2 symbols modified
+ read_object_bytes import import read_object_bytes L28–28
~ musehub/storage/backends.py .py 1 symbol added
+ read_object_bytes function async_function read_object_bytes L618–642
~ tests/test_storage_backends.py .py 9 symbols added
+ TestUnitReadObjectBytes class class TestUnitReadObjectBytes L708–770
+ _obj method method _obj L712–721
+ test_content_cache_takes_priority_over_disk method async_method test_content_cache_takes_priority_over_disk L728–733
+ test_missing_disk_file_returns_none method async_method test_missing_disk_file_returns_none L762–765
+ test_no_path_no_cache_returns_none method async_method test_no_path_no_cache_returns_none L767–770
+ test_reads_from_s3_when_s3_uri method async_method test_reads_from_s3_when_s3_uri L749–760
+ test_reads_local_disk_path method async_method test_reads_local_disk_path L735–740
+ test_reads_local_uri_prefix method async_method test_reads_local_uri_prefix L742–747
+ test_returns_content_cache_when_present method async_method test_returns_content_cache_when_present L723–726
← Older Oldest on task/read-object-bytes-adapter
All commits
Newer → Latest on task/read-object-bytes-adapter

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:dd2af10145b84389dfb32cba2d619d233cb59fdeaff60e343886f7090fce1547 --body "your comment"