!unset does not work on a whole section (vars, settings, retry, and more)
- Dominant language
- Go
- Stars
- 1.4k
- Forks
- 175
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 134
Description
## Problem
The `!unset` YAML function does not work on a whole section. It only works on one field inside a section.
Example: `vars: { instance_type: !unset }` works. `vars: !unset` does not work.
This bug affects every typed section. Examples: `vars`, `settings`, `env`, `hooks`, `retry`, and more.
## Steps to Reproduce
1. Create a stack manifest.
2. Set a component's `retry:` field to `!unset`.
3. Run `atmos describe stacks`.
## Expected Result
Atmos removes the `retry:` section from the component.
## Actual Result
Atmos returns this error:
```
Error: invalid configuration
'components.terraform..retry' in the file ''
```
The same error pattern happens for other sections too. Example: `vars: !unset` on a component gives an analogous `invalid component vars section` error.
## Root Cause
The `!unset` tag turns the YAML node into the plain string `"!unset"`. Atmos does not remove the key at this point.
Atmos removes `!unset` keys later. This removal happens during YAML function processing, after the stack config is fully merged.
Atmos extracts each typed section earlier, before YAML function processing runs. Section extraction expects a map value. The string `"!unset"` is not a map. Extraction fails with a type error.
This gap exists at every extraction site that expects a map. Known affected sections:
- `vars`
- `settings`
- `env`
- `providers`
- `mocks`
- `hooks`
- `test`
- `secrets`
- `auth`
- `provision`
- `retry`
Relevant files:
- `internal/exec/stack_processor_process_stacks_helpers_extraction.go`
- `internal/exec/stack_processor_process_stacks_helpers_overrides.go`
- `internal/exec/stack_processor_utils.go` (base-component and global layers)
## Proposed Fix
Add a check before each map type-assertion. Check for the bare string `"!unset"` first. When found, skip the whole section instead of returning a type error.
Apply the fix to every extraction site listed above. A fix for only one section (for example, only `retry`) leaves the same bug in the rest.
## Related
Found during a field-test pass on #2987 (stack-level `retry:` defaults). Not specific to retry — logged as a separate issue because the fix spans many unrelated sections.
Contributor guide
Research direction
Start with the extraction sites in internal/exec/stack_processor_process_stacks_helpers_extraction.go, internal/exec/stack_processor_process_stacks_helpers_overrides.go, and internal/exec/stack_processor_utils.go. Trace the map assertions and run the reported retry: !unset case with atmos describe stacks. Done means whole-section !unset is skipped without a type error for every affected section listed in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100