Skip to content

fix(cli): resolve DB identity on delegated worktree updates (#746)#841

Open
paarthsikka wants to merge 2 commits into
repowise-dev:mainfrom
paarthsikka:fix/746-worktree-seed-db-identity
Open

fix(cli): resolve DB identity on delegated worktree updates (#746)#841
paarthsikka wants to merge 2 commits into
repowise-dev:mainfrom
paarthsikka:fix/746-worktree-seed-db-identity

Conversation

@paarthsikka

Copy link
Copy Markdown
Contributor
  • Strip REPOWISE_DB_URL from os.environ during delegated run_update so it honors the copied DB
  • Add atomic try/except rollbacks to seed staging and rename phases
  • Guard sweep_stale_seed_backups with an mtime staleness check
  • Pass full=False instead of full=force to prevent re-embedding everything on update
  • Skip updating entirely when dry_run=True to prevent bogus output
  • Persist --coverage setting explicitly provided in init to config.yaml

Summary

Related Issues

Fixes #746
Builds on #747

Test Plan

  • Tests pass (pytest)
  • Lint passes (ruff check .)
  • Web build passes (npm run build) (if frontend changes)

Checklist

  • My code follows the project's code style
  • I have added tests for new functionality
  • All existing tests still pass
  • I have updated documentation if needed

…-dev#746)

- Strip REPOWISE_DB_URL from os.environ during delegated run_update so it honors the copied DB
- Add atomic try/except rollbacks to seed staging and rename phases
- Guard sweep_stale_seed_backups with an mtime staleness check
- Pass full=False instead of full=force to prevent re-embedding everything on update
- Skip updating entirely when dry_run=True to prevent bogus output
- Persist --coverage setting explicitly provided in init to config.yaml
@repowise-bot

repowise-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

✅ Health: 7.6 (unchanged)

📋 At a glance
1 file changed health · 4 hotspots touched · 5 new findings introduced · 5 co-change pairs left out · 3 files with recent fix history.

Files & modules (2)
  • packages (3 files)
    • .../cli/worktree.py
    • .../init_cmd/command.py
    • .../update_cmd/command.py
  • tests (1 file)
    • tests/integration/test_cli.py

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

  • more lines added than baseline
  • more scattered than baseline

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

File Score Δ Why
.../cli/worktree.py 8.3 → 5.7 ▼ -2.6 🔻 introduced nested complexity, error handling, primitive obsession · ✅ resolved io in loop

💡 .../cli/worktree.py: Flatten the control flow. Pull early-return guards to the top, extract the deepest branch into a helper, and consider replacing nested conditionals with a strategy table or dispatch dict.

🔎 More signals (2)

🔥 Hotspots touched (4)

  • .../cli/worktree.py — 1 commits/90d, 3 dependents · primary owner: Raghav Chamadiya (100%)
  • .../init_cmd/command.py — 19 commits/90d, 1 dependents · primary owner: Raghav Chamadiya (93%)
  • tests/integration/test_cli.py — 9 commits/90d, 1 dependents · primary owner: Raghav Chamadiya (48%)
1 more
  • .../update_cmd/command.py — 19 commits/90d, 4 dependents · primary owner: Raghav Chamadiya (90%)

🔗 Hidden coupling (2 files)

  • .../init_cmd/command.py co-changes with these files (not in this PR):
    • docs/CLI_REFERENCE.md (9× — 🟢 routine)
    • .../init_cmd/workspace.py (7× — 🟢 routine)
    • docs/USER_GUIDE.md (5× — 🟢 routine)
  • .../update_cmd/command.py co-changes with these files (not in this PR):
    • .../update_cmd/persistence.py (8× — 🟢 routine)
    • docs/CLI_REFERENCE.md (6× — 🟢 routine)

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

@RaghavChamadiya

Copy link
Copy Markdown
Member

Nice fix on the DB identity leak, but two blockers before merge:

  1. save_config_partial(repo_path, coverage=coverage_pct) writes a float under the coverage key, which is already used for the coverage-report ingestion block (CoverageConfig.from_repo_config expects a dict there and silently falls back to defaults if it isn't). It also isn't read back anywhere on update, so it clobbers real config without doing anything. Needs a different key (e.g. coverage_pct) plus a reader in run_update, or drop the persistence.
  2. The delegation now passes full=False instead of full=force. full was only ever True when the user explicitly passed --force, so this just silently ignores the flag. Please restore full=force.

Smaller things: the new except Exception in the seed staging loop swallows errors with no message (the sibling branches all print a fallback notice); the 1h mtime gate doesn't really work for .repowise.bak.* since rename preserves mtime (keep unconditional sweep for those, gate only the seed temp dirs); the env-strip loop should reuse DB_ENV_VARS from core persistence instead of hardcoding the tuple; and there are a few trailing-whitespace lines that ruff format will churn.

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] worktree seed + delegated update writes new-file pages to the wrong DB / repo identity (not a selection-budget issue)

3 participants