Render server flag rejections from the lists the guards test - #165
Merged
Conversation
An invalid --prefill-chunk-tokens was rejected with "must be 32, 64, or 128" while the guard beside it accepted 256: PR 144 widened the allowed list and derived the resolver-path message, but left the parse-path literal behind, and no test read the message. Every release since 0.5.0 shipped it. --expert-cache-slots restated its list the same way at two sites, accurate only until that list moves. One renderer now produces the choice list for the help text and every rejection, and ServerArgumentError.notAllowed builds each message from the array the guard tests. Tests pin the exact integer set named by the parse-path and resolve-path rejections and by the help lines; with the old literal restored, the two --prefill-chunk-tokens rows fail and nothing else does. Fixes #164
This was referenced Sep 2, 2026
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.
Fixes #164.
--prefill-chunk-tokensrejected an invalid value withmust be 32, 64, or 128while accepting 256. PR 144 widenedallowedPrefillChunkTokensand derived the resolver-path message, but the parse-path literal stayed behind and no test read the message, so 0.5.0 through 0.7.1 all shipped it.--expert-cache-slotsrestated its list the same way at two sites.What changes
ServerArguments.allowedValueList(_:)renders the choice list once;ServerArgumentError.notAllowed(flag:allowed:)builds every--expert-cache-slotsand--prefill-chunk-tokensrejection from the array the guard tests. Both--helplines interpolate the same renderer, so help and errors cannot disagree.--prefill-chunk-tokens: the parse path gains 256, and the resolver path readsmust be 32, 64, 128, or 256instead ofmust be one of 32, 64, 128, 256.--expert-cache-slotstext and the rendered--helpare byte-identical to before.Tests
Four new tests in
ServerArgumentTests: the renderer, the parse-path rejection (parameterized over both flags with numeric and non-numeric bad values), the resolver-path rejection, and the help lines. Each compares the integer set in the text against the allowed array, so an omitted legal value and a named illegal one both fail.swift test --filter ServerArgumentTests: 14/14.--prefill-chunk-tokenscases fail ([32, 64, 128]vs[32, 64, 128, 256]).TurboFieldfareServer --model /nonexistent --prefill-chunk-tokens 512now printserror: --prefill-chunk-tokens must be 32, 64, 128, or 256;--prefill-chunk-tokens 256passes argument parsing as before.