Skip to content

Surface warnings when editing with the CLI#631

Merged
fnune merged 4 commits intomainfrom
fnune/esc/surface-warnings-on-edit
Apr 13, 2026
Merged

Surface warnings when editing with the CLI#631
fnune merged 4 commits intomainfrom
fnune/esc/surface-warnings-on-edit

Conversation

@fnune
Copy link
Copy Markdown
Member

@fnune fnune commented Apr 1, 2026

Summary

  • Add Severity field to EnvironmentDiagnostic to distinguish warnings from errors
  • Display warnings to stderr when editing environments, while still allowing the update to succeed
  • Backward compatible: missing/empty severity is treated as an error
image

Test plan

  • Added env-edit-file-warnings.yaml test case
  • Verified warnings go to stderr, not stdout
  • Verified exit code is 0 when only warnings are present

Fixes #626

fnune added 2 commits April 1, 2026 13:10
Add severity field to EnvironmentDiagnostic to distinguish warnings from
errors. When editing environments, warnings are now displayed to stderr
while still allowing the update to succeed.

Fixes #626
@fnune fnune requested review from borisschlosser and seanyeh April 1, 2026 12:16
Two fixes:
1. Parse the update response body to get warnings (previously only errors
   from HTTP 400 responses were shown)
2. Use project/env format for diagnostic filenames to match API response,
   fixing "source code not available" display issue
@fnune fnune marked this pull request as ready for review April 1, 2026 12:17
Comment thread cmd/esc/cli/client/apitype.go Outdated
}

func (d EnvironmentDiagnostic) IsError() bool {
return d.Severity != DiagWarning
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.

i would check if severity == error

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I added the == error check but we also need == "" for backward compat.

"github.com/pulumi/esc"
)

type EnvironmentDiagnosticSeverity string
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.

is there a reason we use string instead of hcl.DiagnosticSeverity? (I'm fine with either)

@fnune fnune enabled auto-merge (squash) April 13, 2026 10:04
@fnune fnune merged commit fc00ca7 into main Apr 13, 2026
8 checks passed
@fnune fnune deleted the fnune/esc/surface-warnings-on-edit branch April 13, 2026 10:06
@fnune fnune mentioned this pull request Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Surface warnings when editing with the CLI

2 participants