Repository navigation
Conversation
…d of swallowing it Extract the frozen provisioning install into installWorktreeDeps, which mirrors reinstallIfLockfileChanged's status check: on a non-zero exit it warns (chalk.yellow) naming the resolved command so the user can rerun it, and warn-and-continues rather than aborting. Previously ensureWorktree ran the install and discarded the result, so after #816/#826 switched to a frozen npm ci a repo with no/stale lockfile yielded a silently dependency-less worktree whose breakage only surfaced later as a confusing phase error. Adds a mocked unit test (no lockfile => npm ci exit 1) asserting the failure is reported, the stderr is surfaced, and the command is named even when stderr is empty. Entire-Checkpoint: 8e84f0faf466
…seInt #833 hardened 10 numeric flags with parseWholeNumber but left eight on a bare parseInt, justified in PR #836's AC-6 table by reasoning only about NaN. The unit-suffix misparse the guard exists for (parseInt("30m",10) is 30) was never addressed, so `logs --last 30m` read 30, the two --port flags bound the truncated port silently, and `--max-age 1w` failed *open* — state-cleanup.ts:181 gates on a truthy value, so 1w narrowed a 7-day retention to 1 day and deleted more than asked. All eight sites (status [issue], status --max-age, prompt --wait, logs --last, logs --issue, dashboard --port, serve --port, state clean --max-age) now use the same parseWholeNumber guard, coerced during commander's parse phase so a rejection exits before any server binds or cleanup runs. --wait uses min:0 (prompt.ts:259 reads 0 as "don't block"); the rest use min:1. Tests: extend numeric-flags.integration.test.ts with the issue's eight end-to-end reproductions (proves wiring, not just the coercion) plus the --wait 0 boundary; add a data-driven per-flag table in cli-flags.test.ts pinning reject-suffix (AC-1) and preserve-boundary (AC-4). Mutation-checked the --max-age case: reverting the coercion reaches the fail-open cleanup and the test fails. Entire-Checkpoint: 8a29dcd37f14
4 tasks
…-cli-options-still-use-bare-parseint-833- # Conflicts: # CHANGELOG.md
admarble
deleted the
feature/845-8-numeric-cli-options-still-use-bare-parseint-833-
branch
July 29, 2026 14:01
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.
Summary
Extends #833's
parseWholeNumberguard to the eight numeric CLI options PR #836 left on a bareparseInt. Those eight were justified as safe by reasoning only aboutNaN— but the failure #833 is named for is the unit-suffix misparse (parseInt("30m", 10) === 30), which none of them handled.Demonstrated end-to-end against the build before this change:
logs --last 30mrendered 30 runs;logs --issue 817xfiltered to 817;status 999999xwas read as 999999dashboard --port 3100x/serve --port 3199xbound the truncated port silently (the PR called these "fails loudly" — true forNaN, false for the misparse)--max-agefailed open:state-cleanup.ts:181gates on a truthy value, soNaNsafely skipped the age rule, but--max-age 1wparsed to a truthy1, silently narrowing a 7-day retention to 1 day and deleting more than askedAll eight sites now use the same
parseWholeNumberguard, coerced during commander's parse phase so a rejection exits before any server binds or cleanup runs.--waitusesmin: 0(notparsePositiveSeconds) becauseprompt.ts:259reads--wait 0as "don't block"; the rest usemin: 1.Pre-PR AC Verification
bin/cli.ts(8 sites);numeric-flags.integration.test.tsREJECTED_845 (all 8, spawns real CLI);cli-flags.test.tsper-flag table--max-agerejects1wrather than narrowing retention to 1 daystatus/state clean --max-agerejected before cleanup; mutation-checked (reverting reaches "🧹 Cleaning up…" and the test fails)3100xinstead of binding the truncated portdashboard/serve --portintegration cases--wait 0(min:0) accepted end-to-end; per-flag boundary table (123,7,30,817,3100,3199)Test plan
npm run build— passesnpm run lint— passes (0 warnings)cli-flags.test.ts+numeric-flags.integration.test.ts— 66 passed--max-agecoercion → AC-2 integration test fails on the fail-open pathNote:
src/commands/__tests__/prompt-wait.test.tshas one failing test (returns 0 and prints the reply…) — verified pre-existing by reproducing it on the pristine tree (stash) with none of this PR's changes. It callspromptCommand()directly and never exercises CLI coercion; the failure is asetTimeout-race ENOENT oninbox.jsonl, unrelated to #845.Closes #845