Skip to content

Commit f8b9921

Browse files
ostermanclaude
andcommitted
docs: Enhance version constraint PRD with multi-environment and version list concerns
Add comprehensive problem statements addressing real-world challenges: - Multi-environment version drift (CI, local, containers) - Silent feature unavailability in older versions - Experimentation friction without proper warnings Add new configuration examples: - Multi-environment consistency enforcement - Experimentation mode with warnings for unsupported versions Add Phase 3 proposal for constraint-aware version listing: - Optional --constraint-aware flag for atmos version list - Filters releases based on version.constraint.require - Three design options with recommendation for flag-based approach - Future enhancement: warnings for versions outside constraints 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent ae76ca4 commit f8b9921

File tree

1 file changed

+164
-1
lines changed

1 file changed

+164
-1
lines changed

docs/prd/version-constraint.md

Lines changed: 164 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ This configuration enables checking for newer versions of Atmos available on Git
2727
3. **Team consistency** - No way to ensure all team members use compatible Atmos versions
2828
4. **Feature gating** - Cannot specify version ranges for configurations using version-specific features
2929
5. **Migration clarity** - No clear signal when upgrading is required vs. recommended
30+
6. **Multi-environment version drift** - Different environments (CI, local, containers) often run mismatched Atmos versions, leading to inconsistent behavior
31+
7. **Silent feature unavailability** - Newer features may not exist in older versions, causing confusing errors without clear version context
32+
8. **Experimentation friction** - No way to warn users about unsupported versions while still allowing experimentation with newer releases
3033
3134
## Proposed Solution
3235
@@ -174,7 +177,42 @@ version:
174177
Questions? Contact #infrastructure-support
175178
```
176179

177-
### Example 7: Combined with Version Checking
180+
### Example 7: Multi-Environment Consistency
181+
```yaml
182+
# Ensure all environments (CI, local, containers) use compatible versions
183+
version:
184+
constraint:
185+
require: ">=2.5.0, <3.0.0"
186+
enforcement: "fatal"
187+
message: |
188+
Version mismatch detected across environments.
189+
190+
This configuration requires Atmos 2.x to ensure consistent behavior
191+
across CI pipelines, local development, and container deployments.
192+
193+
Check your environment:
194+
- CI: Update .github/workflows or .gitlab-ci.yml
195+
- Local: brew upgrade atmos
196+
- Docker: Update Dockerfile base image
197+
```
198+
199+
### Example 8: Experimentation Mode (Warn on Unsupported)
200+
```yaml
201+
# Allow experimentation with newer versions but warn if not officially supported
202+
version:
203+
constraint:
204+
require: ">=2.5.0, <2.8.0"
205+
enforcement: "warn"
206+
message: |
207+
You are using Atmos 2.8.0+ which is newer than our tested version range.
208+
209+
This configuration is validated against Atmos 2.5.0-2.7.x.
210+
Newer versions may work but are not officially supported.
211+
212+
Proceed at your own risk. Report issues to #infrastructure.
213+
```
214+
215+
### Example 9: Combined with Version Checking
178216
```yaml
179217
version:
180218
# Check for new Atmos releases periodically
@@ -497,6 +535,131 @@ ATMOS_VERSION_ENFORCEMENT=silent atmos terraform plan
497535
1. **`website/docs/cli/configuration.mdx`** - Add version constraint documentation
498536
2. **`website/docs/cli/versioning.mdx`** - Update with constraint examples
499537

538+
### Phase 3: Constraint-Aware Version Listing (Optional Enhancement)
539+
540+
Add constraint-aware filtering to `atmos version list` command to help users find compatible versions.
541+
542+
**Problem:** When users run `atmos version list`, they see all available versions including those that don't satisfy their configuration's constraints. This can be confusing when trying to upgrade to a compatible version.
543+
544+
**Solution:** Add optional `--constraint-aware` flag to `atmos version list` that filters results based on `version.constraint.require` from `atmos.yaml`.
545+
546+
**Implementation:**
547+
548+
1. **`cmd/version/list.go`** - Add new flag and filtering logic
549+
```go
550+
var (
551+
listConstraintAware bool // NEW flag
552+
// ... existing flags
553+
)
554+
555+
func init() {
556+
// ... existing flags
557+
listCmd.Flags().BoolVar(&listConstraintAware, "constraint-aware", false,
558+
"Filter releases based on version.constraint.require from atmos.yaml")
559+
}
560+
```
561+
562+
2. **Filtering logic in `listCmd.RunE`:**
563+
```go
564+
// If constraint-aware flag is set, load atmos.yaml and filter releases
565+
if listConstraintAware {
566+
atmosConfig, err := cfg.InitCliConfig(schema.ConfigAndStacksInfo{}, true)
567+
if err != nil {
568+
return fmt.Errorf("failed to load atmos.yaml for constraint filtering: %w", err)
569+
}
570+
571+
if atmosConfig.Version.Constraint.Require != "" {
572+
constraint, err := goversion.NewConstraint(atmosConfig.Version.Constraint.Require)
573+
if err != nil {
574+
return fmt.Errorf("invalid constraint in atmos.yaml: %w", err)
575+
}
576+
577+
// Filter releases that satisfy constraint
578+
filtered := []*github.RepositoryRelease{}
579+
for _, release := range releases {
580+
ver, err := goversion.NewVersion(strings.TrimPrefix(*release.TagName, "v"))
581+
if err != nil {
582+
continue // Skip releases with invalid version format
583+
}
584+
if constraint.Check(ver) {
585+
filtered = append(filtered, release)
586+
}
587+
}
588+
releases = filtered
589+
590+
// Show constraint info in output
591+
ui.Info(fmt.Sprintf("Showing releases matching constraint: %s",
592+
atmosConfig.Version.Constraint.Require))
593+
}
594+
}
595+
```
596+
597+
**Usage Examples:**
598+
599+
```bash
600+
# Show all releases (default behavior, unchanged)
601+
atmos version list
602+
603+
# Show only releases that satisfy constraint from atmos.yaml
604+
atmos version list --constraint-aware
605+
606+
# Example: If atmos.yaml has ">=2.5.0, <3.0.0", only show 2.5.x - 2.9.x releases
607+
atmos version list --constraint-aware --limit 20
608+
```
609+
610+
**Output Example:**
611+
612+
```bash
613+
$ atmos version list --constraint-aware
614+
615+
ℹ Showing releases matching constraint: >=2.5.0, <3.0.0
616+
617+
VERSION PUBLISHED TYPE NOTES
618+
2.9.0 2025-01-15 stable Latest stable
619+
2.8.5 2025-01-10 stable Bug fixes
620+
2.8.0 2024-12-20 stable New features
621+
2.7.3 2024-12-15 stable Security patch
622+
2.6.0 2024-11-30 stable
623+
2.5.0 2024-11-15 stable
624+
625+
# Versions 3.0.0+ are hidden because they don't satisfy <3.0.0
626+
# Versions <2.5.0 are hidden because they don't satisfy >=2.5.0
627+
```
628+
629+
**Design Considerations:**
630+
631+
**Option 1: Flag-based (RECOMMENDED)**
632+
- Pro: Explicit opt-in, doesn't change default behavior
633+
- Pro: Users who want all versions can still get them
634+
- Pro: Works well with other flags (--include-prereleases, etc.)
635+
- Con: Requires users to know about the flag
636+
637+
**Option 2: Always filter by default**
638+
- Pro: Automatically helpful
639+
- Con: Breaking change - users expect to see all versions
640+
- Con: May hide newer versions users want to know about
641+
- Con: Confusing if constraint is set to "warn" enforcement
642+
643+
**Option 3: Auto-enable when constraint enforcement is "fatal"**
644+
- Pro: Smart default based on enforcement level
645+
- Con: Implicit behavior may be surprising
646+
- Con: Still need flag to override
647+
648+
**Recommendation:** Use **Option 1** (flag-based) for Phase 3. It's explicit, backward-compatible, and gives users control.
649+
650+
**Future Enhancement:** Add warning when `atmos version list` shows versions outside the constraint:
651+
```bash
652+
$ atmos version list
653+
654+
VERSION PUBLISHED TYPE NOTES
655+
3.0.0 2025-02-01 stable Latest (⚠ outside constraint)
656+
2.9.0 2025-01-15 stable
657+
...
658+
659+
⚠ Some versions shown are outside your configuration's constraint: >=2.5.0, <3.0.0
660+
Use --constraint-aware to filter results
661+
```
662+
500663
## Error Messages
501664
502665
**Fatal Error (enforcement: fatal):**

0 commit comments

Comments
 (0)