Repository navigation
fix(version): exclude draft GitHub releases from Version Tracker resolution - #2900
Conversation
…lution github-releases datasource resolution could pick an unpublished draft release instead of the latest published one when the GitHub token had repo write access (e.g. secrets.GITHUB_TOKEN in CI). GetReleases now filters out drafts unconditionally, alongside the existing prerelease filter, fixing the Version Tracker resolver, `atmos version list`, and GetReleaseVersions at the shared root cause.
render.go and apply.go were added in the same commit that introduced the Version Tracker (#2664); render was marked Deprecated/Hidden from day one and has never had a non-deprecated existence in any release, so it never needs a migration path. Relocates the shared renderTemplate helper into apply.go (its only remaining consumer) and removes the now-dead manager.RenderFile helper and render-specific sentinel errors. Also fixes pre-existing EditorConfig indentation drift in docs/prd/atmos-version-management.md (3-space list/fence indents under numbered items instead of the required 2-space multiple), surfaced by this branch's `--affected` validation once the file was touched.
Adds worked before/after examples for the marker and github-actions file managers (including SHA pinning) to the version.files reference, and adds Helm/Container-component tabs to the !version function docs alongside the existing Terraform example, so each supported component type has a concrete resolution example rather than relying solely on the Terraform case.
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
Dependency Review✅ No vulnerabilities or license issues found.Scanned FilesNone |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe change removes the deprecated version render command, moves template rendering into ChangesVersion render command cleanup
Draft release filtering
Version-management documentation
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pkg/github/releases_test.go (1)
623-630: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAssert exact release values and order.
assert.Lenandassert.Falsedo not verify which releases were returned or whether input order was preserved. Add expected tag values to each table case and compare them by index.As per coding guidelines, slice results must assert element values rather than only length.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/github/releases_test.go` around lines 623 - 630, Add expected tag values to each table-driven case in the filterDrafts tests, then replace the length-only validation with indexed assertions comparing each result’s tag to the expected tag at the same position. Preserve the existing non-draft assertion and verify the returned order matches the input order.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@pkg/github/releases_test.go`:
- Around line 623-630: Add expected tag values to each table-driven case in the
filterDrafts tests, then replace the length-only validation with indexed
assertions comparing each result’s tag to the expected tag at the same position.
Preserve the existing non-draft assertion and verify the returned order matches
the input order.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 95e22826-2ed3-47f7-8002-c69e715c571f
📒 Files selected for processing (13)
cmd/version/track/apply.gocmd/version/track/render.gocmd/version/track/track.gocmd/version/track/track_test.godocs/fixes/2026-08-06-version-track-remove-render-command.mddocs/fixes/2026-08-06-version-tracker-github-releases-draft-exclusion.mddocs/prd/atmos-version-management.mderrors/errors.gopkg/github/releases.gopkg/github/releases_test.gopkg/version/manager/context.gowebsite/docs/cli/configuration/version/files.mdxwebsite/docs/functions/yaml/version.mdx
💤 Files with no reviewable changes (4)
- errors/errors.go
- cmd/version/track/render.go
- pkg/version/manager/context.go
- cmd/version/track/track_test.go
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2900 +/- ##
==========================================
+ Coverage 82.80% 82.81% +0.01%
==========================================
Files 1867 1866 -1
Lines 181308 181277 -31
==========================================
- Hits 150140 150133 -7
+ Misses 23352 23329 -23
+ Partials 7816 7815 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Length-only assertions let filterDrafts silently drop or reorder the wrong releases; assert each result's tag against the expected order.
- Replace before/after tabs in files.mdx with one tab per distinct scenario (single tool, multiple tools, YAML, custom match pattern, version bump, pinned to SHA), and show both trailing and standalone marker comment forms for the match= example. - Use current tool versions in examples instead of stale ones. - Rename the "Non-Dockerfile Format" tab to "YAML" to name what the example is instead of what it isn't. - Clarify in version.mdx that !version only resolves inside stack manifests, not in atmos.yaml or arbitrary YAML files.
|
CodeRabbit (@coderabbitai) full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
pkg/github/releases_test.go (1)
582-635: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winCover the public
GetReleasespipeline.These cases validate
filterDrafts, but they do not prove thatGetReleasesinvokes it beforeapplyPagination. If existing mock-server tests do not already cover this path, extend one with a newer draft, a published release, andLimit=1; assert that the published release is returned.As per coding guidelines, new features must include comprehensive unit tests and integration tests when possible.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pkg/github/releases_test.go` around lines 582 - 635, The tests currently cover filterDrafts directly but not the public GetReleases pipeline or its filtering-before-pagination order. Extend an existing mock-server GetReleases test, or add one if needed, with a newer draft and a published release, set Limit=1, and assert the published release is returned, proving GetReleases filters drafts before applyPagination.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/fixes/2026-08-06-version-tracker-github-releases-draft-exclusion.md`:
- Around line 17-19: Update the permission statement in the version-tracker
explanation to clarify that repository CI reproduces the issue only when its
GITHUB_TOKEN has sufficient repository permissions to view draft releases,
rather than implying every repository token has that access.
In `@website/docs/cli/configuration/version/files.mdx`:
- Line 188: Update the actions/checkout entry in the documented configuration
example to use the SHA from the v6 lock entry, and ensure its trailing version
comment remains v6.1.0 so the pinned revision matches the documented desired
major version.
---
Nitpick comments:
In `@pkg/github/releases_test.go`:
- Around line 582-635: The tests currently cover filterDrafts directly but not
the public GetReleases pipeline or its filtering-before-pagination order. Extend
an existing mock-server GetReleases test, or add one if needed, with a newer
draft and a published release, set Limit=1, and assert the published release is
returned, proving GetReleases filters drafts before applyPagination.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: a0a3b057-0e7c-440c-8e05-61e2753a3549
📒 Files selected for processing (13)
cmd/version/track/apply.gocmd/version/track/render.gocmd/version/track/track.gocmd/version/track/track_test.godocs/fixes/2026-08-06-version-track-remove-render-command.mddocs/fixes/2026-08-06-version-tracker-github-releases-draft-exclusion.mddocs/prd/atmos-version-management.mderrors/errors.gopkg/github/releases.gopkg/github/releases_test.gopkg/version/manager/context.gowebsite/docs/cli/configuration/version/files.mdxwebsite/docs/functions/yaml/version.mdx
💤 Files with no reviewable changes (4)
- cmd/version/track/render.go
- errors/errors.go
- pkg/version/manager/context.go
- cmd/version/track/track_test.go
- Qualify the GITHUB_TOKEN permission claim in the draft-exclusion fix log: repo CI only sees drafts when its token permissions grant read access to contents, not unconditionally. - Fix the pinned-SHA example in files.mdx: the SHA labeled v6.1.0 was actually actions/checkout's v5.0.0 release commit. Swapped in the correct SHA for the v6.1.0 tag.
Bump pnpm overrides to patched versions, all within their existing major line (not blocked by dependabot.yml's semver-major ignore): - js-yaml 3.15.0 -> 3.15.1 (GHSA-5p4m-2wfm-xmqj, high) - js-yaml 4.3.0 -> 4.3.1 (high) - mermaid 11.16.0 -> 11.16.1 (4 advisories: 1 low, 3 moderate)
…er log Windows acceptance tests timed out at exactly the 60m step budget (started 19:04:21, `go test` itself finished 20:03:56 with every package printing `ok`, endgroup at 20:04:21, force-cancelled 17s later at 20:04:38). No test failure -- just CI-to-CI variance on a budget with no headroom, the same flake pattern already documented here from an earlier 45m->60m bump. Give windows-latest its own 80m step budget (matrix-conditional expression; macOS stays at 60m, where it comfortably finishes in ~35m today) and raise the job-level ceiling from 120m to 140m to preserve the same headroom-above-step-budget-sum margin the existing comment establishes for Linux and macOS.
|
Important Cloud Posse Engineering Team Review RequiredThis pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes. To expedite this process, reach out to us on Slack in the |
…udposse#2880) * fix(steps): resolve relative paths against step.WorkingDirectory The archive, file, workdir, junit, and container build step handlers resolved relative source/destination/path/glob/context fields via template substitution only, then let filesystem calls resolve them against the Atmos process's own cwd instead of step.WorkingDirectory. This surfaced most visibly for `type: archive` hooks, since the hooks engine correctly defaults working_directory to the component path but the handler never read it back. Add a shared BaseHandler.ResolveInWorkingDirectory helper that anchors a relative resolved value to step.WorkingDirectory (falling back to process cwd when unset, matching prior behavior), and apply it across the five affected handlers. container_build.go additionally anchors Dockerfile to the resolved Context rather than WorkingDirectory directly, matching Docker's own convention. Co-Authored-By: Claude Sonnet 5 <[email protected]> * docs(fixes): add fix record for step WorkingDirectory bug Co-Authored-By: Claude Sonnet 5 <[email protected]> * test(runner/step): close coverage gaps in ResolveInWorkingDirectory and loadReport Codecov flagged handler_base.go and junit.go below the 85% patch-coverage threshold. Add a case that exercises the relative (non-template) WorkingDirectory branch in resolveWorkingDirectory, and a junit test that triggers a WorkingDirectory template-resolution error from inside loadReport's per-pattern loop, distinct from the already-covered `files` template error path. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(steps): anchor container bake/cache paths and preserve workflow error context A field test of the WorkingDirectory fix found the container_build.go handler was only partially fixed: build.bake.file/bake.files and cache.from/cache.to type: local src/dest still resolved against the Atmos process's own cwd instead of step.WorkingDirectory, reproduced live as a silent build against the wrong bake file. Both now route through ResolveInWorkingDirectory like context/dockerfile already do. Also root-caused and fixed a separate defect surfaced while verifying error output: buildWorkflowStepError dual-wrapped step errors with fmt.Errorf before building the final error, and cockroachdb/errors treats that Go 1.20 multi-error shape as an opaque leaf node, silently dropping any hints/context a handler attached deeper in the chain. Switched to WithCause, which extracts them eagerly. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(steps): anchor container bake/cache paths and preserve workflow error context Address CodeRabbit findings on PR cloudposse#2880: - Remove the host-specific /tmp/atmos-field-test/ path from the fix doc, replacing it with a worktree-relative fixture reference. - Split TestBuildWorkflowStepError and TestBuildWorkflowStepErrorPreservesInnerHintsAndContext out of workflow_utils_test.go into a focused workflow_step_error_test.go, keeping step-error tests co-located and out of the oversized (pre-existing) workflow_utils_test.go file. Co-Authored-By: Claude Sonnet 5 <[email protected]> * test(runner/step): close container_build.go coverage gaps from bake/cache anchoring Codecov flagged container_build.go's patch coverage below 85% after the bake/cache anchoring follow-up. Add regression tests for the three previously-uncovered error branches: resolveBakeFiles propagating a per-entry template failure, anchorCacheLocalPaths' own resolve failure, and that failure propagating out through resolveBuildCache. handler_base.go's remaining gap (os.Getwd/filepath.Abs failing inside resolveWorkingDirectory) is left uncovered deliberately -- it requires corrupting the process's own working directory to reach, has no DI seam, and matches this repo's existing untested pattern for the identical os.Getwd/filepath.Abs fallback in container_run.go. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(docs): exclude reproducible-builds.org from link checking (CI connection refused) CI's Check Markdown Links job failed on docs/prd/archive-step.md's citation of the SOURCE_DATE_EPOCH origin -- the CI runner's outbound request was refused while the page returns 200 OK outside CI. Follows the repo's existing precedent for excluding CI-hostile hosts (docs.docker.com, otelic.com, taskfile.dev, etc.) in lychee.toml. Co-Authored-By: Claude Sonnet 5 <[email protected]> * feat(hooks): anchor bare-relative working_directory to the component An explicit working_directory: on a kind: step/kind: steps hook was always resolved against the Atmos process's own cwd, regardless of shape. Following docs/prd/base-path-resolution-semantics.md's existing Dot/Bare convention: a dot-prefixed value (., .., ./x, ../x) keeps resolving against the process cwd; a bare relative value (x, x/y) now resolves against the component's own working directory instead -- the same directory ComponentPath(ctx) already computes for the unset-default case, so this stays compatible with provisioned working directories and metadata.component aliasing for free. Workflows and custom commands are unaffected -- they have no "current component" concept, so bare-relative values there still resolve against the process cwd exactly as before. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(security): remediate 7 open Dependabot alerts Bump pnpm.overrides floors for transitive npm dependencies flagged by Dependabot (all patch/minor bumps within the same major, not blocked by dependabot.yml's major-version ignore policy): - js-yaml 3.15.0 -> 3.15.1 (cloudposse#269, GHSA-5p4m-2wfm-xmqj: quadratic CPU consumption in !!omap resolution, high) - js-yaml 4.3.0 -> 4.3.1 (cloudposse#268, same advisory, 4.x line, high) - mermaid 11.16.0 -> 11.16.1 (cloudposse#267, cloudposse#266, cloudposse#265, cloudposse#264, cloudposse#263: five advisories ranging low-medium) NOTICE unchanged (no license changes). Verified: pnpm install regenerated website/pnpm-lock.yaml with the bumped versions resolved, atmos fix lint (patch-scoped, no Go files touched) is a no-op, and cd website && npm run build succeeds with no new broken links. Co-Authored-By: Claude Sonnet 5 <[email protected]> * docs(fixes): fix markdownlint MD018 in working-directory fix record Address CodeRabbit finding on PR cloudposse#2880: a paragraph wrap left "cloudposse#2880):" at the start of a line, which markdownlint's atx-heading rule (MD018) flags as a heading missing a space after the hash. Rewrap so the line doesn't start with a bare hash-prefixed token. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(runner/step): close remaining working_directory anchoring gaps Found by field-testing the working_directory fix against real hooks, workflows, and a live docker build instead of just unit tests: - workdir step: `source` (local relative path) now anchors to `working_directory` via a new `sourceprov.WithBaseDir` option, matching `path`'s existing anchoring instead of silently falling back to the process cwd. - workflow-level `working_directory:` default now reaches extended step types (archive/file/junit/workdir/container), not just shell/exec/atmos steps, which silently ignored it before. - step-level `working_directory` now expands a leading `~`, matching the tilde expansion --chdir already gets. - Corrected agent-skills/atmos-steps and the workflow/hooks docs, which claimed a single blanket CWD-vs-base_path rule that doesn't match actual per-surface behavior. Co-Authored-By: Claude Sonnet 5 <[email protected]> * docs(steps): document handler-field and unset-hook working_directory contracts Addresses CodeRabbit feedback on PR cloudposse#2880: state that relative handler fields (source, destination, path, files, context) resolve against the already-resolved working_directory, that a container Dockerfile resolves relative to context rather than working_directory directly, and that an unset kind: step hook working_directory (not just a bare value) anchors to the component's own working directory. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(runner/step): isolate CI base-resolution test from ambient GITHUB_EVENT_PATH TestSetDescribeAffectedFlagValueInCliArgs_BaseResolution's merge_group subtest only overrode GITHUB_ACTIONS/GITHUB_EVENT_NAME/GITHUB_BASE_REF, so it depended on $GITHUB_EVENT_PATH being unset in the ambient environment. That's true for local/regular CI runs, but not when the test itself runs inside a real GitHub Actions merge_group job (i.e. the merge queue): the real event payload's merge_group.base_sha then takes precedence over the simulated GITHUB_BASE_REF, resolving to a SHA instead of the "refs/remotes/origin/main" ref the test asserts. This was failing the merge queue for this PR and, independently, for cloudposse#2900 and cloudposse#2903 as well -- confirmed pre-existing and unrelated to any of their changes. Fixed by explicitly forcing GITHUB_EVENT_PATH="" so the subtest deterministically exercises the fallback path it's meant to test, regardless of the real job's event context. Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix(security): remediate 5 of 7 open Dependabot alerts - github.com/go-git/go-git/v5: v5.19.1 -> v5.19.2, fixing GHSA-hc8v-wwc9-vgxm (symlink traversal in worktree operations) and the companion malicious reference-name advisory (cloudposse#270, cloudposse#271). Patch-level bump, no API changes. - website: dompurify pnpm override ^3.4.12 -> ^3.4.13, fixing an IN_PLACE hook removal XSS (cloudposse#272). - website: nanoid pnpm overrides bumped to ^3.3.17 (added a second selector, nanoid@^3.3.16, to also catch postcss's own nanoid range, which the existing [email protected] selector didn't match), fixing two indefinite-loop DoS advisories (cloudposse#273, cloudposse#274). The nanoid 5.x line was already patched by the existing override. - NOTICE regenerated for the go-git/dompurify/nanoid version bumps. Not fixed: image-size (cloudposse#275, cloudposse#276, both DoS via infinite loop) has no patched release yet as of this commit -- GitHub's advisories list "<= 2.0.2" as vulnerable with no first_patched_version. Left as-is pending an upstream fix. Co-Authored-By: Claude Sonnet 5 <[email protected]> --------- Co-authored-by: Claude Sonnet 5 <[email protected]> Co-authored-by: Andriy Knysh <[email protected]>
|
💥 This pull request now has conflicts. Could you fix it Erik Osterman (Cloud Posse) (@osterman)? 🙏 |
…k-github-drafts # Conflicts: # website/package.json # website/pnpm-lock.yaml
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
|
These changes were released in v1.226.0-rc.5. |
what
pkg/github.GetReleasesnow excludes draft GitHub releases unconditionally, alongside the existing prerelease filter. This fixes the Version Tracker'sgithub-releasesdatasource resolver,atmos version list, andGetReleaseVersions, which all share this function.atmos version track rendersubcommand. It was markedDeprecated/Hiddenin the same commit that introduced it and has never had a non-deprecated existence in any release, so no migration path is needed. The sharedrenderTemplatehelper moves intoapply.go, its only remaining consumer.docs/prd/atmos-version-management.md, surfaced once the file was touched by this branch's--affectedvalidation.version.filesand!versionfunction docs with worked before/after examples for themarkerandgithub-actionsfile managers (including SHA pinning) and adds Helm/Container-component examples alongside the existing Terraform one.why
atmos version trackwithdatasource: github-releasesanddesired: latestcould resolve to an unpublished draft release instead of the actual latest published release, whenever the GitHub token had repo write access (e.g.secrets.GITHUB_TOKENin a repo's own CI). Reproduced againstcloudposse/atmositself:atmos version track lockresolved tov1.226.0, whichgh release view v1.226.0 --repo cloudposse/atmos --json isDraftconfirmed was a draft, when the real latest published release wasv1.225.0. Unlike prerelease, there's no legitimate case for ever resolving to a draft, so it's excluded unconditionally rather than gated behind a new opt-in policy field.atmos version track renderwas superseded byapply/the file-managers architecture within its own introducing PR and has been carried as dead weight across multiple releases; removing it avoids maintaining a command with no live users.!versionbehavior easier to learn from concrete examples rather than a single terse case.references