gabriel / musehub public
refactor task/orm-replace-raw-sql #1 / 1
AI Agent gabriel · 120 days ago · May 16, 2026 · Diff

refactor: replace raw asyncpg SQL with SQLAlchemy ORM in xs unit tests

- test_clone_xs_unit.py: _wait_indexed uses select(MusehubMPackIndex) - test_fetch_xs_unit.py: same pattern - test_push_xs_unit.py: extract module-level _wait_indexed and _fetch_index_rows helpers; replace three inline asyncpg closures; row['mpack_id'] → row.mpack_id

sha256:d519e3141bf13e70f079cae854ebe3e6004418076a4d9aa2c12ac275a625a3e0 sha
+22 ~5 −2 symbols
sha256:f43e0a4ee5234102122c02df875ddcc68295080f2a67401e8345edfeb7b326d0 snapshot
+22
symbols added
~5
symbols modified
−2
symbols removed
0
dead code introduced
Semantic Changes 29 symbols
~ tests/test_clone_xs_unit.py .py 6 symbols added, 1 symbol removed, 1 symbol modified
asyncpg import import asyncpg L26–26
+ _PROD_DB_URL variable variable _PROD_DB_URL L33–33
+ AsyncSession import import AsyncSession L28–28
+ MusehubMPackIndex import import MusehubMPackIndex L31–31
+ create_async_engine import import create_async_engine L28–28
+ select import import select L27–27
+ sessionmaker import import sessionmaker L29–29
~ tests/test_fetch_xs_unit.py .py 6 symbols added, 1 symbol removed, 1 symbol modified
asyncpg import import asyncpg L26–26
+ _PROD_DB_URL variable variable _PROD_DB_URL L33–33
+ AsyncSession import import AsyncSession L28–28
+ MusehubMPackIndex import import MusehubMPackIndex L31–31
+ create_async_engine import import create_async_engine L28–28
+ select import import select L27–27
+ sessionmaker import import sessionmaker L29–29
~ tests/test_push_xs_unit.py .py 10 symbols added, 3 symbols modified
+ _PROD_DB_URL variable variable _PROD_DB_URL L35–35
+ _fetch_index_rows function async_function _fetch_index_rows L56–72
+ _wait_indexed function async_function _wait_indexed L38–53
+ AsyncSession import import AsyncSession L30–30
+ MusehubMPackIndex import import MusehubMPackIndex L33–33
+ _time import import _time L25–25
+ asyncio import import asyncio L24–24
+ create_async_engine import import create_async_engine L30–30
+ select import import select L29–29
+ sessionmaker import import sessionmaker L31–31
← Older Oldest on task/orm-replace-raw-sql
All commits
Newer → Latest on task/orm-replace-raw-sql

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