cloudposse / cloudposse/atmos

feat: fetch max_output_log_bytes from Atmos Pro server settings endpoint

Open
#2,586 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
1.4k
Forks
175
Avg merge
2d 3h
Merged PRs (30d)
134

Description

## Summary

The Pro summary upload feature currently uses a hardcoded default of 3 MB (`defaultMaxOutputLogBytes`) for the output log size limit before truncation.

The original PRD (`docs/prd/pro-summary-upload.md`) described fetching this limit dynamically from the server:

```
GET /api/v1/settings
→ { "max_output_log_bytes": 3145728 }
```

This was intentionally deferred from the initial implementation (`prd/pro-summary-upload` branch) in favor of shipping with the built-in 3 MB default.

## What to implement

1. Add a `GET /api/v1/settings` client method to `pkg/pro/` that fetches server-side configuration including `max_output_log_bytes`.
2. Cache the value per command execution (not across commands).
3. On failure (unreachable endpoint, auth error, etc.): fall back to `defaultMaxOutputLogBytes` and emit a debug-level log message (no user-visible warning).
4. Pass the resolved limit to `buildCIStatusData` / `addOutputLog` instead of the hardcoded constant.

## References

- PRD: `docs/prd/pro-summary-upload.md` §6 "Output Log Size Limits"
- Research: `specs/001-pro-summary-upload/research.md` §Decision 5
- Implementation: `internal/exec/terraform_execute_helpers_exec.go` — `defaultMaxOutputLogBytes`, `addOutputLog`

## Acceptance criteria

- When the settings endpoint returns `max_output_log_bytes`, that value is used for truncation
- When the endpoint is unreachable, the built-in 3 MB default is used and a debug log is emitted
- No user-visible warning on fallback (CI output not polluted)
- The resolved limit is cached for the duration of the command (not re-fetched per component)

Contributor guide

Open the contributing guide

Research direction

Start in pkg/pro/ for the client method, then trace internal/exec/terraform_execute_helpers_exec.go from defaultMaxOutputLogBytes through buildCIStatusData and addOutputLog. Confirm how one command execution can retain the fetched setting, use it for truncation, and fall back silently with a debug log when the settings request fails.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, terraform
Domain
api, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.