fix(test): reject whitespace-only --name in test update (parity with test create)#39
Open
lxcario wants to merge 1 commit into
Open
fix(test): reject whitespace-only --name in test update (parity with test create)#39lxcario wants to merge 1 commit into
lxcario wants to merge 1 commit into
Conversation
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.
What
test update --name " "(whitespace-only) is accepted and would send a blank name to the backend, while the siblingtest create --name " "correctly rejects it withVALIDATION_ERROR(exit 5).Why this matters
A whitespace-only name produces a junk test record that is effectively invisible in
test listoutput and the dashboard. Thetest createpath already prevents this viarequireString(dogfood P1 fix #1);test updatemissed the same guard and only checks the upper length bound.Reproduction
Root cause
src/commands/test.ts,runUpdate(line ~1212). The function validates name length:But has no lower-bound / whitespace check. A whitespace-only string passes
opts.name !== undefined(it's a non-empty string), the length check (3 < 200), and flows into the PATCH body.Fix
Add a whitespace rejection before the length check, mirroring the existing
requireNonEmpty/requireStringpattern used elsewhere in the same file:Tests
Added 1 regression test to
src/commands/test.test.ts(in therunUpdatedescribe block) assertingname: ' 'rejects withVALIDATION_ERROR/ fieldnameand makes no network call. Fails onmainbefore this fix; passes after.main):Tests 16 failed | 1359 passed | 72 skippedTests 16 failed | 1360 passed | 72 skipped(+1 new test)The 16 failures are pre-existing and environment-specific (Windows path/line-ending), unrelated -- see #4.
Verification
npm test: same 16 pre-existing (environment-specific) failures as baseline, zero newnpm run typecheck: passnpm run lint: pass