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
--priority on issues create and issues update passes user input through parseInt() without validating the result. Passing a non-numeric value (e.g. --priority abc) silently sends NaN to the Linear API, which either errors opaquely or is ignored. The same gap will apply to --estimate once #94 merges.
The codebase already has the right pattern — cycles.ts validates parseInt results using Number.isNaN() and invalidParameterError() — it's just not applied consistently in issues.ts.
# Current behavior — no client-side error, NaN hits the API
linearis issues create "Bug" --team ENG --priority abc
# Expected behavior — clear error before any API call# Error: Invalid --priority: must be an integer between 1 and 4
Proposed solution
Add parseInt + Number.isNaN() validation for all numeric option flags in issues.ts, using the existing invalidParameterError() helper from src/common/errors.ts.
Affected flags:
Flag
Command(s)
Valid range
--priority <1-4>
issues create, issues update
1–4 (integers)
--estimate <n>
issues create, issues update
positive integer (0 if team allows, scale-dependent)
Example validation (matching cycles.ts pattern):
if(options.priority){constn=parseInt(options.priority,10);if(Number.isNaN(n)||n<1||n>4){throwinvalidParameterError("--priority","must be an integer between 1 and 4");}input.priority=n;}if(options.estimate){constn=parseInt(options.estimate,10);if(Number.isNaN(n)||n<0){throwinvalidParameterError("--estimate","must be a non-negative integer");}input.estimate=n;}
Tests: Add cases for invalid input ("abc", "-1", "5" for priority) in both create and update command tests.
Alternatives considered
Commander .argParser() — could handle parsing + validation at the option level, but the codebase consistently validates in the action handler. Switching patterns for two flags isn't worth the inconsistency.
Validate against team estimation scale — would catch values outside the configured scale (e.g. 7 on a fibonacci team), but requires fetching team config first. Better suited for feat(teams): add teams read command with full team configuration #95 as an optional strict mode.
What problem does this solve?
--priorityonissues createandissues updatepasses user input throughparseInt()without validating the result. Passing a non-numeric value (e.g.--priority abc) silently sendsNaNto the Linear API, which either errors opaquely or is ignored. The same gap will apply to--estimateonce #94 merges.The codebase already has the right pattern —
cycles.tsvalidatesparseIntresults usingNumber.isNaN()andinvalidParameterError()— it's just not applied consistently inissues.ts.Proposed solution
Add
parseInt+Number.isNaN()validation for all numeric option flags inissues.ts, using the existinginvalidParameterError()helper fromsrc/common/errors.ts.Affected flags:
--priority <1-4>issues create,issues update--estimate <n>issues create,issues updateExample validation (matching
cycles.tspattern):Tests: Add cases for invalid input (
"abc","-1","5"for priority) in both create and update command tests.Alternatives considered
.argParser()— could handle parsing + validation at the option level, but the codebase consistently validates in the action handler. Switching patterns for two flags isn't worth the inconsistency.7on a fibonacci team), but requires fetching team config first. Better suited for feat(teams): add teams read command with full team configuration #95 as an optional strict mode.Additional context
cycles.tslines 82–86 already validateparseIntwithNumber.isNaN()+invalidParameterError()--estimate), refs Feature: Add estimate support to issues #26 (original estimate feature request)