Skip to content

feat: add --include-dependents to auto-scope - #108

Merged
amannocci merged 1 commit into
mainfrom
feat/auto-scope-include-dependents
Oct 21, 2026
Merged

amannocci merged 1 commit into
mainfrom
feat/auto-scope-include-dependents

Conversation

@amannocci

Copy link
Copy Markdown
Member

🧑‍💻 What is the change being made?

Adds an opt-in --include-dependents flag to terranova plan and terranova apply. After --auto-scope resolves the changed groups, the selection is expanded with every group that imports from them, directly or transitively. The closure is a pure function in graph.py (with_dependents), exposed to commands through expand_with_dependents in commands/helpers.py. The flag requires -A and fails with a usage error otherwise. destroy, docs and migrate don't get it.

❓ Why is the change being made?

When a producer group changed, groups consuming its outputs through imports were left out of the run. Their plans could be stale without anyone noticing. This was the last gap listed in #103, after the shared-file mapping (#104) and --base (#105).

✅ How has this been tested?

  • Unit tests for the closure (TestWithDependents): transitive importers, sources not included, empty roots.
  • Integration tests for expand_with_dependents, parametrized over a changed producer, consumer, chained group and unrelated group, plus an empty selection.
  • E2E: plan -A --include-dependents adds the importing group and orders producer before consumer. Both plan and apply reject the flag without -A.
  • Full suite (515 tests), ruff and basedpyright pass.

📚 How has this been documented?

Updated the "How to scope a run to what changed" section of the README with the flag, its plan/apply-only scope, and an example: terranova plan -A --base origin/main --include-dependents.

🔗 Related Issues

Closes #103.

Add an opt-in `--include-dependents` flag to `plan` and `apply` that
expands the `--auto-scope` selection with every group that imports,
directly or transitively, from a selected group.

Without it, a change to a producer group left its consumers out of the
run, so stale inputs could go unnoticed. The flag requires `-A`, and is
not offered on `destroy`, `docs` or `migrate`.
@amannocci amannocci self-assigned this Oct 21, 2026
@amannocci
amannocci merged commit 9671ab5 into main Oct 21, 2026
17 checks passed
@amannocci
amannocci deleted the feat/auto-scope-include-dependents branch October 21, 2026 09:05
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]: --auto-scope misses shared file changes, importing groups and CI base ref

1 participant