Skip to content

fix: Return upload errors instead of silently swallowing them - #2316

Merged
Andriy Knysh (aknysh) merged 10 commits into
mainfrom
osterman/upload-no-workspace-err
Apr 13, 2026
Merged

Andriy Knysh (aknysh) merged 10 commits into
mainfrom
osterman/upload-no-workspace-err

Conversation

@osterman

@osterman Erik Osterman (Cloud Posse) (osterman) commented Apr 12, 2026 •

Copy link
Copy Markdown
Member

what

  • describe affected --upload and list instances --upload now return errors instead of silently swallowing them when the Atmos Pro API client cannot be created or the upload fails
  • describe affected --upload returns actionable hints guiding users to set ATMOS_PRO_TOKEN or ATMOS_PRO_WORKSPACE_ID
  • All Atmos Pro API requests now include a User-Agent header (atmos/<version> (<os>; <arch>)) instead of the Go default Go-http-client/1.1

why

  • Upload failures (misconfigured credentials, wrong workspace ID, server-side access denied) were invisible — the CLI logged a warning but returned success, making it impossible to diagnose issues like "workspace does not have access to repository"
  • The missing User-Agent header made it difficult to identify Atmos CLI traffic in server logs

references

  • Server-side error observed: Workspace does not have access to repository was logged server-side but never surfaced to the CLI user

Summary by CodeRabbit

  • Bug Fixes

    • Upload failures now propagate and halt commands instead of being silently skipped.
    • Pro API client creation now returns descriptive errors with authentication/workspace hints.
  • New Features

    • Pro API requests include User-Agent headers with version and system info.
  • Documentation

    • Added "Atmos Pro" doc with setup, OIDC guidance, CLI usage, env vars, and troubleshooting; added to CLI sidebar and navbar.
  • Tests

    • Added/updated tests to enforce explicit API client/auth failure handling.

Upload failures for `describe affected --upload` and `list instances --upload`
were silently swallowed — the CLI logged a warning but returned success. This
meant misconfigured credentials (missing ATMOS_PRO_TOKEN or ATMOS_PRO_WORKSPACE_ID)
or server-side rejections (e.g. workspace access denied) were invisible to users.

Also sets User-Agent header on all Atmos Pro API requests to
`atmos/<version> (<os>; <arch>)` instead of the default `Go-http-client/1.1`.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@atmos-pro

atmos-pro Bot commented Apr 12, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More.

@github-actions github-actions Bot added the size/s Small size PR label Apr 12, 2026
@github-actions

github-actions Bot commented Apr 12, 2026 •

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues found.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA c18fadc.
Ensure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice.

Scanned Files

None

@coderabbitai

coderabbitai Bot commented Apr 12, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • ✅ Review completed - (🔄 Check again to review again)
📝 Walkthrough

Walkthrough

Fail fast on Atmos Pro API client creation and on upload errors; add a User-Agent header to Pro API requests; update tests to expect ErrFailedToCreateAPIClient; add Atmos Pro documentation and sidebar entry.

Changes

Cohort / File(s) Summary
Upload / client error handling
internal/exec/describe_affected.go, internal/exec/describe_affected_test.go
API client creation failures now return a wrapped ErrFailedToCreateAPIClient (with auth/workspace hints) instead of logging and continuing. Tests updated to assert the sentinel error; new test for missing credentials added.
List command upload propagation
pkg/list/list_instances.go
When --upload is enabled, upload errors are now propagated (returned) instead of being swallowed and only logged.
Pro API client headers & tests
pkg/pro/api_client.go, pkg/pro/api_client_test.go, pkg/pro/api_client_exchange_oidc_token_test.go
Added userAgent() and set User-Agent header on authenticated and OIDC-exchange requests. Tests assert User-Agent contains atmos/ and OS/ARCH.
Docs / navigation
website/docs/pro/pro.mdx, website/sidebars.js
Added Atmos Pro documentation page and registered it in the CLI sidebar; documents workspace/config, GitHub OIDC requirements, env vars, supported commands, and troubleshooting for auth/upload failures.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant CI as CI / Runner
participant App as atmos CLI
participant GitHubOIDC as GitHub OIDC
participant ProAPI as Atmos Pro API
CI->>App: run command with --upload (may include id-token)
App->>GitHubOIDC: request id-token (if configured)
GitHubOIDC-->>App: id-token / error
App->>App: create Pro API client (validate ATMOS_PRO_TOKEN / WORKSPACE_ID)
alt client creation fails
App-->>CI: return ErrFailedToCreateAPIClient
else client created
App->>ProAPI: upload affected (includes User-Agent header)
ProAPI-->>App: success / error
alt upload fails
App-->>CI: return upload error
else
App-->>CI: succeed
end
end

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • milldr
  • aknysh
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main change: returning upload errors instead of silently swallowing them, which aligns with the primary objectives across multiple files.
Docstring Coverage ✅ Passed Docstring coverage is 84.62% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch osterman/upload-no-workspace-err

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Apr 12, 2026
@osterman Erik Osterman (Cloud Posse) (osterman) added the patch A minor, backward compatible change label Apr 12, 2026
@codecov

codecov Bot commented Apr 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 77.27%. Comparing base (54d7318) to head (c18fadc).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/list/list_instances.go 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2316      +/-   ##
==========================================
+ Coverage   77.23%   77.27%   +0.04%     
==========================================
  Files        1074     1074              
  Lines      101888   101897       +9     
==========================================
+ Hits        78689    78737      +48     
+ Misses      18854    18819      -35     
+ Partials     4345     4341       -4     
Flag Coverage Δ
unittests 77.27% <91.66%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
internal/exec/describe_affected.go 77.93% <100.00%> (+0.38%) ⬆️
pkg/pro/api_client.go 90.85% <100.00%> (+2.19%) ⬆️
pkg/list/list_instances.go 80.57% <0.00%> (ø)

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Replace hint suggesting ATMOS_PRO_TOKEN (tokens are always minted via
OIDC) with guidance on `id-token: write` workflow permission. Use
backticks for environment variable names.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
coderabbitai[bot]
coderabbitai Bot previously approved these changes Apr 12, 2026
Create a dedicated /pro landing page covering authentication, affected
stacks upload, component instances, stack locking, and drift detection.
Follows the same pattern as /ai and /ci pages.

Update the --upload error hint URL to point to atmos.tools/pro.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Add a "Why Atmos Pro?" section that draws a clear line between CLI
(execution layer — every company needs this) and Pro (control plane —
coordination across teams, repos, orgs at scale). Emphasize that Pro
doesn't need elevated cloud access because the CLI owns execution.

Co-Authored-By: Claude Opus 4.6 <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
website/docs/pro/pro.mdx (1)

66-80: Consider clarifying what's "automatic" in the tip.

The example shows explicit !env mappings, but the tip says fields are "automatically populated." You might clarify that GitHub Actions provides the environment variables automatically, but the config mapping is still required:

:::tip
GitHub Actions automatically provides the `ACTIONS_ID_TOKEN_REQUEST_URL` and `ACTIONS_ID_TOKEN_REQUEST_TOKEN` 
environment variables when `id-token: write` is granted. You only need to map them in your config and set `workspace_id`.
:::
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@website/docs/pro/pro.mdx` around lines 66 - 80, Clarify the tip to state that
GitHub Actions supplies the environment variables but you still must map them in
the config: update the prose around the existing github_oidc example to
explicitly mention that ACTIONS_ID_TOKEN_REQUEST_URL and
ACTIONS_ID_TOKEN_REQUEST_TOKEN are provided by GitHub Actions when the workflow
has id-token: write, and that the YAML block (github_oidc with !env mappings) is
still required alongside setting workspace_id; reference the existing
github_oidc block and the two env names (ACTIONS_ID_TOKEN_REQUEST_URL,
ACTIONS_ID_TOKEN_REQUEST_TOKEN) when editing the tip text.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@website/docs/pro/pro.mdx`:
- Around line 66-80: Clarify the tip to state that GitHub Actions supplies the
environment variables but you still must map them in the config: update the
prose around the existing github_oidc example to explicitly mention that
ACTIONS_ID_TOKEN_REQUEST_URL and ACTIONS_ID_TOKEN_REQUEST_TOKEN are provided by
GitHub Actions when the workflow has id-token: write, and that the YAML block
(github_oidc with !env mappings) is still required alongside setting
workspace_id; reference the existing github_oidc block and the two env names
(ACTIONS_ID_TOKEN_REQUEST_URL, ACTIONS_ID_TOKEN_REQUEST_TOKEN) when editing the
tip text.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ffc0cc1e-1b1c-4240-b047-b862e8f4f054

📥 Commits

Reviewing files that changed from the base of the PR and between 8045182 and 4136340.

📒 Files selected for processing (3)
  • internal/exec/describe_affected.go
  • website/docs/pro/pro.mdx
  • website/sidebars.js
✅ Files skipped from review due to trivial changes (1)
  • website/sidebars.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/exec/describe_affected.go

coderabbitai[bot]
coderabbitai Bot previously approved these changes Apr 12, 2026
Add toolchains, inheritance, templating, and vendoring to the CLI
description to better represent the full execution layer.

Co-Authored-By: Claude Opus 4.6 <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@website/docs/pro/pro.mdx`:
- Around line 195-199: Update the troubleshooting checklist for `--upload` auth
failures to explicitly mention `ATMOS_PRO_TOKEN` as an alternative to
`ATMOS_PRO_WORKSPACE_ID`: modify the list item that currently says "Confirm
`ATMOS_PRO_WORKSPACE_ID` is set to the correct workspace" to indicate that users
should set either `ATMOS_PRO_WORKSPACE_ID` or `ATMOS_PRO_TOKEN` depending on
their flow, and ensure the surrounding text references the CLI hint behavior for
`--upload` so the docs and CLI are consistent.
🪄 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: 767a2cf0-ed06-4c91-be1c-c6e07a9a4ca1

📥 Commits

Reviewing files that changed from the base of the PR and between 3aaf2da and db5f40d.

📒 Files selected for processing (1)
  • website/docs/pro/pro.mdx

Comment thread website/docs/pro/pro.mdx Resolved
Make it clear that upload commands run from GitHub Actions workflows,
not locally.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Remove the github_oidc config block from the Authentication section —
those fields are auto-populated in GitHub Actions and showing them
implies manual configuration. Add Atmos Pro badge linking to
atmos-pro.com near the top of the page.

Co-Authored-By: Claude Opus 4.6 <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@website/docs/pro/pro.mdx`:
- Around line 187-189: The doc currently presents ATMOS_PRO_TOKEN
(settings.pro.token) as a user-facing env var; update the `ATMOS_PRO_TOKEN`
entry to indicate it is an internal/runtime-managed token obtained via OIDC
token exchange and not a user-configurable credential (or remove the bullet
entirely). Specifically, change the description for `ATMOS_PRO_TOKEN` to state
it’s generated and managed by the OIDC flow (advanced/internal use only) and add
a short note that end users should not set this value manually, referencing
`settings.pro.token` for implementer context.
- Around line 195-199: The troubleshooting checklist under the "`--upload` fails
with an authentication error" section mixes auth and authorization checks;
remove the "Check that the Atmos Pro GitHub App is installed on your repository"
bullet from this auth-failure list and instead add it to the 403 / authorization
failure section, keeping only OIDC/`id-token: write` and
`ATMOS_PRO_WORKSPACE_ID` checks in the authentication section so the CLI hints
align with the website docs.
🪄 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: 66f6d568-583c-40b5-8c0f-cb779bef7531

📥 Commits

Reviewing files that changed from the base of the PR and between 3aaf2da and b7bb201.

📒 Files selected for processing (2)
  • website/docs/pro/pro.mdx
  • website/docusaurus.config.js
✅ Files skipped from review due to trivial changes (1)
  • website/docusaurus.config.js

Comment thread website/docs/pro/pro.mdx Resolved
Comment thread website/docs/pro/pro.mdx Resolved
Add tests for error hint propagation in upload paths, direct userAgent()
test, and OIDC token exchange error-status non-JSON path. Fix ATMOS_PRO_TOKEN
doc per CodeRabbit review to clarify it's internal/runtime-managed.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@aknysh
Andriy Knysh (aknysh) merged commit 5161431 into main Apr 13, 2026
59 checks passed
@aknysh
Andriy Knysh (aknysh) deleted the osterman/upload-no-workspace-err branch April 13, 2026 00:04
@atmos-pro

atmos-pro Bot commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Note

Atmos Pro  

Waiting for your GitHub Actions workflow to upload affected stacks.
Learn More.

@github-actions

Copy link
Copy Markdown

These changes were released in v1.215.0-rc.8.

This branch was successfully deployed

1 active deployment
preview — c18fadc3 Deployed Apr 12, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

patch A minor, backward compatible change size/m Medium size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants