fix(events): make undiverged honor module autoplanning#6428
Merged
Conversation
* fix: make undiverged honor module autoplanning Teach targeted undiverged checks to reuse Atlantis autoplanning impact resolution, including module dependencies and autodiscovered projects. Co-authored-by: OpenAI Codex <noreply@openai.com> Signed-off-by: Warren Krewenki <19960+krewenki@users.noreply.github.com> * chore(events): clarify diverged file logging Signed-off-by: Warren Krewenki <19960+krewenki@users.noreply.github.com> * fix(events): address PR review feedback\n\nSigned-off-by: Warren Krewenki <19960+krewenki@users.noreply.github.com> * fix(events): fall back to full undiverged check on resolver errors\n\nSigned-off-by: Warren Krewenki <19960+krewenki@users.noreply.github.com> --------- Signed-off-by: Warren Krewenki <19960+krewenki@users.noreply.github.com> Co-authored-by: OpenAI Codex <noreply@openai.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Aligns targeted undiverged command requirement behavior with Atlantis’s project selection logic so that default-branch divergence is evaluated based on actual project impact (including module autoplanning and autodiscovery), rather than only raw when_modified glob matching.
Changes:
- Introduces an
UndivergedProjectImpactResolverand wires it intoDefaultCommandRequirementHandlerfor targetedundivergedchecks. - Extends
WorkingDirwithGetDivergedFiles()and refactors targeted divergence checks to reuse that logic. - Adds focused unit tests for configured-project module impacts, autodiscovery impacts, unrelated changes, and resolver-error fallback; updates docs accordingly.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| server/server.go | Reuses a shared DefaultProjectFinder and wires the new impact resolver into the command requirement handler. |
| server/events/working_dir.go | Adds GetDivergedFiles() to WorkingDir and refactors targeted divergence checks to use shared diverged-file lookup. |
| server/events/command_requirement_handler.go | Adds resolver hook for targeted undiverged, with conservative fallback to full divergence check on errors. |
| server/events/undiverged_project_impact.go | Implements impact resolution mirroring Atlantis project selection (configured + autodiscovery + module autoplanning). |
| server/events/undiverged_project_impact_test.go | Adds unit coverage for module/autodiscovery impact scenarios and fallback behavior. |
| server/events/mocks/mock_working_dir.go | Updates generated mock to include GetDivergedFiles(). |
| server/events/mock_workingdir_test.go | Updates generated in-package mock to include GetDivergedFiles(). |
| runatlantis.io/docs/command-requirements.md | Documents updated targeted undiverged behavior and conservative fallback semantics. |
Signed-off-by: Rui Chen <rui@chenrui.dev>
chenrui333
reviewed
Apr 29, 2026
Signed-off-by: Rui Chen <rui@chenrui.dev>
Signed-off-by: Rui Chen <rui@chenrui.dev>
chenrui333
approved these changes
Apr 29, 2026
Member
|
Thanks @krewenki for your first contribution to Atlantis! |
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.
what
undivergedchecks use Atlantis project-impact resolution instead of only matching base branch changes against rawautoplan.when_modifiedpatterns.WorkingDir.GetDivergedFiles()path needed to map base branch changes to impacted projects.undivergeddocs and add focused coverage around module and autodiscovery cases.why
undivergedbehavior could miss relevant base branch changes when a project was impacted through module autoplanning rather than a direct file match.undivergedgate less accurate than Atlantis's own project selection logic, which is not a great split.tests
GOCACHE=/tmp/go-build go test ./server/events/...serverpackage still compiles withGOCACHE=/tmp/go-build go test ./server -run '^$'references
runatlantis.io/docs/command-requirements.md