feat: add validation for file extensions in apply command#434
Merged
tianzhou merged 1 commit intoMay 30, 2026
Conversation
Greptile SummaryThis PR adds early file-extension validation to the apply command. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (1): Last reviewed commit: "feat: add validation for file extensions..." | Re-trigger Greptile |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds early validation in the apply command to detect when a user passes a JSON file to --file or a SQL file to --plan, returning an actionable error suggesting the correct flag.
Changes:
- New
validateFileExtensionhelper incmd/apply/apply.gochecks--file/--planextensions (case-insensitive) and returns a helpful error on mismatch. RunApplyinvokes the new validator after the existing required-flag check.- New unit tests cover both the validator directly and the end-to-end behavior via
RunApply.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| cmd/apply/apply.go | Adds validateFileExtension and wires it into RunApply. |
| cmd/apply/apply_test.go | Adds table-driven and scenario tests for the new validation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tianzhou
approved these changes
May 30, 2026
Contributor
tianzhou
left a comment
There was a problem hiding this comment.
LGTM. Thanks for the contribution.
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.
No description provided.