gabriel / musehub public
fix patch fix/list-repos-for-domain-wrong-column #1 / 1
AI Agent gabriel · 63 days ago · Jul 4, 2026 · Diff

fix: list_repos_for_domain compared the wrong column, always returned 0

gabriel spotted every domain on staging showing 0 repos. Root cause: list_repos_for_domain(session, domain_id) compared MusehubRepo.domain_id (a plain VCS-plugin category string like "code") against domain_id (the marketplace MusehubDomain's genesis-addressed primary key, a sha256 hash) — two completely different namespaces that can never be equal, for any domain, ever. Confirmed via direct-fetch: zero domains had ever returned a repo, on any domain, at any time.

The correct column is MusehubRepo.marketplace_domain_id (musehub#117 Phase 3's explicit repo<->domain link, already used correctly by the repo-home badge in the other query direction) — never MusehubRepo.domain_id, which is a different concept entirely (the plain plugin category, unrelated to marketplace registration).

- Fixed the WHERE clause; documented the two-column distinction directly in the function's docstring so this doesn't recur. - Updated 5 existing tests that had unwittingly been asserting the OLD, buggy behavior (they set MusehubRepo.domain_id to simulate a link, which only "worked" because the implementation used the same wrong column — not because it exercised the real linking mechanism). - Added a new regression test proving a repo whose plugin category string happens to equal the domain's slug is correctly excluded unless also explicitly linked via marketplace_domain_id.

Verified live on local musehub: linked a real repo via PATCH /api/repos/{id}/settings, confirmed it appears in both GET /api/domains/@gabriel/code/repos and the SSR domain detail page. 104/104 tests pass, zero regressions.

sha256:69ed0ee9ea5602a14ce6d91c518e8d7abfebff1d61e8e4a7cb502d9554fcaaeb sha
+1 ~10 symbols
sha256:53b047867378c55cc5b55324fabb1947a36b32257020f8900ba4b6f15bb5a330 snapshot
+1
symbol added
~10
symbols modified
0
dead code introduced
Semantic Changes 11 symbols
← Older Oldest on fix/list-repos-for-domain-wrong-column
All commits
Newer → Latest on fix/list-repos-for-domain-wrong-column

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