fix: support custom canonical compose filenames#2285
Merged
Conversation
Member
Author
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Contributor
|
Container images for this PR have been built successfully!
Built from commit 3f1ad02 |
f277219 to
6cbca98
Compare
6cbca98 to
3f1ad02
Compare
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.

Checklist
mainbranchWhat This PR Implements
Fixes:
Changes Made
Testing Done
./scripts/development/dev.sh startjust lint all)just test backendAI Tool Used (if applicable)
AI Tool:
Assistance Level:
What AI helped with:
I reviewed and edited all AI-generated output:
I ran all required tests and manually verified changes:
Additional Context
Disclaimer Greptiles Reviews use AI, make sure to check over its work.
To better help train Greptile on our codebase, if the comment is useful and valid Like the comment, if its not helpful or invalid Dislike
To have Greptile Re-Review the changes, mention
greptileai.Greptile Summary
This PR adds support for custom canonical compose filenames (e.g.
radarr.yaml,sonarr.yaml) by extendingDetectComposeFilewith a priority-tiered detection strategy (dir-name match → stem contains "compose" → single valid YAML) and addingHasComposeRootKeysInFileto validate candidates by checking for top-levelservicesorincludekeys. It also introducesRemoveStaleComposeFilesandDirectorySyncContentsChangedto keep the GitOps directory sync path clean when the canonical compose filename changes.Confidence Score: 5/5
Safe to merge — the core detection and cleanup logic is correct and well-tested; remaining findings are P2 quality improvements.
All P0/P1 concerns from the prior review have been addressed: unexported functions now carry the Internal suffix, and non-compose YAML files are filtered via HasComposeRootKeysInFile before being returned as compose candidates. The two new findings are P2: a missed-redeploy edge case when switching between custom filenames (files are still written correctly) and a missing debug log for unreadable candidate files. Neither blocks correct behavior.
backend/pkg/projects/fs_util.go — the stale-custom-compose detection gap in DirectorySyncContentsChanged is worth a follow-up.
Vulnerabilities
No security concerns identified. The new file-reading logic (
HasComposeRootKeysInFile) does not expose new attack surface — it reads files within already-validated project directories and parses them as YAML without executing any content.Comments Outside Diff (1)
backend/internal/services/gitops_sync_service.go, line 1578-1598 (link)removeStaleComposeFilesInternaldoes not clean up stale custom compose filenamesThis function iterates only over
projects.ComposeFileCandidates()(the six standard filenames). If a project's staged directory already contains a custom compose file (e.g.radarr.yamlfrom a previous sync whoseSyncedFilesrecord has been lost or was never written), and the new sync also uses a different custom filename (e.g.sonarr.yaml), neither will match the standard candidates list — the old custom file will survive the cleanup. Later,DetectComposeFilewill see two custom YAML files and return"multiple custom compose files found", breaking the sync.The function should also scan the staged directory for other custom YAML files that match
IsProjectFilecriteria, removing them when they are neither the currentcomposeFileNamenor a member ofsyncedFiles:Prompt To Fix With AI
Prompt To Fix All With AI
Reviews (2): Last reviewed commit: "fix: support custom canonical compose fi..." | Re-trigger Greptile