Merged
Conversation
Comment on lines
+33
to
+47
| }, | ||
| { | ||
| name: "WorkerBufferSize KB Conversion", | ||
| category: "Network", | ||
| key: "worker_buffer_size", | ||
| typ: "int", | ||
| internalValue: 1024 * config.KB, | ||
| uiInput: "1024", | ||
| expectedValue: 1024 * config.KB, | ||
| }, | ||
| { | ||
| name: "SlowWorkerGracePeriod seconds Conversion", | ||
| category: "Performance", | ||
| key: "slow_worker_grace_period", | ||
| typ: "duration", |
Contributor
There was a problem hiding this comment.
Missing edge-case tests for the new KB conversion path
The WorkerBufferSize test case only exercises the happy path (1024 KB → valid positive integer). The custom rule for edge-case coverage requires testing boundary inputs as well. Notably:
"0"→ sets the field to0bytes, silently relying onGetWorkerBufferSize()to fall back to the default; there is no user-visible error."abc"(non-numeric) →ParseFloatfails, the field is silently left unchanged, andsetSettingValuestill returnsnil.- Fractional input like
"1.5"→ accepted and silently truncated to1536bytes without feedback.
Adding tests for these cases would verify both the conversion logic and the error-handling (or lack thereof) behaviour.
Rule Used: What: All code changes must include tests for edge... (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: internal/tui/settings_unit_test.go
Line: 33-47
Comment:
**Missing edge-case tests for the new KB conversion path**
The `WorkerBufferSize` test case only exercises the happy path (`1024 KB` → valid positive integer). The custom rule for edge-case coverage requires testing boundary inputs as well. Notably:
- `"0"` → sets the field to `0` bytes, silently relying on `GetWorkerBufferSize()` to fall back to the default; there is no user-visible error.
- `"abc"` (non-numeric) → `ParseFloat` fails, the field is silently left unchanged, and `setSettingValue` still returns `nil`.
- Fractional input like `"1.5"` → accepted and silently truncated to `1536` bytes without feedback.
Adding tests for these cases would verify both the conversion logic and the error-handling (or lack thereof) behaviour.
**Rule Used:** What: All code changes must include tests for edge... ([source](https://app.greptile.com/review/custom-context?memory=2b22782d-3452-4d55-b059-e631b2540ce8))
How can I resolve this? If you propose a fix, please make it concise.
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.
Greptile Summary
This PR adds KB-scaled input support for the
worker_buffer_sizeTUI setting, converting the user-entered KB value to bytes viaParseFloatbefore storing it — mirroring the existing MB conversion formin_chunk_size. A new test file covers the round-trip conversion for several settings, includingworker_buffer_size.Confidence Score: 5/5
Safe to merge; the conversion logic is correct and consistent with the existing pattern for
min_chunk_size.The only finding is a P2 suggestion to extend the new test with edge-case inputs (zero, invalid string, fractional KB). No logic errors or breaking changes were identified.
internal/tui/settings_unit_test.go — consider adding edge-case tests for the
worker_buffer_sizeconversion.Important Files Changed
worker_buffer_sizeinsetSettingValue; logic is correct but parse errors are silently swallowed (consistent with surrounding code).worker_buffer_sizetest only covers the happy path, missing edge cases (zero, invalid string, fractional input).Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "test: add unit tests for TUI settings va..." | Re-trigger Greptile
Context used: