Skip to content

fix(analysis): honor persisted submodule flags in health and dead-code#383

Merged
RaghavChamadiya merged 1 commit into
mainfrom
fix/analysis-cmds-submodule-flags
Jun 5, 2026
Merged

fix(analysis): honor persisted submodule flags in health and dead-code#383
RaghavChamadiya merged 1 commit into
mainfrom
fix/analysis-cmds-submodule-flags

Conversation

@RaghavChamadiya
Copy link
Copy Markdown
Member

Problem

A repo initialized with --include-submodules persists the flag in .repowise/state.json, and the incremental update path reads it back (#381). The standalone analysis commands didn't: repowise health and repowise dead-code rebuilt the graph with a flagless FileTraverser/GraphBuilder, so on a submodule-indexed repo they analyzed a different (smaller) file set than was indexed — submodule files silently vanished from health metrics and dead-code reachability.

Fix

Read include_submodules / include_nested_repos from state.json the same way update_cmd does (missing key = legacy = False) and thread them into both constructions in health_cmd.py and dead_code_cmd.py. Both commands are read-only, so there's no persisted divergence to migrate.

Also drops a pre-existing unused resolve_repo_path import from the touched import block in dead_code_cmd.py.

Tests

tests/unit/cli/test_analysis_cmds_include_submodules.py — CliRunner-based, positive + negative for both commands against a repo with an initialized submodule (mirrors test_update_include_submodules.py).

  • tests/unit/cli: 453 passed
  • full tests/unit: 3783 passed, 2 xfailed
  • ruff check clean on changed files

A repo initialized with --include-submodules records the flag in
state.json, but the standalone analysis commands rebuilt the graph with a
flagless FileTraverser/GraphBuilder — so repowise health and repowise
dead-code scored a different (smaller) file set than was indexed:
submodule files vanished from health metrics and dead-code reachability.

Read include_submodules/include_nested_repos back from state.json the
same way the incremental update path does (missing key = legacy = False)
and thread them through both constructions. Read-only commands, so no
persisted divergence to migrate.

Also drops a pre-existing unused resolve_repo_path import from the
touched import block in dead_code_cmd.
@RaghavChamadiya RaghavChamadiya requested a review from swati510 as a code owner June 5, 2026 11:31
@repowise-bot
Copy link
Copy Markdown

repowise-bot Bot commented Jun 5, 2026

✅ Health: 7.0 (unchanged)
1 file moved · 2 hotspots · 5 hidden couplings · 1 with fix history

⚠️ Change risk: moderate (riskier than 42% of this repo's commits · raw 8.2/10)
This change's risk is driven by:

  • large diff (many lines added)
  • scattered, high-entropy change

🩹 Review priority (files here with the most recent bug-fix history — defects cluster, so review these first)

File Score Δ Why
.../commands/health_cmd.py 5.6 → 5.5 ▼ -0.1 score drifted on re-parse — no PR-attributable biomarkers
🔥 Hotspots touched (2)
  • .../commands/health_cmd.py — 4 commits/90d, 1 dependents · primary owner: Raghav Chamadiya (98%)
  • .../commands/dead_code_cmd.py — 7 commits/90d, 1 dependents · primary owner: Raghav Chamadiya (93%)
🔗 Hidden coupling (1 file)
  • .../commands/dead_code_cmd.py co-changes with these files (not in this PR):
    • .../cli/helpers.py (3× — 🟢 routine)
    • .../commands/update_cmd.py (3× — 🟢 routine)
    • .../commands/doctor_cmd.py (2× — 🟢 routine)
    • .../server/app.py (2× — 🟢 routine)
    • README.md (2× — 🟢 routine)

📊 Full report · ⭐ Star Repowise · 📥 Install bot · Last updated 2026-06-05 11:32 UTC
Silence on a single PR with [skip repowise] in the title · Per-repo toggle on repowise.dev/settings?tab=bot

@RaghavChamadiya RaghavChamadiya merged commit 5e76827 into main Jun 5, 2026
5 checks passed
@RaghavChamadiya RaghavChamadiya deleted the fix/analysis-cmds-submodule-flags branch June 5, 2026 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants