fix: honor include-submodules across incremental updates and upgrades#381
Merged
Conversation
|
✅ Health: 7.0 (unchanged)
🩹 Review priority (files here with the most recent bug-fix history — defects cluster, so review these first)
🔥 Hotspots touched (5)
2 more
🔗 Hidden coupling (1 file)
📊 Full report · ⭐ Star Repowise · 📥 Install bot · Last updated 2026-06-05 10:33 UTC |
Two related gaps following the pruned-resolver-scans work (#380): 1. `repowise update` ignored submodule/nested-repo flags: the update path constructed FileTraverser and GraphBuilder with defaults, so a repo indexed with `init --include-submodules` silently dropped its submodule files on every incremental update. The flag is now persisted to state.json at init (same pattern as git_tier) and read back in update_cmd, threaded through _rebuild_graph_and_git / _build_repo_graph into both constructors (incremental rebuild and the config-triggered health re-score). Missing keys keep legacy behavior (False). 2. `--include-submodules` was defeated for *initialized* submodules: `.gitmodules` was only parsed when the flag was off, so an initialized submodule (whose `.git` file makes it look like a nested repo) fell through to the nested-git boundary skip and was dropped anyway. The traverser now parses `.gitmodules` unconditionally and exempts opted-in submodules from the nested-git skip — while still applying gitignore/exclude checks and still skipping non-submodule nested repos. _detect_monorepo package scans now mirror GraphBuilder._prune_nested_git semantics.
upgrade_to_full re-parses the repo for doc generation via _reparse, which constructed FileTraverser without the submodule flags — a fast index built with --include-submodules would drop submodule files from the ASTs/source fed to generation. Read the persisted state.json flags there too (missing -> False).
b609299 to
1bc8cf5
Compare
swati510
approved these changes
Jun 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two follow-ups from the pruned-resolver-scans work (#380):
1.
repowise updateignored submodule/nested-repo flagsA repo indexed with
init --include-submodulessilently dropped its submodule files (and their manifests) on every incremental update: the update path constructedFileTraverserandGraphBuilderwith default flags, so the update''s metadata diverged from what a fresh init would produce. Same class of bug as thegit_tiergap fixed in #369 — and fixed with the same pattern:initnow persistsinclude_submodulesinto.repowise/state.json(both the index-onlybase_statewrite andsave_full_state_and_config; the interactive advanced-config reassignment lands before both writes).updatereads it back (missing key →False, legacy behavior) and threads it through_rebuild_graph_and_git→_build_repo_graphinto both constructors — covering the incremental rebuild and the config-triggered health re-score.upgrade_to_full''s docs re-parse (upgrade_flow._reparse) honors the persisted flags too.2.
--include-submoduleswas defeated for initialized submodulesPre-existing traverser bug, confirmed:
.gitmoduleswas only parsed wheninclude_submodules=False, so with the flag on the submodule set was empty and an initialized submodule — whose.gitfile makes_is_nested_git_repotrue — fell through to the nested-git boundary skip and was dropped anyway. The flag only ever worked for uninitialized submodules, which contain no files.Fix: parse
.gitmodulesunconditionally and exempt opted-in submodules from the nested-git skip, while:.repowiseIgnore/exclude checks to included submodules,_detect_monorepo''s package scans now mirrorGraphBuilder._prune_nested_git(not (include_submodules or include_nested_repos)) so traversal, package detection, and resolver scans agree.Testing
tests/unit/cli/test_update_include_submodules.pymirrors the perf: cache parsing and betweenness across incremental updates #369 tier test: update-built graph keepslibs/sub/mod.pywith the flag, drops it without (legacy fallback)..gitfile) with the flag on/off, and confirm sibling nested repos stay skipped.Follow-up (out of scope)
Standalone
repowise health/repowise dead-codebuild flagless traversers on already-indexed repos — same inconsistency class, read-only impact; to be addressed separately along with routing workspace updates through the incremental path.