gabriel / musehub public
feat patch commit-graph dev
AI Agent gabriel · 123 days ago · May 15, 2026 · Diff

feat(commit-graph): Phase 2 — MusehubCommitGraph model, migration, bulk DAG walk

- Add MusehubCommitGraph ORM model (repo_id, commit_id, parent_ids, generation, snapshot_id) with PK (repo_id, commit_id) and index (repo_id, generation) - Add alembic migration 0060_commit_graph (down_revision=0059) - process_bundle_index_job writes graph rows in topological order; generation = max(parent generations) + 1, root = 0 - _walk_commit_delta fast path: 2 queries (max_gen bounds) + 1 range scan + in-memory BFS = O(1 query per BFS level) regardless of chain length Falls back to legacy session.get() path when repo_id is absent - wire_fetch_bundle / wire_fetch_presign updated to bulk-fetch MusehubCommit rows separately for wire serialization (outside walk timing) - Add TDD tests CG-1..4 (test_commit_graph_phase2.py) — all 4 green CG-3: 1000 commits walks in 20ms (gate: 50ms)

Issue #63 Phase 2 complete.

sha256:8c5ac08973d96bb7bceb23153cd110a8ed0a0f9f6edbfb081e0dc9300b6d14ad sha
+31 ~13 symbols
sha256:06b46b7bca812fb1d1237fcb19c63d10582ee96cc96f1276617c66e556281c2c snapshot
+31
symbols added
~13
symbols modified
0
dead code introduced
Semantic Changes 44 symbols
+ branch_labels variable variable branch_labels L14–14
+ depends_on variable variable depends_on L15–15
+ down_revision variable variable down_revision L13–13
+ downgrade function function downgrade L51–53
+ annotations import import annotations L7–7
+ op import import op L10–10
+ sa import import sa L9–9
+ revision variable variable revision L12–12
+ upgrade function function upgrade L18–48
~ tests/test_commit_graph_phase2.py .py 20 symbols added
+ _enqueue_and_process function async_function _enqueue_and_process L87–118
+ _make_bundle_from_commits function function _make_bundle_from_commits L69–78
+ _make_linear_chain function function _make_linear_chain L34–66
+ _store_bundle function async_function _store_bundle L81–84
+ AsyncSession import import AsyncSession L22–22
+ annotations import import annotations L13–13
+ blob_id import import blob_id L24–24
+ compute_identity_id import import compute_identity_id L26–26
+ create_repo import import create_repo L27–27
+ datetime import import datetime L15–15
+ db import import db L25–25
+ hashlib import import hashlib L16–16
+ msgpack import import msgpack L19–19
+ pytest import import pytest L20–20
+ select import import select L21–21
+ time import import time L17–17
+ test_cg1_commit_graph_written_for_every_commit function async_function test_cg1_commit_graph_written_for_every_commit L126–155
+ test_cg2_generation_numbers_correct function async_function test_cg2_generation_numbers_correct L163–193
+ test_cg3_walk_commit_delta_1000_commits_under_50ms function async_function test_cg3_walk_commit_delta_1000_commits_under_50ms L201–227
+ test_cg4_walk_commit_delta_correctness_with_have function async_function test_cg4_walk_commit_delta_correctness_with_have L235–266
~ musehub/db/musehub_repo_models.py .py 1 symbol added
+ MusehubCommitGraph class class MusehubCommitGraph L678–708
← Older Oldest on dev
All commits
Newer → Latest on dev

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