gabriel / musehub public
feat BREAKING task/file-last-commits-materialized #1 / 1
AI Agent gabriel · 129 days ago · May 7, 2026 · Diff

feat: materialize per-file last-commit data at push time

- Add MusehubFileLastCommit ORM model (PK: repo_id, branch, path) - Add migration 0034 to create musehub_file_last_commits table - Add musehub/services/file_last_commits.py with compute_and_store_file_last_commits that walks commits newest→oldest and upserts attribution via ON CONFLICT DO UPDATE - Add push.file_last_commits job type to job_types_for_push (all domains) - Wire branch into enqueue_push_intel payload so worker knows which branch to index - Add push.file_last_commits worker handler that calls the compute service - Rewrite get_file_last_commits to query the materialized table (single SQL read) with fallback blob-walk for repos not yet indexed - Fix double _get_head_snapshot_manifest fetch in repo_page: fetch once before asyncio.gather and pass to both list_tree and get_repo_home_stats - All 10 FLC tests pass

sha256:3e984c6191351137932514ccb70291ff03e12c179981f64b56365b8b2b348300 sha
+45 ~8 symbols
sha256:491ee52b5bdf987b8cf5d8741a1ac10b1199708d230c60a3c9701daa340cde82 snapshot
+45
symbols added
~8
symbols modified
0
dead code introduced
Semantic Changes 53 symbols
+ branch_labels variable variable branch_labels L16–16
+ depends_on variable variable depends_on L17–17
+ down_revision variable variable down_revision L15–15
+ downgrade function function downgrade L41–43
+ annotations import import annotations L9–9
+ op import import op L11–11
+ sa import import sa L12–12
+ revision variable variable revision L14–14
+ upgrade function function upgrade L20–38
+ compute_and_store_file_last_commits function async_function compute_and_store_file_last_commits L18–105
+ AsyncSession import import AsyncSession L13–13
+ _tz import import _tz L9–9
+ annotations import import annotations L7–7
+ db import import db L15–15
+ delete import import delete L11–11
+ pg_insert import import pg_insert L12–12
+ select import import select L11–11
~ tests/test_file_last_commits.py .py 27 symbols added
+ _add_commit function async_function _add_commit L66–91
+ _add_snapshot function async_function _add_snapshot L48–63
+ _commit_id function function _commit_id L40–41
+ _obj_id function function _obj_id L44–45
+ _snap_id function function _snap_id L36–37
+ _utc function function _utc L32–33
+ AsyncSession import import AsyncSession L21–21
+ annotations import import annotations L15–15
+ create_branch import import create_branch L25–25
+ create_repo import import create_repo L25–25
+ datetime import import datetime L18–18
+ db import import db L24–24
+ hashlib import import hashlib L17–17
+ pytest import import pytest L20–20
+ select import import select L22–22
+ timedelta import import timedelta L18–18
+ timezone import import timezone L18–18
+ test_flc10_second_push_updates_changed_files function async_function test_flc10_second_push_updates_changed_files L337–361
+ test_flc1_empty_table_returns_empty function async_function test_flc1_empty_table_returns_empty L99–105
+ test_flc2_compute_populates_table function async_function test_flc2_compute_populates_table L113–137
+ test_flc3_reads_from_table function async_function test_flc3_reads_from_table L145–165
+ test_flc4_changed_file_attributed_to_newer_commit function async_function test_flc4_changed_file_attributed_to_newer_commit L173–195
+ test_flc5_unchanged_file_attributed_to_oldest_commit function async_function test_flc5_unchanged_file_attributed_to_oldest_commit L203–222
+ test_flc6_directory_attributed_to_most_recent_child_commit function async_function test_flc6_directory_attributed_to_most_recent_child_commit L230–250
+ test_flc7_compute_is_idempotent function async_function test_flc7_compute_is_idempotent L258–280
+ test_flc8_only_requested_paths_returned function async_function test_flc8_only_requested_paths_returned L288–305
+ test_flc9_unknown_paths_not_in_result function async_function test_flc9_unknown_paths_not_in_result L313–329
~ musehub/db/musehub_models.py .py 1 symbol added
+ MusehubFileLastCommit class class MusehubFileLastCommit L1934–1961
~ musehub/worker.py .py 1 symbol modified
← Older Oldest on task/file-last-commits-materialized
All commits
Newer → Latest on task/file-last-commits-materialized

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