gabriel / musehub public
feat BREAKING proposals task/proposal-list-indexes #1 / 1
AI Agent gabriel · 40 days ago · May 8, 2026 · Diff

feat(proposals): Phase 7 — composite indexes for proposal list query patterns

Migration 0044 adds 4 CONCURRENTLY-built indexes:

1. ix_musehub_proposals_repo_state_created (repo_id, state, created_at DESC) Covers: WHERE repo_id = ? AND state = ? ORDER BY created_at DESC/ASC Pattern: newest / oldest sort — the 90% case

2. ix_musehub_proposals_repo_state_risk (repo_id, state, risk_score DESC NULLS LAST) Covers: WHERE repo_id = ? AND state = ? ORDER BY risk_score DESC/ASC Pattern: risk_desc / risk_asc sort

3. ix_musehub_proposal_reviews_proposal_state (proposal_id, state) Covers: WHERE proposal_id IN (?) AND state = 'approved' GROUP BY proposal_id Pattern: _prefetch_for_batch approval count query

4. ix_musehub_identities_handle_type (handle, identity_type) Covers: WHERE handle IN (?) AND identity_type = 'agent' Pattern: author_type filter JOIN

ORM model __table_args__ updated to match (MusehubProposal, MusehubProposalReview, MusehubIdentity).

EXPLAIN harness: 5 tests verify index presence in pg_catalog and confirm index-based access plans for each query pattern.

Completes issue #35 — Proposals List: State Transition Queue.

sha256:b26003ce4b5387465ee38372620c7c3dc422c15b6cd3a43ca021f5eb6f6aa48c sha
sha256:aed4d48b5beaf4498702d66228340a253733523ebd3e915db696931c515e878a snapshot
← Older Oldest on task/proposal-list-indexes
All commits
Newer → Latest on task/proposal-list-indexes

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