Skip to content

fix: select groups depending on changed shared files in --auto-scope - #104

Merged
amannocci merged 1 commit into
mainfrom
fix/auto-scope-shared-dependencies
Oct 16, 2026
Merged

amannocci merged 1 commit into
mainfrom
fix/auto-scope-shared-dependencies

Conversation

@amannocci

Copy link
Copy Markdown
Member

🧑‍💻What is the change being made?

--auto-scope now selects every resource group whose manifest dependencies reference a changed file under shared/. A dependency source that is a directory matches any file inside it. The matches are merged with the existing path-ancestry matches, so a group changed both directly and through shared is selected once. Manifests are only read when at least one changed file is below shared/.

❓ Why is the change being made?

--auto-scope mapped each changed file to its nearest ancestor directory containing a manifest.yml. Files in shared/ sit outside every resource group, so they were silently dropped: editing a shared provider file made terranova plan -A select nothing, even though every group symlinking it was affected, and a CI job would pass without planning anything.

✅ How has this been tested?

Added four integration tests in tests/it/test_helpers.py (TestAutoScopeSharedDependencies) using real git repositories: a changed shared file selects all dependent groups, a directory source matches by prefix, an unreferenced shared file selects nothing, and a group changed directly and through shared is listed once. The full tests/it suite passes (371 tests), and ruff and basedpyright are clean on the changed files.

📚 How has this been documented?

Added a bullet to the "How to scope a run to what changed" section of the README describing the shared-directory behavior. The auto_scope_resource_dirs docstring was updated as well.

🔗 Related Issues

Partially addresses #103 (shared-file case only). The --base <ref> option and opt-in dependents expansion described there are not part of this PR, so the issue stays open.

A change below the shared directory was dropped because it is outside
every resource group. Map it to the groups whose manifest dependencies
reference it, matching directory sources by prefix.
@amannocci amannocci self-assigned this Oct 16, 2026
@amannocci
amannocci merged commit 0aa853c into main Oct 16, 2026
17 checks passed
@amannocci
amannocci deleted the fix/auto-scope-shared-dependencies branch October 16, 2026 17:43
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.

1 participant