refactor: code quality improvements and bug fixes#12
Merged
veerendra2 merged 6 commits intomainfrom Apr 4, 2026
Merged
Conversation
Bug fixes: - Fix LabelAppVersion stamping containerd version instead of app version - Fix 7-char SHA used for equality comparison (now compares full hash) - Fix Infisical SecretPath help text copy-paste error - Unify label namespace under composeflux.* Code improvements: - Eliminate double LoadProject per stack in Sync() - Move dClient.Prune into reconciler's Prune method - Remove unnecessary SecretsCollection wrapper struct - Deduplicate cmd boilerplate via CommonConfig.Setup() - Extract isManagedStack helper for label checks - Split utils.go into focused files (discover.go, etc.) - Unexport internal cache methods and package-only constants - Fix Id vs ID naming convention in secrets package - Clean up zero-value inits and verbose returns Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Bump docker/cli v29.3.1, docker/compose v5.1.1, containerd v2.2.2, infisical/go-sdk v0.6.9, moby/moby/client v0.3.0. Replace deprecated Secrets().List() with Secrets().ListSecrets() to fix staticcheck SA1019 lint failure. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fix label names: compose.stack.* → composeflux.* namespace - Fix docker ps filter example to use new label format - Update AGENTS.md naming examples (CacheGet→Sync, LabelManagedBy→LabelManaged) - Fix Go version references (1.26.0→1.26.1, 1.25+→1.26+) - Update cacheClear reference to unexported form - Add missing "Automatic Image Updates" feature to docs/index.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR refactors ComposeFlux internals to simplify reconciliation flow, unify label semantics under composeflux.*, and modernize secrets fetching APIs, while also bumping several Docker/Compose-related dependencies.
Changes:
- Standardize stack management labels (
composeflux.managed=true,composeflux.stack-hash) and fix app version labeling. - Refactor reconciler to avoid redundant project loads, centralize pruning logic, and unexport internal cache helpers.
- Simplify secrets clients by removing
SecretsCollectionand returning[]Secretdirectly; bump Docker/Compose/containerd/Infisical/moby dependencies.
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/source/git.go | Uses full SHAs for comparisons and short SHAs for logging; unexports git constants. |
| pkg/secrets/infisical.go | Fixes config field naming/help text; updates SDK call and returns []Secret. |
| pkg/secrets/client.go | Removes SecretsCollection; changes FetchAll() to return []Secret. |
| pkg/secrets/bitwarden.go | Renames ID fields to OrgID/ProjectID; returns []Secret. |
| internal/reconcile/sync.go | Avoids double LoadProject; calls reconciler Prune(); unexports cache clear. |
| internal/reconcile/run.go | Removes Timers type (moved to reconcile.go); unchanged loop behavior. |
| internal/reconcile/reconcile.go | Hosts Timers and removes explicit zero-value initializations. |
| internal/reconcile/prune.go | Adds isManagedStack() and moves getStackStates() here; prunes Docker resources. |
| internal/reconcile/discover.go | Uses unexported cache accessor; removes moved checksum/state logic. |
| internal/reconcile/deploy.go | Unifies label namespace and fixes app version source; adds checksum helper. |
| internal/reconcile/cache.go | Unexports cache methods and relocates loadCache() into cache module. |
| go.mod | Bumps docker/cli, docker/compose, infisical/go-sdk, moby client; containerd becomes indirect. |
| go.sum | Updates sums for dependency bumps. |
| docs/Introduction.md | Updates documented hash label to composeflux.stack-hash. |
| docs/index.md | Adds feature bullet for scheduled image updates. |
| docs/GettingStarted.md | Updates docker label filter to composeflux.managed=true. |
| docs/Development.md | Updates Go prerequisite to 1.26+. |
| compose-dev.yml | Expands env var documentation/comments; aligns with new config surface. |
| cmd/composeflux/sync.go | Uses shared CommonConfig.Setup() instead of duplicating signal/version boilerplate. |
| cmd/composeflux/run.go | Uses shared CommonConfig.Setup() instead of duplicating signal/version boilerplate. |
| cmd/composeflux/common.go | Adds Setup() helper; updates validations to renamed ID fields; improves logging. |
| AGENTS.md | Updates Go version and reflects renamed labels/cache methods in conventions section. |
Comments suppressed due to low confidence (1)
internal/reconcile/discover.go:48
- Comment grammar:
discoverComposeStackis singular, but the sentence reads awkwardly. Consider rewording to e.g. “discoverComposeStack finds directories containing Docker Compose files.”
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Bug fixes:
LabelAppVersionstamping containerd version instead of app versionSecretPathhelp text copy-paste errorcomposeflux.*(composeflux.managed: true)Code improvements:
LoadProjectper stack inSync()dClient.Pruneinto reconciler'sPrune()methodSecretsCollectionwrapper —FetchAll()returns[]SecretCommonConfig.Setup()isManagedStack()helper for label checksutils.gointo focused files (discover.go, etc.)Id→IDnaming in secrets packageDependency bumps (supersedes #10):
Secrets().List()→Secrets().ListSecrets()Test plan
go vet ./...passesgo build ./...passes🤖 Generated with Claude Code