You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Hackathon] fix(project): validate non-empty and non-whitespace <project-id> across project env commands #385
The project env command group (project env list, project env get, project env create, project env update, project env delete, and project env set-default) accepts a positional <project-id> argument but does not validate that it is non-empty and non-whitespace before proceeding.
When a positional <project-id> argument is empty or whitespace (e.g. testsprite project env list "$PROJECT_ID" or testsprite project env get " " prod when an environment variable is unset or whitespace):
Under --dry-run: The CLI immediately prints canned synthetic responses (e.g. sampleEnv, deleted: prod, etc.) and exits 0, providing a false-success indicator on an invalid project identifier.
In live mode: The unvalidated empty/whitespace argument is directly interpolated into the REST path (e.g. /projects/%20%20%20/env or /projects//env), sending malformed requests to the backend API rather than failing fast locally with a typed VALIDATION_ERROR (exit 5).
In contrast, sibling commands such as project delete explicitly validate <project-id> up front and throw VALIDATION_ERROR (<project-id> is required and must not be empty or whitespace-only, exit 5).
Details / implementation notes
Proposed Solution:
Add requireProjectId(raw: string | undefined): string in src/commands/project-env.ts throwing typed localValidationError('<project-id> is required and must not be empty or whitespace-only', '<project-id>') (exit 5, VALIDATION_ERROR).
Call requireProjectId up front in:
runEnvList
runEnvGet
runEnvCreate
runEnvUpdate
runEnvDelete
runEnvSetDefault
Add unit test suite in src/commands/project-env.spec.ts asserting that empty and whitespace project IDs consistently reject with code 5 (VALIDATION_ERROR) across all 6 commands in both live and --dry-run modes.
Branch is ready with all tests and formatting verified.
Confirmations
I have searched existing issues and this is not a duplicate.
I have provided my Discord identity above for reward coordination.
Thanks for the interest, @naufalfx805-source! This issue hasn't been accepted for implementation yet — see the triage comment (a maintainer will label it accepted once it is). Feel free to check back, or ping us on Discord if it's been quiet.
Thanks for the interest, @naufalfx805-source! This issue hasn't been accepted for implementation yet — see the triage comment (a maintainer will label it accepted once it is). Feel free to check back, or ping us on Discord if it's been quiet.
Closing as a duplicate of #368. Its scope now covers empty and whitespace-only positional ids for every command in one change, including the commands listed here. Thanks for the report! If you'd like to work on it, comment /assign on #368.
Activity
naufalfx805-source commentedon Oct 12, 2026
/assign
testsprite-hob commentedon Oct 12, 2026
Thanks for the interest, @naufalfx805-source! This issue hasn't been accepted for implementation yet — see the triage comment (a maintainer will label it
acceptedonce it is). Feel free to check back, or ping us on Discord if it's been quiet.naufalfx805-source commentedon Oct 19, 2026
/assign
testsprite-hob commentedon Oct 19, 2026
Thanks for the interest, @naufalfx805-source! This issue hasn't been accepted for implementation yet — see the triage comment (a maintainer will label it
acceptedonce it is). Feel free to check back, or ping us on Discord if it's been quiet.ruili-testsprite commentedon Oct 20, 2026
Closing as a duplicate of #368. Its scope now covers empty and whitespace-only positional ids for every command in one change, including the commands listed here. Thanks for the report! If you'd like to work on it, comment
/assignon #368.