Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
fix(update): stop the first update after init rebuilding every page (#2765)
Raghav Chamadiyaa3dbd139bd2d
diff --git a/packages/cli/src/repowise/cli/editor_integrations/vscode.py b/packages/cli/src/repowise/cli/editor_integrations/vscode.pyindex 1bc871927..bba77b7bb 100644--- a/packages/cli/src/repowise/cli/editor_integrations/vscode.py+++ b/packages/cli/src/repowise/cli/editor_integrations/vscode.py@@ -44,6 +44,11 @@ class VSCodeSetup:) -> None:if self.project_file_id in options.disabled_project_files:return+ # A refresh keeps a wired workspace current; it never creates one. An+ # init that skipped editor setup would otherwise get .vscode files+ # from its first update.+ if not vscode_target.detect(repo_path):+ return_write_vscode_files(console_obj, repo_path)diff --git a/packages/core/src/repowise/core/repo_config.py b/packages/core/src/repowise/core/repo_config.pyindex 4b822398f..68f24399d 100644--- a/packages/core/src/repowise/core/repo_config.py+++ b/packages/core/src/repowise/core/repo_config.py@@ -37,7 +37,10 @@ CONFIG_DEPENDENCY_KEYS: dict[str, frozenset[str]] = {"enable_onboarding",}),- "state_only": frozenset({"distill", "mcp"}),+ # Agent-surface preferences. init records `hooks` and `editor_files` after+ # it fingerprints the config, so leaving them in "other" turned the first+ # update after every init into a full rebuild.+ "state_only": frozenset({"distill", "editor_files", "hooks", "mcp"}),}diff --git a/tests/integration/test_cli.py b/tests/integration/test_cli.pyindex 9203fc4c4..09951d1c7 100644--- a/tests/integration/test_cli.py+++ b/tests/integration/test_cli.py@@ -1042,6 +1042,62 @@ class TestUpdateConfigChangeDetection:assert "Config files changed" in r2.outputassert "health re-score complete" in r2.output.lower()+ _HEADLESS_INIT = (+ "--no-prose",+ "--embedder",+ "mock",+ "--no-editor-setup",+ "--no-hook",+ "--no-agents",+ "--no-codex",+ "--no-claude-md",+ "--no-workspace",+ "--no-distill-hook",+ "-y",+ )++ def test_first_update_after_headless_init_rebuilds_nothing(self, runner, git_work_repo):+ """The opt-outs init records after fingerprinting are not index inputs.++ ``--no-distill-hook`` and the editor-file opt-outs land in config.yaml+ after init stamps the fingerprint. Their ``hooks`` / ``editor_files``+ keys used to fall in the unknown-key bucket, so the first update read+ them as a traversal change and re-rendered and re-embedded every page.+ """+ r0 = runner.invoke(+ cli, ["init", str(git_work_repo), *self._HEADLESS_INIT], catch_exceptions=False+ )+ assert r0.exit_code == 0, r0.output+ import yaml++ cfg = yaml.safe_load((git_work_repo / ".repowise" / "config.yaml").read_text("utf-8"))+ assert "hooks" in cfg and "editor_files" in cfg++ from repowise.cli.helpers import release_update_lock++ args = ["update", str(git_work_repo), "--index-only", "--no-workspace", "--no-agents"]+ r1 = runner.invoke(cli, args, catch_exceptions=False)+ # A real run drops its lock at exit; these share one process.+ release_update_lock(git_work_repo)+ assert r1.exit_code == 0, r1.output+ assert "Config files changed" not in r1.output+ assert "Pages to regenerate" not in r1.output+ assert "Re-rendered" not in r1.output+ assert not (git_work_repo / ".vscode").exists()++ r2 = runner.invoke(cli, args, catch_exceptions=False)+ release_update_lock(git_work_repo)+ assert "Already up to date" in r2.output++ # A setting the index does depend on still triggers the rebuild.+ cfg["exclude_patterns"] = ["tests/**"]+ (git_work_repo / ".repowise" / "config.yaml").write_text(+ yaml.safe_dump(cfg, sort_keys=False), encoding="utf-8"+ )+ r3 = runner.invoke(cli, args, catch_exceptions=False)+ assert r3.exit_code == 0, r3.output+ assert "Config files changed" in r3.output+def test_init_stamps_the_rescore_cadence_so_the_next_update_skips_it(self, runner, git_work_repo):diff --git a/tests/unit/cli/test_vscode_setup.py b/tests/unit/cli/test_vscode_setup.pyindex 61cfd8e01..20552fc46 100644--- a/tests/unit/cli/test_vscode_setup.py+++ b/tests/unit/cli/test_vscode_setup.py@@ -200,6 +200,12 @@ def test_vscode_setup_refresh_rewrites_idempotently(tmp_path: Path) -> None:assert (tmp_path / ".vscode" / "extensions.json").read_text(encoding="utf-8") == ext_first+def test_vscode_setup_refresh_never_creates_the_workspace_files(tmp_path: Path) -> None:+ VSCodeSetup().refresh_project_files(_silent_console(), tmp_path, EditorSetupOptions())++ assert not (tmp_path / ".vscode").exists()++def test_vscode_setup_refresh_skips_when_disabled(tmp_path: Path) -> None:VSCodeSetup().refresh_project_files(_silent_console(),diff --git a/tests/unit/test_repo_config_invalidation.py b/tests/unit/test_repo_config_invalidation.pyindex d95e8aa55..821e9493a 100644--- a/tests/unit/test_repo_config_invalidation.py+++ b/tests/unit/test_repo_config_invalidation.py@@ -35,6 +35,8 @@ def test_dependency_fingerprints_classify_config_keys(tmp_path: Path) -> None:("traversal", {"exclude_patterns": ["generated/**"]}),("generation", {"provider": "openai"}),("generation", {"enable_onboarding": False}),+ ("state_only", {"hooks": {"read_skeleton": False}}),+ ("state_only", {"editor_files": {"claude_md": False}}),("other", {"future_setting": True}),]for expected, change in cases: