Repository navigation
fix(cli): gate checks the worktree it runs in, not the main checkout (#582) - #585
Merged
Merged
Conversation
This was referenced Sep 25, 2026
Closed
dan-petty
added a commit
that referenced
this pull request
Sep 25, 2026
…rktree everywhere (#612, #613) (#614) #585 fixed #582 for nested worktrees, but its resolver stopped at the first directory with its own .git. A clone under repos/ and each worktree of it then resolved to the clone, for the gate and for shared data, which landed in the clone's working tree. A nested worktree whose git directory was pruned, or whose checkout moved, still gated the main checkout. find_worktree_root now stops at the nearest linked worktree, live or stale, and otherwise keeps the workspace root, so the main checkout, clones under repos/, their worktrees and submodules resolve as before #585. main_worktree_root shares the workspace's data with them again. The gate names the root it checks before the cache lookup and for every single check, warns from a stale worktree with the fix for each cause, and resolves its root on each call instead of at import. Commands that read, index or deploy the current tree now use it too: repomap, the architecture diagram, the AST graph (which came back empty from a nested worktree), review auto-fix, tf deploys and Kube-linter locations. A tf deploy from a worktree that lacks the main checkout's untracked local state stops when auto-approved and asks otherwise, since apply would plan to create every resource again. Every case is tested against real git layouts, and an acceptance probe over eleven layouts matches the required gate and data roots. The #582 roadmap entry moves to v0.2.23 with a note on what #612 corrected. Closes #612 Closes #613
This was referenced Sep 25, 2026
dan-petty
added a commit
that referenced
this pull request
Sep 25, 2026
…eader, writer and cleanup (#616) (#618) #553 made shared data resolve under the main worktree, but several sites still anchored it at the top-most root or the current directory. From a linked worktree outside the checkout they read and wrote the worktree's own .data, so data split across worktrees and was lost with them: workspace clean (which also ignored data.dir and DEVOPS_CLI_DATA_DIR), the hallucination catalogue's relative DEVOPS_CLI_DATA_DIR, the benchmark and prompt-eval datasets (the benchmark silently fell back to baseline cases), model bundles, workspace discovery, the analysis and CI result caches, the library drift report, the dashboard, the controller and the sandbox logs and registry. Every one now resolves through resolve_data_path; prompt-eval verifies sources in the worktree it runs in. The CI result cache lives in the shared cache directory, one file per worktree, so a gate never trusts another worktree's result. workspace clean prunes the configured data directory, where data is written, and refuses anything that is not a dedicated data directory: system and top-level directories, the home directory and its parents, repositories and git directories, worktrees and their parents, directories holding tracked files or another repository, and another workspace's data, also through a symlink. A checkout or worktree below another repository still resolves shared data to the outer directory, as since before #585; strict xfail tests record it and #617 tracks it. Closes #616
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
Closes #582.
When running
devops ci,devops test,devops uv,devops release, ordevops scan complexityfrom a secondary or nested linked git worktree (created viagit worktree add):find_worktree_root()which detects.gitlinked worktree pointer files (gitdir:with validcommondir) and.gitdirectories, preventing gate commands from ascending past the worktree to the enclosing main checkout..gitfiles lacking acommondir(git submodules) continue resolving to their enclosing repository.main_worktree_root()to start resolution fromfind_worktree_root()and followcommondirdirectly to the primary checkout root for shared.data/directory resolution.Executing CI quality gates concurrently in {root}...indevops ciso the target root is clear to the caller.testCLI command by extracting_build_test_cmdhelper to lower cyclomatic complexity fromVerification
uv run pytest tests/test_repos.py tests/test_data_dir_worktrees.py tests/test_ci.py -v: All tests passed.uv run devops scan complexity src/devops_cli/core/repo.py src/devops_cli/commands/ci.py tests/test_repos.py tests/test_ci.py: Compliant (uv run devops ci: 100% passing status across all 10 quality gates.