Skip to content

Add the IAC error category and its four error codes - #471

Merged
peter-smith-phd merged 2 commits into
mainfrom
dpx-518-add-iac-error-category
Aug 27, 2026
Merged

Add the IAC error category and its four error codes#471
peter-smith-phd merged 2 commits into
mainfrom
dpx-518-add-iac-error-category

Conversation

@peter-smith-phd

@peter-smith-phd peter-smith-phd commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Adds one category and four error codes to the --json envelope vocabulary, needed by the bundled lstk deploy extension that emits them. The category was necessary to add, since no other error codes came close to being useful.

IAC the workspace's infrastructure-as-code is the problem
IAC_FILE_NOT_FOUND a required IaC file or directory does not exist or cannot be read · not retryable
IAC_NO_TOOL_DETECTED no IaC tool could be resolved for the workspace: nothing matched, and no --tool was given · not retryable
IAC_TOOL_AMBIGUOUS more than one IaC tool matched and no choice could be made (no --tool, and nobody to prompt) · not retryable
IAC_DEPLOY_FAILED a delegated deployment command (e.g. terraform apply) exited non-zero · not retryable

IAC_DEPLOY_FAILED carries the delegated tool's own exit status in error.details rather than relaying it as lstk's: the exit-code table maps status from the envelope and reserves 3 and 4, and terraform plan exits 2 to mean "changes present", which would collide.

No built-in command emits any of these — lstk deploy is a bundled extension and renders its own envelope — but they are enumerated here so a consumer can switch on the vocabulary exhaustively without caring which binary produced the envelope.

Completes DPX-518.

🤖 Generated with Claude Code

`lstk deploy` is being built as a bundled extension, and its failures have no
good home in the existing seven categories. RESOURCE is the closest - it is
deliberately named generically so a future non-snapshot resource error has
somewhere to land - and it would fit this one code. It is not used anyway,
because a single code is not the whole picture: deploy's later phases bring a
family of infrastructure-as-code failures (an unsupported service, an
unimplemented resource type, an unresolvable input variable), and scattering
those across RESOURCE, CONFIG and VALIDATION_ERROR would leave the domain with
no coherent vocabulary.

IAC_FILE_NOT_FOUND is its first member: a required IaC file or directory does
not exist or cannot be read, which is what `lstk deploy detect` reports for an
unreadable `--dir`. Not retryable - the same path stays missing.

Note this is the first category no built-in command emits. An extension
renders its own envelope rather than having lstk wrap it, so nothing in this
repository returns the code today. It is enumerated here regardless, because a
closed enumeration is only useful if a consumer can switch on it exhaustively
without caring which binary produced the envelope - an extension's output is
meant to be indistinguishable from a built-in's, and that is exactly what
would break if the vocabulary lived only in the extension.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@peter-smith-phd
peter-smith-phd force-pushed the dpx-518-add-iac-error-category branch from 5512202 to 48d4ef6 Compare August 26, 2026 23:05
@peter-smith-phd peter-smith-phd added docs: skip Pull request does not require documentation changes semver: minor semver: patch and removed semver: minor labels Aug 26, 2026
@peter-smith-phd
peter-smith-phd marked this pull request as ready for review August 26, 2026 23:21
@peter-smith-phd
peter-smith-phd requested a review from a team as a code owner August 26, 2026 23:21
The IAC category landed with one member, on the argument that `lstk deploy`'s
later phases would bring a family of infrastructure-as-code failures and that
scattering them across RESOURCE, CONFIG and VALIDATION_ERROR would leave the
domain with no coherent vocabulary. The first of those phases is now specified,
so the rest of the family arrives with it:

  IAC_NO_TOOL_DETECTED  no IaC tool could be resolved for the workspace -
                        nothing matched, and no --tool was given. `lstk deploy`
                        reports this rather than guessing at a tool.
  IAC_TOOL_AMBIGUOUS    more than one tool matched and no choice could be made.
                        A workspace holding Terraform alongside a hand-written
                        SAM template is an ordinary layout, so detection reports
                        both; deploying exactly one is then a question, and this
                        is what it becomes when there is nobody to ask.
  IAC_DEPLOY_FAILED     a delegated deployment command exited non-zero.

All three are not retryable: the same invocation against the same workspace
fails the same way until something changes.

IAC_DEPLOY_FAILED is the one worth a second look, because it exists to avoid a
worse alternative. The exit-code table maps status from the envelope and
reserves 3 and 4, so a delegated tool's own exit status cannot be relayed as
lstk's - terraform exits 2 from `plan` to mean "changes present", which would
collide. The tool's status is reported in error.details instead, and this code
is what carries it.

Like IAC_FILE_NOT_FOUND, no built-in command emits any of these today: they are
enumerated here so a consumer can switch on the vocabulary exhaustively without
caring whether a built-in or a bundled extension produced the envelope.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@peter-smith-phd peter-smith-phd changed the title Add the IAC error category and IAC_FILE_NOT_FOUND Add the IAC error category and its four error codes Aug 27, 2026
@peter-smith-phd
peter-smith-phd merged commit f2c0925 into main Aug 27, 2026
19 checks passed
@peter-smith-phd
peter-smith-phd deleted the dpx-518-add-iac-error-category branch August 27, 2026 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs: skip Pull request does not require documentation changes semver: patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants