chore(yun-tianming): shrink change-narration comments to their constraints
Summary
- Comment narration shrunk to the surviving constraint in ten files. Each edited comment told the story of a past bug or a past code shape (“used to”, “previously working”, “the fix”, “was the actual gap”, “Neon is no longer used”, “since 0.0.38”, “moved in the command re-organization”) around a rule the code still obeys. The rule stays; the story goes.
src/commands/postgres.ts—dbStatsheader: dropped the retired-Neon narrative, kept “never dialed” and “nothing here polls”.src/commands/compute.ts—computeSSH: two comments (check-before-mint ordering; config block re-rendered on every store write) reduced to the ordering and re-render constraints.src/commands/cron.ts—cronEditWarnings: removed the “Silence here was the actual gap” sentence; the body-loss rule stays.src/commands/auth.ts—logoutdoc: kept why it must use the persisted config; removed “made this actively unsafe … The revoke now always goes”.src/config.ts—pickApiUrlguard comment andfindProjectRootstop-at-home comment rephrased as present-tense constraints.src/commands/deploy.ts—discoverLanevalidation comment and the--portparser comment reduced to the rule.src/commands/ssh-config.ts— dropped “it also drops the:the old token carried”.src/commands/upgrade.ts—skipsUpdateCheckbody comment reduced to the rule.src/commands/env.ts— removed the “since 0.0.38” version reference.
- Misplaced comments moved to the function they describe (documentation drift).
src/commands/upgrade.ts— the “Called once at CLI start-up. Never blocks…” comment sat aboveskipsUpdateCheck(inserted later, pergit blame); it describesmaybeUpdateand now sits there.src/commands/setup.ts— two paragraphs describingdefaultAskandopenPromptInputsat abovemakePromptSource; each now precedes the function it describes.
Safety
- Every hunk is a comment edit.
git diff | grep '^[+-]' | grep -v '^[+-]\s*//\|^[+-]\s*\*\|^[+-]\s*/\*\*'(excluding file headers) prints nothing: no code line changed. No exported symbol, signature, string literal, or behaviour is touched. - The three comment moves in
upgrade.tsandsetup.tsare documentation drift fixes:git blameshows the functions were inserted between a comment and its subject after the comment was written. - Typecheck and the full vitest suite pass with the same result as the untouched baseline.
Verification
Baseline on the untouched tree, then again on the final tree:
npx tsc -p tsconfig.json --noEmit # exit 0 both times (~4s)
npx vitest run # 85 files passed, 1673 tests passed, 121 skipped, both times (~25s)
Not run here: the 103 SSH-certificate tests in test/ssh-orchestration.test.ts and the ssh -G effective-config tests in test/ssh-config.test.ts skip because this machine has no ssh/ssh-keygen (they skip identically on the baseline). The remaining Windows-only skips are platform-gated. No lint script exists in package.json; CI runs only typecheck + vitest.
Deferred findings
src/util.tspromptPassword: the echo-mute sets_writeToOutputonprocess.stdout, but readline’s Interface uses its own (symbol-keyed) method, so the override is a no-op and the password echoes. Reported as a security finding; the fix changes user-visible behaviour.src/commands/postgres.ts: the branch/groupURLSearchParamsblock is repeated verbatim indbAlwaysOn,dbLimits,dbStats,dbVolume. Not refactored: those handlers are not exercised by tests (only their pure seams are —limits.test.ts,volume.test.ts,db-stats.test.ts).src/commands/metrics.tsandsrc/commands/storage.ts: identical privateqs()helpers. Collapsing means one module importing from another (or a new util export), which is a cross-module move; left for the owners.src/commands/compute.ts(2082 lines): lines ~800–2060 are SSH client infrastructure (key paths, alias store, cert staging, locks, config block) unrelated to compute lifecycle/domain commands, whilessh-config.tsalready exists. A file doing two jobs; moving code is out of scope.src/telemetry.tsdetectAgentvssrc/agent.tsdetectAgent: two same-named detectors with drifted rules (truthyCLAUDECODE+CURSOR_TRACE_IDvsCLAUDECODE === '1'+CURSOR_AGENT === '1'+ Codex). Which is right is a product decision.src/commands/secrets.tsensureIgnoredvssrc/gitignore.tsensureGitignore: two gitignore writers with different rules (.gitpresence check, header line). Similar, not identical, so not collapsed.src/commands/secrets.ts:secrets,secretsBind,secretsUnbind,secretsBindings,secretsSourcesinterpolatebranchinto output and query strings without a fallback; when neither--branchnor a linked branch is set they print or send the literalundefined. Behaviour change to fix.src/commands/project.tsresolveProjectName: splitscwdon/only, so on Windows a backslash path is slugified whole (e.g.c-users-me-projects-app) instead of using the directory basename. Defect; fix is a behaviour change.src/commands/setup.tslocalcliVersionduplicatessrc/version.tscliVersionwith a different fallback ('latest'vs'0.0.0') and without theINSTA_CLI_VERSIONcheck. Not identical, so not collapsed.src/commands/govern.ts:approvalsListandeventsbuild query strings withoutencodeURIComponenton--statusand--limit, unlike the rest of the repo. Cosmetic inconsistency; user-controlled input only.- Export hygiene: a background scan found 134
exported symbols referenced only within their own file and 205 exported solely for tests; none is unreferenced. The repo’s “pure seam, exported for tests” convention is deliberate, so nothing was removed.
Security findings
- [Yun Tianming] src/config.ts: writeGlobal stores access/refresh tokens in ~/.insta/config.json without 0600
- [Yun Tianming] src/commands/secrets.ts: .env bundle written with umask default mode
- [Yun Tianming] src/util.ts: promptPassword echo-muting is a no-op, password echoes in cleartext
- [Yun Tianming] src/observe/scanner.ts: snippet emits ±36 chars of raw context, leaking adjacent secrets
- [Yun Tianming] src/observe/hook.ts: audit.jsonl with secret fingerprints and snippets written 0644
- [Yun Tianming] src/deploy-archive.ts: uploadUrl from API response PUT to with no scheme/host check
- [Yun Tianming] src/commands/storage.ts: presigned download URL fetched without scheme check
- [Yun Tianming] src/api.ts: projectId from committed project.json interpolated into request paths unencoded
- [Yun Tianming] src/commands/mcp.ts: renderCodexConfig interpolates url into TOML unescaped
- [Yun Tianming] src/flyctl-build.ts: $HOME interpolated into an sh -c install command
- [Yun Tianming] src/commands/auth.ts: OAuth loopback page reflects the error param into HTML unescaped
- [Yun Tianming] src/util.ts: nextActions and approval hint print API strings without control-char stripping
- [Yun Tianming] src/redact.ts: DSN password pattern excludes /, leaving such connection strings unredacted
- [Yun Tianming] src/commands/upgrade.ts: default-on auto-update runs curl|sh from unpinned main install.sh
Opened by Yun Tianming: nightly sweep 2026-09-23-1000, model claude-fable-5-1, 75 turns, 10 files, 98 changed lines.
Verification: Passed: npx tsc -p tsconfig.json --noEmit (exit 0) and npx vitest run (85 files, 1673 passed, 121 skipped — identical to baseline); SSH-certificate suites skip here for lack of ssh/ssh-keygen.
🤖 Generated with Claude Code
Summary by cubic
Rewrites code comments across ten files so they describe the rules the code enforces, not the history of past bugs or refactors that led to those rules.
- Shrinks change-narration comments in
auth.ts,compute.ts,cron.ts,deploy.ts,env.ts,postgres.ts,ssh-config.ts,upgrade.ts, andconfig.tsto the surviving constraint (e.g., the "Neon no longer used" history inpostgres.ts, the "since 0.0.38" version reference inenv.ts, the "was the actual gap" story incron.ts). - Round 2 trimmed the residual narration in
computeSSH, restored the dropped "carries no:" fact inssh-config.ts, and unified mixed tense inauth.ts. - Moves three comments in
upgrade.tsandsetup.tsto sit above the functions they describe (maybeUpdate,openPromptInput,defaultAsk); two fix drift from later inserts, the third was misplaced from the start.
Comment-only change: no code lines, symbols, or behavior are touched, and typecheck plus the full vitest suite pass identically to the untouched baseline.