Skip to content

fix(cli): prevent stale file_page rows from surviving repowise update (#1744) - #1906

Open
kunnalsinngh14 wants to merge 1 commit into
repowise-dev:mainfrom
kunnalsinngh14:issue-1744
Open

fix(cli): prevent stale file_page rows from surviving repowise update (#1744)#1906
kunnalsinngh14 wants to merge 1 commit into
repowise-dev:mainfrom
kunnalsinngh14:issue-1744

Conversation

@kunnalsinngh14

Copy link
Copy Markdown

Issue

Fixes #1744 - Stale structural file_page rows survive repowise update

Root Cause

The repowise update command exits early with "Already up to date" when Git HEAD
is unchanged, even if the database contains stale structural pages. This skips the
reconciliation pass that should clear the stale status.

Solution

Before the early exit, check if the database contains stale structural pages. If so,
proceed to reconciliation even though Git HEAD hasn't changed. Stale pages are added
to the regeneration list and marked fresh after reconciliation.

Changes

  • Added load_stale_structural_file_paths() helper in deterministic.py
  • Updated early-return gate in command.py to check for stale pages
  • Updated check_repo_staleness() in workspace/update.py to recognize database staleness

Testing

  • Added 6 comprehensive unit tests
  • All 248 tests pass (6 new + 242 regression)
  • Verified E2E: doctor detects stale pages, update reconciles them

Verification

Reproduces the reported case: 94 stale file_page rows are now cleared by
repowise update even when Git HEAD is unchanged.

@repowise-bot

repowise-bot Bot commented Aug 24, 2026

Copy link
Copy Markdown

✅ Health of changed files: 1.8 → 2.1 (+0.3)
⚠️ Change risk: moderate, riskier than 47% of this repo's commits.

📋 At a glance
3 hotspots touched · 6 new findings introduced · 2 co-change pairs left out · 3 files with recent fix history. Scoped to packages.

✅ Health gate: passed

📌 Before you merge

  • Run tests/integration/test_cli.py, .../cli/test_docs_pointer.py, .../cli/test_editor_setup.py, .../cli/test_deterministic_update.py (+4 more): they import the changed files
  • .../update_cmd/persistence.py changed together with .../update_cmd/command.py in 14 past commits and isn't in this PR
  • .../init_cmd/command.py changed together with .../update_cmd/command.py in 10 past commits and isn't in this PR
🔎 More signals (3)

🗺️ Change map

flowchart LR
  subgraph PR ["Changed in this PR (3 with dependents)"]
    f_packages_cli_src_repowise_cli_commands_update_cmd_command_py[".../update_cmd/command.py 🔥"]:::changed
    f_packages_cli_src_repowise_cli_commands_update_cmd_deterministic_py[".../update_cmd/deterministic.py 🔥"]:::changed
    f_packages_core_src_repowise_core_workspace_update_py[".../workspace/update.py 🔥"]:::changed
  end
  f_packages_cli_src_repowise_cli_commands_generate_cmd_command_py[".../generate_cmd/command.py"]
  f_packages_cli_src_repowise_cli_commands_update_cmd_command_py --> f_packages_cli_src_repowise_cli_commands_generate_cmd_command_py
  f_packages_cli_src_repowise_cli_commands_init_cmd_command_py[".../init_cmd/command.py"]
  f_packages_cli_src_repowise_cli_commands_update_cmd_command_py --> f_packages_cli_src_repowise_cli_commands_init_cmd_command_py
  f_packages_cli_src_repowise_cli_commands_init_cmd_generation_py[".../init_cmd/generation.py"]
  f_packages_cli_src_repowise_cli_commands_update_cmd_command_py --> f_packages_cli_src_repowise_cli_commands_init_cmd_generation_py
  f_packages_cli_src_repowise_cli_commands_init_cmd_persistence_py[".../init_cmd/persistence.py"]
  f_packages_cli_src_repowise_cli_commands_update_cmd_command_py --> f_packages_cli_src_repowise_cli_commands_init_cmd_persistence_py
  f_packages_cli_src_repowise_cli_commands_update_cmd_deterministic_py --> f_packages_cli_src_repowise_cli_commands_init_cmd_command_py
  f_packages_cli_src_repowise_cli_commands_restyle_cmd_py[".../commands/restyle_cmd.py"]
  f_packages_cli_src_repowise_cli_commands_update_cmd_deterministic_py --> f_packages_cli_src_repowise_cli_commands_restyle_cmd_py
  f_packages_cli_src_repowise_cli_commands_doctor_cmd_workspace_checks_py[".../doctor_cmd/workspace_checks.py"]
  f_packages_core_src_repowise_core_workspace_update_py --> f_packages_cli_src_repowise_cli_commands_doctor_cmd_workspace_checks_py
  f_packages_cli_src_repowise_cli_commands_init_cmd_workspace_py[".../init_cmd/workspace.py"]
  f_packages_core_src_repowise_core_workspace_update_py --> f_packages_cli_src_repowise_cli_commands_init_cmd_workspace_py
  f_packages_cli_src_repowise_cli_commands_update_cmd_incremental_py[".../update_cmd/incremental.py"]
  f_packages_core_src_repowise_core_workspace_update_py --> f_packages_cli_src_repowise_cli_commands_update_cmd_incremental_py
  f_packages_cli_src_repowise_cli_commands_update_cmd_persistence_py[".../update_cmd/persistence.py"]
  f_packages_core_src_repowise_core_workspace_update_py --> f_packages_cli_src_repowise_cli_commands_update_cmd_persistence_py
  more(["+9 more dependents"])
  PR --> more
  w_packages_cli_src_repowise_cli_commands_update_cmd_persistence_py(["⚠️ .../update_cmd/persistence.py changed together 14×, not in PR"]):::warn
  f_packages_cli_src_repowise_cli_commands_update_cmd_command_py -.- w_packages_cli_src_repowise_cli_commands_update_cmd_persistence_py
  w_packages_cli_src_repowise_cli_commands_init_cmd_command_py(["⚠️ .../init_cmd/command.py changed together 10×, not in PR"]):::warn
  f_packages_cli_src_repowise_cli_commands_update_cmd_command_py -.- w_packages_cli_src_repowise_cli_commands_init_cmd_command_py
  t_tests_integration_test_cli_py(["✅ tests/integration/test_cli.py"]):::guard
  t_tests_integration_test_cli_py -.-> f_packages_cli_src_repowise_cli_commands_update_cmd_command_py
  t_tests_unit_cli_test_deterministic_update_py(["✅ .../cli/test_deterministic_update.py"]):::guard
  t_tests_unit_cli_test_deterministic_update_py -.-> f_packages_cli_src_repowise_cli_commands_update_cmd_deterministic_py
  t_tests_unit_cli_test_update_lock_py(["✅ .../cli/test_update_lock.py"]):::guard
  t_tests_unit_cli_test_update_lock_py -.-> f_packages_core_src_repowise_core_workspace_update_py
  classDef changed fill:#dbeafe,stroke:#1d4ed8,color:#1e3a5f
  classDef warn fill:#fef3c7,stroke:#b45309,color:#78350f
  classDef guard fill:#dcfce7,stroke:#15803d,color:#14532d
Loading

Solid arrows: code that imports the changed files (18 direct dependents, from the last indexed snapshot). Dashed: history/tests.

🔥 Hotspots touched (3)

  • .../workspace/update.py: 26 commits/90d, 18 dependents · primary owner: Raghav Chamadiya (94%)
  • .../update_cmd/command.py: 54 commits/90d, 19 dependents · primary owner: Raghav Chamadiya (87%)
  • .../update_cmd/deterministic.py: 10 commits/90d, 5 dependents · primary owner: Raghav Chamadiya (84%)

🔗 Hidden coupling (1 file)

  • .../update_cmd/command.py co-changes with these files (not in this PR):
    • .../update_cmd/persistence.py (14×, 🟡 notable)
    • .../init_cmd/command.py (10×, 🟡 notable)

👀 Suggested reviewers @RaghavChamadiya


📊 See the full report for this PR
Your repo map with this PR's blast radius lit up, every caller of the contracts it changes, and health before and after. No sign-in. · ⭐ Star Repowise · 📥 Install bot · Silence on a single PR with [skip repowise] in the title · Per-repo toggle on repowise.dev/settings?tab=bot · Updated 2026-08-24 13:44 UTC

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.

[Bug] stale structural file_page rows survive repowise update when repo is already up to date*

1 participant