fix: validate file input before network calls in jtk and cfl#86
Merged
Conversation
jtk auto update: move file read and JSON validation before opts.APIClient() so bad input fails fast without needing network access or config. Same fix applied to auto create in 2cef041. cfl page create/edit: add early file existence check before config loading and API client creation when --file is provided. Add jtk update_test.go with invalid JSON and file-not-found test cases.
422c4ab to
21c97ae
Compare
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.
Summary
opts.APIClient()— same fix applied toauto createin 2cef041--fileis providedupdate_test.gowith invalid JSON and file-not-found test casesWithout these fixes, passing a bad file path gives confusing config/network errors instead of a clear "failed to read file" message.
Test plan
go test ./tools/jtk/...passesgo test ./tools/cfl/...passesfix:commit touching Go code in bothtools/jtk/andtools/cfl/— merging will trigger auto-release for both tools, validating the release build fixes from fix: fix release builds for monorepo #85Fixes #82
Fixes #83