Adding graceful handling of airlock errors when schema generation fails#199
Merged
chrisghill merged 2 commits intomainfrom Dec 10, 2025
Merged
Conversation
coryodaniel
approved these changes
Dec 10, 2025
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds graceful error handling for schema generation failures in the airlock integration. The changes ensure that when schema parsing fails (e.g., due to invalid configuration files), the application returns informative errors rather than panicking or producing unexpected behavior.
Key changes:
- Added nil schema checks in provisioners (OpenTofu and Bicep) with diagnostic error messages
- Modified bundle creation to gracefully handle params import failures
- Added test coverage for invalid schema scenarios in OpenTofu provisioner
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/provisioners/testdata/opentofu/invalid.tf | Adds test fixture with invalid OpenTofu syntax to trigger schema parsing failures |
| pkg/provisioners/opentofu_test.go | Adds test case and error handling assertions for invalid schema scenarios |
| pkg/provisioners/opentofu.go | Adds nil schema check with diagnostic error message in ExportMassdriverInputs |
| pkg/provisioners/bicep.go | Adds nil schema check with diagnostic error message in ExportMassdriverInputs |
| pkg/params/params.go | Adds nil schema check with user-friendly error message for params import |
| cmd/bundle.go | Changes error handling to treat params import failures as non-fatal, allowing bundle creation to continue |
Comments suppressed due to low confidence (1)
pkg/provisioners/opentofu_test.go:118
- The test validation logic for error cases is incomplete. When an error is expected (like in the "invalid" test case), the test should skip file validation and return early. Currently, if an error occurs, the test will still attempt to validate the file at line 104-118, which may cause misleading test failures. Consider adding a return statement or continue after the error validation block at line 102 when tc.errString is not empty.
expectedFilepath := path.Join(testDir, "_massdriver_variables.tf")
if len(tc.want) > 0 {
got, readErr := os.ReadFile(expectedFilepath)
if readErr != nil {
t.Fatalf("%d, unexpected error", readErr)
}
if string(got) != tc.want {
t.Errorf("got %s want %s", got, tc.want)
}
} else {
if _, statErr := os.Stat(expectedFilepath); !errors.Is(statErr, os.ErrNotExist) {
t.Fatalf("file exists when it shouldn't")
}
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds graceful error handling for schema generation failures in the airlock integration. The changes ensure that when schema parsing fails (e.g., due to invalid configuration files), the application returns informative errors rather than panicking or producing unexpected behavior.