Repository navigation
fix(auth): unwrap Atmos Pro envelope in github/sts mint - #2568
Conversation
The github/sts integration decoded the mint response directly into the
flat stsResponse struct, reading top-level `tokens`/`excluded`. But every
Atmos Pro API route returns the canonical envelope `{success, status,
data: {...}}`, so tokens are nested under `data`. The flat decode always
yielded 0 tokens: the CLI logged "GitHub STS: no tokens granted", never
wrote the git insteadOf config, and cross-repo imports fell back to the
ambient GITHUB_TOKEN and 404'd — even though the server minted a token.
- Route mint() through a new shared `pro.DecodeEnvelope[T]` helper and
honor `success` (surface EffectiveErrorMessage on 200-with-success=false)
- Add generic `dtos.Envelope[T]` type + `pro.DecodeEnvelope[T]` decoder so
every Pro response unwraps `data` through one sanctioned primitive
- Fix the bug-masking test fixture (stsServer now emits the real envelope)
and add a regression test asserting mint persists 1 token, not 0
- Add envelope decoder tests, including a canary proving a flat payload
decodes to empty data — pinning why the envelope is mandatory
Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
Dependency Review✅ No vulnerabilities or license issues found.Scanned FilesNone |
|
Too much diff to scan? Review this PR in Change Stack to start with the highest-impact changes. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughAdds a generic ChangesEnvelope Infrastructure and Integration
Credential Broker and Git insteadOf Handling
Git update/ref handling and importer tests
Fix documentation
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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/pro/envelope.go (1)
14-20: 💤 Low valueConsider wrapping the decode error.
The function returns the raw
json.Decodeerror. As per coding guidelines, errors should be wrapped with static errors fromerrors/errors.go. The caller currently provides context-specific wrapping (e.g.,ErrSTSMintFailedin sts.go), which works, but a generic wrapper at this layer would make the error origin clearer.Suggested approach
If a generic Pro API decode error exists or is added to
errors/errors.go:func DecodeEnvelope[T any](r io.Reader) (*dtos.Envelope[T], error) { var env dtos.Envelope[T] if err := json.NewDecoder(r).Decode(&env); err != nil { - return nil, err + return nil, fmt.Errorf("%w: %w", errUtils.ErrProAPIDecodeFailed, err) } return &env, nil }Note: This assumes
ErrProAPIDecodeFailedis added toerrors/errors.go.As per coding guidelines, all errors must be wrapped using static errors from
errors/errors.go.🤖 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/pro/envelope.go` around lines 14 - 20, DecodeEnvelope currently returns the raw json decode error; wrap that error with the package static sentinel from errors/errors.go (e.g. ErrProAPIDecodeFailed) before returning so callers can identify decode failures. In DecodeEnvelope, replace the direct return of err with a wrapped error such as using fmt.Errorf("%w: %v", errors.ErrProAPIDecodeFailed, err) (or your project's preferred wrap helper) and keep returning (&env, nil) on success; reference function DecodeEnvelope and sentinel ErrProAPIDecodeFailed when making the change.
🤖 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/pro/envelope.go`:
- Around line 14-20: DecodeEnvelope currently returns the raw json decode error;
wrap that error with the package static sentinel from errors/errors.go (e.g.
ErrProAPIDecodeFailed) before returning so callers can identify decode failures.
In DecodeEnvelope, replace the direct return of err with a wrapped error such as
using fmt.Errorf("%w: %v", errors.ErrProAPIDecodeFailed, err) (or your project's
preferred wrap helper) and keep returning (&env, nil) on success; reference
function DecodeEnvelope and sentinel ErrProAPIDecodeFailed when making the
change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: e27a59bc-5388-41a6-80ff-3d247c396312
📒 Files selected for processing (5)
pkg/auth/integrations/github/sts.gopkg/auth/integrations/github/sts_test.gopkg/pro/dtos/envelope.gopkg/pro/envelope.gopkg/pro/envelope_test.go
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2568 +/- ##
==========================================
+ Coverage 78.87% 78.90% +0.02%
==========================================
Files 1200 1201 +1
Lines 115889 115958 +69
==========================================
+ Hits 91407 91493 +86
+ Misses 19425 19403 -22
- Partials 5057 5062 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…token Downstream of the envelope fix: the token now mints and is received, but a cross-repo remote `import:` from a second private repo still 404'd because the ambient GITHUB_TOKEN (scoped to the calling repo) was applied to the cross-repo URL instead of the minted, repo-scoped STS token. Two distinct shadowing defects, both confirmed in code (not server/config): - Env mode (ordering): RemoteImporter.resolveGitSubdir resolves a git-subdir import by running CustomGitDetector.Detect directly, BEFORE downloader.Fetch. The broker only exports GIT_CONFIG_* inside Fetch, so the eager detect ran before the insteadOf rewrite was live, missed it, and baked the ambient token into the URL. Fix: provision broker.EnsureCredentials before the eager detect. - File mode (guard gap): the injection guard only matched url.*.insteadOf env keys; in GitConfigModeFile the broker emits include.path (rewrites live inside the referenced gitconfig), so the guard never matched and ambient injection always won. Fix: resolve include.path and scan the file for a matching https insteadOf. Add SwapRegistryForTest to pkg/auth/broker so cross-package tests can isolate broker state. Regression tests: file-mode include.path guard cases, and an in-process git-subdir import-resolution test that fails against the unfixed code with the exact ambient-token-in-URL symptom. Co-Authored-By: Claude Opus 4.8 <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (3)
pkg/stack/imports/remote_broker_test.go (1)
77-79: ⚡ Quick winAdd a compile-time sentinel for the
schema.AtmosSettingsfields used in this test.Line 78 references concrete schema fields in the fixture; add a sentinel to fail fast on field renames.
Suggested patch
+var _ = schema.AtmosSettings{ + InjectGithubToken: true, + GithubToken: "compile-guard", +} + type fakeInsteadOfBroker struct {As per coding guidelines, "Add compile-time sentinels for schema field references in tests: when a test uses a specific struct field ... add
var _ = ...as a compile guard."🤖 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/stack/imports/remote_broker_test.go` around lines 77 - 79, Add a compile-time sentinel to guard the test's use of schema.AtmosSettings field names so renames fail fast: add a package-level var assignment referencing schema.AtmosSettings with the InjectGithubToken and GithubToken fields (e.g., var _ = schema.AtmosSettings{InjectGithubToken: false, GithubToken: ""}) in the same test file near the fixtures so the compiler will break if those fields are renamed.pkg/downloader/broker_insteadof_filemode_test.go (1)
57-62: ⚡ Quick winAdd a compile-time sentinel for
schema.AtmosSettingsfield references.Line 58-Line 61 reference concrete schema fields in test fixtures; add a sentinel so schema field renames fail at compile time instead of silently weakening test intent.
Suggested patch
+var _ = schema.AtmosSettings{ + InjectGithubToken: true, + GithubToken: "compile-guard", +} + func TestCustomGitDetector_FileModeInsteadOf_NotShadowed(t *testing.T) {As per coding guidelines, "Add compile-time sentinels for schema field references in tests: when a test uses a specific struct field ... add
var _ = ...as a compile guard."🤖 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/downloader/broker_insteadof_filemode_test.go` around lines 57 - 62, Add a compile-time sentinel that references the specific schema.AtmosSettings fields used by the test so renames fail compilation: near the test fixture (where atmosConfig is built) add a var _ = schema.AtmosSettings{InjectGithubToken: false, GithubToken: ""} (or similar literal) to force the compiler to check those field names; this should be placed in pkg/downloader/broker_insteadof_filemode_test.go alongside the test fixture that constructs atmosConfig and will cause a compile error if InjectGithubToken or GithubToken are renamed or removed.pkg/stack/imports/remote.go (1)
15-23: ⚡ Quick winRe-group imports to match repository ordering rules.
The current block mixes 3rd-party and Atmos imports (Line 15-Line 23). Please split into stdlib / 3rd-party / Atmos groups with blank lines.
Suggested patch
"time" "github.com/bmatcuk/doublestar/v4" + "github.com/hashicorp/go-getter" + errUtils "github.com/cloudposse/atmos/errors" "github.com/cloudposse/atmos/pkg/auth/broker" "github.com/cloudposse/atmos/pkg/cache" "github.com/cloudposse/atmos/pkg/downloader" "github.com/cloudposse/atmos/pkg/perf" "github.com/cloudposse/atmos/pkg/schema" - "github.com/hashicorp/go-getter" )As per coding guidelines, "Organize imports in three groups separated by blank lines, sorted alphabetically: (1) Go stdlib, (2) 3rd-party, (3) Atmos packages."
🤖 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/stack/imports/remote.go` around lines 15 - 23, Reformat the import block in pkg/stack/imports/remote.go to follow repository rules: split imports into three groups (stdlib, 3rd-party, Atmos) separated by single blank lines, and sort each group alphabetically; specifically ensure symbols like "github.com/bmatcuk/doublestar/v4" and "github.com/hashicorp/go-getter" appear in the 3rd-party group, and Atmos packages such as "errUtils" (github.com/cloudposse/atmos/errors), "github.com/cloudposse/atmos/pkg/auth/broker", "github.com/cloudposse/atmos/pkg/cache", "github.com/cloudposse/atmos/pkg/downloader", "github.com/cloudposse/atmos/pkg/perf", and "github.com/cloudposse/atmos/pkg/schema" are grouped together in the Atmos section with a blank line separating from 3rd-party and stdlib imports.
🤖 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 `@pkg/stack/imports/remote.go`:
- Around line 251-259: The call to broker.EnsureCredentials in resolveGitSubdir
can hang because CredentialStore.Retrieve/Store and loadCredentialsWithFallback
are not context-aware; update the CredentialStore interface (methods Retrieve
and Store) and any implementations (e.g., systemKeyringStore.Retrieve) to accept
a context.Context, propagate that context through loadCredentialsWithFallback
and broker.EnsureCredentials callers, and thread ctx through any downstream I/O
so broker provisioning can be canceled; alternatively, if you cannot plumb
contexts now, ensure CI/in-process usage swaps the broker to a non-blocking
credential-store backend before calling broker.EnsureCredentials to avoid
blocking resolveGitSubdir.
---
Nitpick comments:
In `@pkg/downloader/broker_insteadof_filemode_test.go`:
- Around line 57-62: Add a compile-time sentinel that references the specific
schema.AtmosSettings fields used by the test so renames fail compilation: near
the test fixture (where atmosConfig is built) add a var _ =
schema.AtmosSettings{InjectGithubToken: false, GithubToken: ""} (or similar
literal) to force the compiler to check those field names; this should be placed
in pkg/downloader/broker_insteadof_filemode_test.go alongside the test fixture
that constructs atmosConfig and will cause a compile error if InjectGithubToken
or GithubToken are renamed or removed.
In `@pkg/stack/imports/remote_broker_test.go`:
- Around line 77-79: Add a compile-time sentinel to guard the test's use of
schema.AtmosSettings field names so renames fail fast: add a package-level var
assignment referencing schema.AtmosSettings with the InjectGithubToken and
GithubToken fields (e.g., var _ = schema.AtmosSettings{InjectGithubToken: false,
GithubToken: ""}) in the same test file near the fixtures so the compiler will
break if those fields are renamed.
In `@pkg/stack/imports/remote.go`:
- Around line 15-23: Reformat the import block in pkg/stack/imports/remote.go to
follow repository rules: split imports into three groups (stdlib, 3rd-party,
Atmos) separated by single blank lines, and sort each group alphabetically;
specifically ensure symbols like "github.com/bmatcuk/doublestar/v4" and
"github.com/hashicorp/go-getter" appear in the 3rd-party group, and Atmos
packages such as "errUtils" (github.com/cloudposse/atmos/errors),
"github.com/cloudposse/atmos/pkg/auth/broker",
"github.com/cloudposse/atmos/pkg/cache",
"github.com/cloudposse/atmos/pkg/downloader",
"github.com/cloudposse/atmos/pkg/perf", and
"github.com/cloudposse/atmos/pkg/schema" are grouped together in the Atmos
section with a blank line separating from 3rd-party and stdlib imports.
🪄 Autofix (Beta)
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
Run ID: cf505514-2d23-4353-a6b2-27cf22fe5542
📒 Files selected for processing (5)
pkg/auth/broker/broker.gopkg/downloader/broker_insteadof_filemode_test.gopkg/downloader/custom_git_detector.gopkg/stack/imports/remote.gopkg/stack/imports/remote_broker_test.go
…date path With the github/sts auth fixes in place, a cross-repo remote `import:` got past authentication but then failed with: fatal: empty string is not a valid pathspec. please use . instead if you meant to match all paths RemoteImporter.resolveGitSubdir pre-creates the destination temp dir, so the go-getter git getter takes the `update` path (os.Stat(dst) succeeds), not `clone`. clone() defaults an empty ref to the remote's default branch via findRemoteDefaultBranch; update() did not — so a ref-less import ran `git fetch -- ""` and `git checkout ""`. This was masked because every existing git-subdir test pins `?ref=main`, and on this path the clone previously 404'd on auth before reaching checkout. It also affects ref-less public git-subdir imports. - update() now defaults an empty ref to findRemoteDefaultBranch, mirroring clone() - Add TestRemoteImporter_Resolve_GitSubdir_NoRef_DefaultsToBranch (verified to fail against the unfixed update with the exact "empty string is not a valid pathspec") - initGitRepo disables commit.gpgsign so the real-git fixture is deterministic on dev machines whose global git config enables commit signing - docs/fixes: capture this fourth layer of the github/sts -xl failure chain Co-Authored-By: Claude Opus 4.8 <[email protected]>
… ls-remote Follow-up to the empty-ref fix. Defaulting update()'s empty ref via findRemoteDefaultBranch surfaced a CI-only failure: `fatal: couldn't find remote ref master`. findRemoteDefaultBranch runs `git ls-remote` in the process CWD — the actions/checkout repo — whose local `http.<host>.extraheader` carries the ambient repo-scoped token. That extraheader shadows the minted token for the cross-repo ls-remote, so it fails and falls back to "master" while the repo's default branch is "main" (the real fetch runs in the clean temp dir and authed fine via the insteadOf — hence "couldn't find remote ref", not an auth error). Fix: update() now fetches the remote's symbolic HEAD directly in the temp dir (git fetch origin HEAD -> git reset --hard FETCH_HEAD) where the broker insteadOf applies, and skips checkout/pull when no ref was given. This never runs ls-remote in the CWD, so the extraheader can't shadow it, and avoids `git checkout ""`. - get_git.go update(): HEAD-fetch + reset for empty ref; checkout/pull only for a named ref. clone()'s findRemoteDefaultBranch use is unchanged. - docs/fixes: document layer 4a (CWD extraheader shadowing ls-remote) Co-Authored-By: Claude Opus 4.8 <[email protected]>
TestExecuteTerraform_ExportEnvVar intermittently failed on the Windows acceptance job with "plugin cache dir cannot be opened" / "Required plugins are not installed". Atmos enables a Terraform provider plugin cache by default and points TF_PLUGIN_CACHE_DIR at a global XDG cache. `make testacc` runs `go test ./...` with packages in parallel, so concurrent terraform invocations from other packages hit the same global cache. Terraform's plugin cache is not concurrency-safe, and the contention races on Windows. Redirect XDG_CACHE_HOME to a per-binary temp dir in the package's existing TestMain so its (serial) real-terraform tests share a private, isolated cache and never collide with concurrently-running packages. Mirrors the isolation already used in tests/cli_plugin_cache_test.go. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Declaring a component's JIT-vendoring source under `metadata` (e.g. `metadata.source: github.com/org/repo//module`) is a silent footgun: `source` is a top-level component section (sibling of vars/settings/metadata), and `metadata.source` is not a schema field, so it is dropped during decode. The component then fails with a confusing "Terraform component does not exist" error with no indication that a misplaced source was the cause. ProvisionAndResolveComponentPath now warns, at the exact point it falls back to the local component dir (no top-level source found), when the raw component section carries a `source` nested under `metadata` — covering terraform, helmfile, and packer through the single shared chokepoint. Behavior is unchanged; only an actionable warning is added. Also fix the one inconsistent example in docs/prd/source-provisioner.md (the git-worktree section) that nested `source` under `metadata`, which is the form that leaked into a downstream config. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Add an explicit callout to the source-provisioner PRD: source is a top-level component section (sibling of vars/settings/metadata); metadata.source is not a schema field and is silently ignored (Atmos now warns). Distinguish from the valid, unrelated metadata.component. Co-Authored-By: Claude Opus 4.8 <[email protected]>
The component `source` section is documented (source-provisioner PRD) and
supported by the JIT provisioner (parseSource/HasSource) in two forms: a bare
go-getter URI string ("simple form") and a full map. The stack processor's
extraction only accepted the map form and rejected the string with "invalid
component source section", so `source: github.com/org/repo//module` failed during
stack processing before JIT provisioning ran. Every source-provisioner fixture
uses the map form, so the gap went unnoticed.
Add normalizeComponentSourceSection (string -> {uri: <string>}; empty string = no
source; map passthrough) and use it at both extraction sites (component source and
base-component source inheritance). The normalized map flows to the final `source`
section, which the JIT provisioner already reads as a map.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
…ck jobs The `[mock-windows] examples/demo-vendoring` job failed at the `hashicorp/setup-packer@main` step (every other mock job using the same step passed — a transient failure of the unpinned external action). None of the mock demos use Packer (demo-vendoring's test is `atmos vendor pull`; others use terraform). The lint job runs tflint only and the localstack job runs terraform only — both installed Packer but never used it. Remove the Install Packer step from the mock, lint, and localstack jobs. This fixes the failing job and eliminates the flaky external action wherever Packer was never needed. The acceptance job (which actually runs `atmos packer` Go tests) is left unchanged pending a separate toolchain-based migration. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
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 |
Co-Authored-By: Claude Opus 4.8 <[email protected]>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pkg/downloader/get_git.go (1)
270-270:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winGodot linter violation: comment must end with a period.
The comment on line 270 lacks a period at the end. As per coding guidelines, all comments must end with periods (enforced by
godotlinter).✏️ Proposed fix
-// In the case an error happens. +// In the case an error happens, capture output.As per coding guidelines: "All comments must end with periods (enforced by
godotlinter)".🤖 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/downloader/get_git.go` at line 270, Update the trailing punctuation of the comment that reads "In the case an error happens" by adding a final period so it ends with "In the case an error happens." to satisfy the godot linter; locate the comment near the get_git.go code (the line containing that exact comment text) and ensure the punctuation is corrected.
🧹 Nitpick comments (2)
internal/exec/stack_processor_source_normalize_test.go (1)
22-22: ⚡ Quick winUse
sourceURIKeyin expected maps to avoid key drift.This test currently hardcodes
"uri"while production usessourceURIKey; coupling to the constant keeps this canary aligned during future key renames.Suggested patch
- want: map[string]any{"uri": "github.com/cloudposse-sandbox/atmos-pro-qa-2-xl//components/terraform/queue"}, + want: map[string]any{sourceURIKey: "github.com/cloudposse-sandbox/atmos-pro-qa-2-xl//components/terraform/queue"}, @@ - raw: map[string]any{"uri": "github.com/org/repo//mod", "version": "1.2.3"}, - want: map[string]any{"uri": "github.com/org/repo//mod", "version": "1.2.3"}, + raw: map[string]any{sourceURIKey: "github.com/org/repo//mod", "version": "1.2.3"}, + want: map[string]any{sourceURIKey: "github.com/org/repo//mod", "version": "1.2.3"},Also applies to: 27-28
🤖 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 `@internal/exec/stack_processor_source_normalize_test.go` at line 22, The test uses a hardcoded "uri" key in expected maps; update the expectations to use the shared constant sourceURIKey so they won't drift if the key name changes. Locate the expected map literals in internal/exec/stack_processor_source_normalize_test.go (the entries with want: map[string]any{...}) and replace the literal "uri" with sourceURIKey in those maps (also apply the same change to the other occurrence on lines ~27-28), ensuring imports/reference to sourceURIKey are available in the test file.pkg/component/workdir_path.go (1)
272-279: ⚡ Quick winPrefer a non-empty component identifier in warning context.
Using only
info.ComponentFromArgcan emit a blankcomponentfield in internal/non-CLI paths. Fall back toinfo.FinalComponentto keep this warning actionable.Suggested patch
func warnIfSourceMisplacedUnderMetadata(info *schema.ConfigAndStacksInfo) { if !sourceMisplacedUnderMetadata(info.ComponentSection) { return } + componentID := info.ComponentFromArg + if componentID == "" { + componentID = info.FinalComponent + } log.Warn("Ignoring `source` nested under `metadata`: JIT source provisioning reads a top-level "+ "`source:` on the component (a sibling of `vars`/`settings`/`metadata`), not `metadata.source`. "+ "Move `source` up one level to vendor this component on demand.", - "component", info.ComponentFromArg) + "component", componentID) }🤖 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/component/workdir_path.go` around lines 272 - 279, In warnIfSourceMisplacedUnderMetadata, the warning uses info.ComponentFromArg which can be empty; change the logged component context to prefer info.ComponentFromArg but fall back to info.FinalComponent when ComponentFromArg is empty (e.g. compute a componentID := info.ComponentFromArg; if componentID == "" { componentID = info.FinalComponent } and pass that to log.Warn as the "component" value) so the warning always contains a non-empty component identifier.
🤖 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.
Outside diff comments:
In `@pkg/downloader/get_git.go`:
- Line 270: Update the trailing punctuation of the comment that reads "In the
case an error happens" by adding a final period so it ends with "In the case an
error happens." to satisfy the godot linter; locate the comment near the
get_git.go code (the line containing that exact comment text) and ensure the
punctuation is corrected.
---
Nitpick comments:
In `@internal/exec/stack_processor_source_normalize_test.go`:
- Line 22: The test uses a hardcoded "uri" key in expected maps; update the
expectations to use the shared constant sourceURIKey so they won't drift if the
key name changes. Locate the expected map literals in
internal/exec/stack_processor_source_normalize_test.go (the entries with want:
map[string]any{...}) and replace the literal "uri" with sourceURIKey in those
maps (also apply the same change to the other occurrence on lines ~27-28),
ensuring imports/reference to sourceURIKey are available in the test file.
In `@pkg/component/workdir_path.go`:
- Around line 272-279: In warnIfSourceMisplacedUnderMetadata, the warning uses
info.ComponentFromArg which can be empty; change the logged component context to
prefer info.ComponentFromArg but fall back to info.FinalComponent when
ComponentFromArg is empty (e.g. compute a componentID := info.ComponentFromArg;
if componentID == "" { componentID = info.FinalComponent } and pass that to
log.Warn as the "component" value) so the warning always contains a non-empty
component identifier.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ea214bbe-e1e7-41ef-8254-ed74f833bda1
📒 Files selected for processing (11)
.github/workflows/test.ymldocs/prd/source-provisioner.mdinternal/exec/stack_processor_process_stacks_helpers_extraction.gointernal/exec/stack_processor_source_normalize_test.gointernal/exec/stack_processor_utils.gointernal/exec/testmain_test.golychee.tomlpkg/component/workdir_path.gopkg/component/workdir_path_test.gopkg/downloader/get_git.gopkg/downloader/get_git_test.go
💤 Files with no reviewable changes (1)
- .github/workflows/test.yml
🚧 Files skipped from review as they are similar to previous changes (1)
- internal/exec/testmain_test.go
…e misplacement Co-Authored-By: Claude Opus 4.8 <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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-06-04-component-source-simple-form-and-metadata-misplacement.md`:
- Line 22: Replace the lowercase product name "github/sts" with the properly
capitalized "GitHub/sts" in the document; search for the exact string
"github/sts" in the file and update it to "GitHub/sts" to ensure consistency
with the official product name.
🪄 Autofix (Beta)
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
Run ID: 793515a5-f877-4f43-a7b0-d24166d253bb
📒 Files selected for processing (1)
docs/fixes/2026-06-04-component-source-simple-form-and-metadata-misplacement.md
Address CodeRabbit feedback on PR #2568. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Tip Atmos Pro
No affected stacks workflow was detected for this pull request. |
Resolve conflict in pkg/stack/imports/resolveGitSubdir: main's auth fix (#2568) added broker.EnsureCredentials before detectGitSource, but this branch refactored resolveGitSubdir to delegate cloning to ensureSourceDir. Port the credential-provisioning fix into ensureSourceDir (remote_nested.go), immediately before its detectGitSource call — the spot where the detect now runs — so both the clone-caching feature and the Atmos Pro github/sts broker ordering are preserved. Moved the broker/context imports accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
These changes were released in v1.221.0-rc.5. |
what
github/stsauth integration ignoring a successfully minted Atmos Pro STS token becausemint()decoded the response with a flat struct instead of the canonical API envelope.dtos.Envelope[T]+pro.DecodeEnvelope[T]— and routemint()through it so every Atmos Pro response unwraps the nesteddatapayload through one sanctioned path.mint()persists 1 token, not 0, plus decoder unit tests including a canary that a flat payload decodes to emptydata.why
{ "success": true, "status": 200, "data": { "tokens": [...], "excluded": [...] } }, butmint()decoded straight into the flatstsResponse(top-leveltokens), so it always read 0 tokens — the CLI loggedGitHub STS: no tokens granted, never wrote the gitinsteadOfconfig, and cross-repoimport:calls fell back to the ambientGITHUB_TOKENand failed withremote: Repository not found, even though the server had minted a valid token (HTTP 200, so no error surfaced).{tokens,excluded}shape the real server never sends; matching the fixture to the real envelope and adding the regression/canary tests prevents this whole class of "decoded a Pro response without the envelope" bug from recurring.references
mint()was the only Pro call bypassing the sharedAtmosApiResponseenvelope thatExchangeOIDCToken/LockStackalready use.Summary by CodeRabbit
Bug Fixes
sourceis misplaced undermetadataand accept simple-formsourcestrings.New Features
Tests
Documentation
source.