Repository navigation
fix(update): refill function blame for all files on a full git walk - #5226
Aschenbath wants to merge 1 commit into
Conversation
A forced full git walk (a GIT_HISTORY_VERSION bump) leaves a blame index for every file in git_meta_map, but only the partial health pass turned blame into git_function_blame rows, and it walks the changed files alone. An emptied or partial rollup therefore stayed that way until the next init. When the walk re-read the whole history, the partial analysis now builds the rollup over every file, as init builds it, and the health persist upserts it, also when no file changed. Blame stays FULL-tier only, and an ordinary update still re-blames the changed files alone. Fixes repowise-dev#5216
|
Looks safe to merge: no open points, no breaking contract change found, a test imports every changed code file. Reviewed the whole diff: nothing to fix. ➖ Health of changed files: 3.63 → 3.62 (-0.01; structure -0.02) Average full file score (structure and history) of 7 changed code files, weighted by size before this PR; not the repository score. 👀 Suggested reviewers RaghavChamadiya
Settings and updatesSilence one PR with |
Summary
updatere-reads the whole git history (force_full_git, e.g. aGIT_HISTORY_VERSIONbump),git_meta_mapholds every file's blame index, butgit_function_blamewas only written for the changed files.run_partial_analysisnow takesfull_git_historyand, when it is set, builds the rollup over every file the way init does (HealthAnalyzer.function_blame_rows; unchanged sources come out of the walk cache). With no changed file it returns a blame-onlyHealthReport.persist_partial_healthupserts those rows, also in its early return for a report with no analysed path, so a forced walk with nothing to re-score still refills the table. The CLI update and the workspace update both passfull_git_history=bool(full_git_summaries). The rows are written by the health persist, where the update path already writes them, rather than with the git tables as my claim comment said, because they need the walked function bounds.Related Issues
Fixes #5216
Test Plan
New tests in
tests/unit/cli/test_update_git_history_stamp.py: with a stale stamp and an emptiedgit_function_blame,updatewrites back exactly what init wrote (symbol_id -> mod_count) with the analyzer stamp current and stale (re-score), and throughupdate_single_repo_index; an ESSENTIAL-tier repo stays empty; an ordinary update re-blames only the changed file. Without the fix the three refill cases fail and the two guards pass.tests/unit/{health,pipeline,workspace,persistence,cli,dead_code,ingestion}andtest_function_blame_rollup.pylocally on Windows: 22706 passed, 4 failed. Two fail onmainhere too (a GBK decode intest_migration_fts_frozen; the pytest tmp dir sits inside a git work tree fortest_hook_default_on), and two timing tests pass when rerun alone.ruff checkon the changed filesThe issue's repro on cobra (
adbc881):init --no-prosewrites 519 blame rows; then empty the four git tables, setgit_history_version: 3and runupdate --index-only:mainhealth_analyzer_version: 43(re-score)Checklist
🤖 Generated with Claude Code