Repository navigation
Conversation
--max-query-size is the maximum size allowed for each query, but no test restores a query sitting exactly on the limit. Changing <= to < in restoreTable would reject it and fail the restore with every test passing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
No thanks. |
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.
Tests only: one test (+48 lines) in
internal/dumper/loader_test.go. No change to library code.pscale database restore-dump --max-query-sizeis documented as "the maximum size allowed for each individual query", and the loader rejects a query only when it "is larger than N bytes". So a query of exactly N bytes should restore. No loader test sends a query on the limit, so if thequeryBytes <= l.cfg.MaxQuerySizecheck inrestoreTablebecame<, a dump with a statement of exactly the configured size would fail to restore while every test passed.TestRestoreTable_QueryAtMaxQuerySizesetsMaxQuerySizeto the length of one INSERT and checks thatrestoreTableruns it against the mock MySQL server. It sets aPrinterbecause the over-limit path prints before returning its error.How it was checked
On a clone of current
main(9971335), with this test as the one commit on top (0d07a74):go test -count=1 -v ./internal/dumper/passes: 27 tests (33 with subtests).queryBytes < l.cfg.MaxQuerySizeinrestoreTable, this new test is the only one that fails (query is larger than 27 bytes in sizefor a 27-byte query). The other 32 pass.gofmt -landgo vetare clean on the package.This test was written with Claude Code during a planted-bug run by Trenyx.