Repository navigation
chore(yun-tianming): correct stale doc comments, drop filename headers - #314
Conversation
## Summary - `src/lib/errors.ts:54-56`: the `isTransientApiError` doc claimed `ossFetch` does NOT wrap raw fetch rejections and that "the deployment poller" handles them. Since fbffb74, `ossFetch` tags transport failures as `CLIError(NETWORK_ERROR_CODE)` (`src/lib/api/oss.ts:248-256`), exactly like `platformFetch` (`platform.ts:106,117`). Comment now says both wrap. - `src/lib/api/platform.ts:255-256`: `streamDiagnosticAnalysis` doc said "Returns the raw Response so the caller can handle errors before streaming"; the signature is `Promise<void>` and the only caller (`commands/diagnose/index.ts`) uses `onEvent` alone. Sentence dropped. - `src/commands/branch/create.ts:20-24`: the `POLL_TIMEOUT_MS` comment attributed the 11.5-minute measurement to the ready→host-answering gap, which is governed by `HEALTH_TIMEOUT_MS` (10 min, line 25/282), and narrated the change from 5 to 15 minutes. Replaced with the one surviving constraint: must exceed the longest observed provisioning time (11.5 min on ap-southeast, InsForge/InsForge#1790, per commit 7fa4829's message), and what breaks below it. - `src/auth-providers/apply.ts:124`: "Exported for unit testing." sat above the non-exported `MASKED_PASSWORD_PATTERN`; moved to sit above `refreshStaleEnvDefaults`, which is the export `apply.test.ts` imports. Lines 367-373: a seven-line "Two passes" comment that restated `refreshStaleEnvDefaults`' own doc and narrated "after the CLI started fetching DATABASE_URL" shrunk to two lines. - `src/commands/deployments/deploy.ts:321` and `src/lib/api/platform.ts:88`: dropped "now" change narration ("ossFetch now tags", "it is now the long-lived uak_"). - Filename header comments (`// CLI/src/...`) removed from the eight config-family files: `lib/config-{metadata,secrets,capabilities,schema}.ts`, `commands/config/{apply,export,plan,index}.ts`. Nothing else in `src` carries one. - `IMPORTANT:` prose labels dropped from `lib/config-capabilities.ts:14`, `lib/command-telemetry.ts:24`, `lib/flyctl.ts:104`; the instruction text under each is unchanged. ## Safety - All 15 files: **comment edits only**. `git diff` contains no non-comment line. Every surviving factual claim was checked against the code it describes (citations above). - The one declaration adjacent to an edit (`MASKED_PASSWORD_PATTERN`) did not move; only the comment line above it moved one line down. - No exported symbol, signature, string, default or import changed; `dist/` untouched. ## Verification Baseline on untouched HEAD (e68f9c1), then final tree: ``` npx tsc --noEmit # 17 errors on baseline (pre-existing, ungated) → 17 on final npx eslint src/ # clean → clean npx vitest run --passWithNoTests # baseline: 79 files passed, 2 skipped; 838 tests passed, 14 skipped # final: 79 files passed, 2 skipped; 838 tests passed, 14 skipped ``` `npm run lint` is `vitest run && eslint src/`; both halves were run separately so a red vitest could not mask eslint. Not run: `test:integration:real` (needs real-project cloud secrets, CI-only on `main` push), and `npm run build` (the diff is comments only; `tsc` covers type validity). ## Deferred findings Already filed in PR #308 body (not restated): `backups/index.ts` missing `requireExplicit` guard for delete/restore; `api/posthog.ts`/`webscraper.ts` retry `>` vs `>=` and missing `unauthorized` arm; `posthog/setup.ts:79-83` exits before `shutdownAnalytics`; `extractEnvPairs` CRLF-sensitive; `track*Usage` double-emit. New tonight, all behaviour changes or refactors without direct coverage, left alone: - `src/commands/projects/link.ts:357-359`: `link --project-id X` without `--org-id` skips the org picker (`:332`), leaves `orgId` undefined and writes it to `config.default_org_id`; `saveGlobalConfig` JSON-stringifies, so the user's saved default org is silently deleted. - `src/commands/projects/link.ts:104-106`: `--auth` validation throws outside the `try`, bypassing `handleError`; `index.ts` has no `unhandledRejection` handler, so a bad `--auth` prints a raw stack instead of `Error: ...` with the CLIError exit code. The sibling `--template` check at `:109` is inside the `try`. - `src/commands/functions/delete.ts:40-44` and `functions/deploy.ts:87-89`: a `result.success === false` response is printed through `outputSuccess` (`✓ Failed to delete function`), telemetry records success, exit code 0. `deploy.ts:87` also prints the non-word "updation". - `src/commands/orgs/manage.ts:276`: `orgs members remove` resolves the org from ambient `INSFORGE_ORG_ID`/linked project, while `leave` (`:120`) and `delete` (`:154`) use `requireExplicitOrgId`. With `--yes` a stray env var points the eviction at the wrong org. Same shape as the `backups` finding in #308. - `src/commands/secrets/update.ts:24-25`, `src/commands/schedules/update.ts:32`: `opts.active === 'true'` turns `--active yes`/`TRUE`/`1` into `false` with no error; `link.ts:86-89` normalises the same kind of flag. - `src/commands/docs.ts:31`: `reportCliUsage('cli.docs', true)` runs before any work and the catch never reports `false`; every sibling reports after output and `false` on failure. - `src/commands/records/{list,delete,update}.ts`: `opts.filter.split('=')` computed twice per call, triplicated; a filter with no `=` becomes `?id=` and is sent as a DELETE/PATCH predicate. No records tests exist, so the redundant split was not collapsed. - `src/lib/api/platform.ts:110-112`: when `getAccessToken()` was empty, line 73 already minted a token; a 401 then calls `refreshAccessToken` again, spending a second round trip and rotation on a seconds-old token. - `src/lib/api/platform.ts:119-127` vs `:134-141`: identical error-body parsing written twice inside `platformFetch`, already drifted in naming. No `platform.test.ts` exists, so not collapsed. - `src/lib/api/platform.ts:274-293`: SSE `currentEvent` is never reset after a dispatch, so a bare `data:` frame after `event: error` is delivered as `error`. - `src/lib/api/posthog.ts:9-24` vs `webscraper.ts:9-27`: copy-pasted `fetchWithTimeout` drifted; only webscraper has the pre-abort guard, so `pollPosthogConnection` issues one more request after the user aborts. `sleep`, `PollOptions`, both pollers and both `cli-start` functions are byte-identical duplicates across the two files. Cross-module; not collapsed. - `src/lib/api/posthog.ts:306`, `webscraper.ts:309`: `body.error ?? res.statusText ?? \`HTTP ${status}\`` — `statusText` is always a string (`''` on HTTP/2), so the last arm is unreachable and an HTTP/2 error yields an empty message. - `src/lib/api/posthog.ts:91-110`: comment says null "strictly" means no connection, but any CLIError whose message contains the substring `404` is swallowed to null, and a real connection lacking `apiKey` also returns null. - `src/lib/api/oss.ts:341`: `res.clone().json()` where `res` is never otherwise read; `res.json()` is equivalent. `probeBackendHealth` is only ever mocked in tests, so left as is. - `src/commands/deployments/deploy.ts:331`: the `formatFetchError` branch is unreachable because `isTransientApiError` returns false for every non-CLIError; removing it needs a cast or a type-predicate signature change, so left. - `src/commands/projects/link.ts:250-256` vs `:311-317`: byte-identical "agent connected" block in both direct-link branches; `:552-558` awaits `shutdownAnalytics()` in both catch and finally (the finally copy is unreachable after `handleError`'s `process.exit`). - `src/commands/branch/create.ts` commit 7fa4829's message is internally inconsistent about which phase the 11.5-minute measurement belongs to (point 1 says `branch_state` read `ready` throughout; point 2 says it was reported "still creating"). The new comment cites the issue rather than the phase. Co-Authored-By: Claude (claude-fable-5-1) <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 53 minutes. View limit details
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughComments and file-header comments changed across authentication, configuration, deployment, API, telemetry, and build code. The edits clarify or condense existing descriptions. No runtime behavior changed. ChangesComment updates
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~4 minutes Change: Other Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
1 issue found across 15 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/commands/branch/create.ts">
<violation number="1" location="src/commands/branch/create.ts:20">
P3: This rewrite changes the meaning of the measurement. The 11.5 min ap-southeast figure was the ready-to-serving gap, which HEALTH_TIMEOUT_MS covers, not the time to reach 'ready' that POLL_TIMEOUT_MS bounds. The #1790 reference also belongs to the adoption race described in `createBranchOrAdopt`. Restore the ready-vs-serving distinction so the comment does not claim the wrong budget is measured.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| // Must exceed the longest observed provisioning time: 11.5 min on ap-southeast | ||
| // (InsForge/InsForge#1790). Below that, a slow branch is reported as stuck. |
There was a problem hiding this comment.
P3: This rewrite changes the meaning of the measurement. The 11.5 min ap-southeast figure was the ready-to-serving gap, which HEALTH_TIMEOUT_MS covers, not the time to reach 'ready' that POLL_TIMEOUT_MS bounds. The #1790 reference also belongs to the adoption race described in createBranchOrAdopt. Restore the ready-vs-serving distinction so the comment does not claim the wrong budget is measured.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At src/commands/branch/create.ts, line 20:
<comment>This rewrite changes the meaning of the measurement. The 11.5 min ap-southeast figure was the ready-to-serving gap, which HEALTH_TIMEOUT_MS covers, not the time to reach 'ready' that POLL_TIMEOUT_MS bounds. The #1790 reference also belongs to the adoption race described in `createBranchOrAdopt`. Restore the ready-vs-serving distinction so the comment does not claim the wrong budget is measured.</comment>
<file context>
@@ -17,11 +17,8 @@ import { readBranchWithRetry } from './poll.js';
-// (2 min and 11.5 min on ap-southeast). A 5-minute ceiling reported the slower
-// one as "still creating" when it was simply not finished yet, so the budget
-// now covers the observed range with headroom.
+// Must exceed the longest observed provisioning time: 11.5 min on ap-southeast
+// (InsForge/InsForge#1790). Below that, a slow branch is reported as stuck.
const POLL_TIMEOUT_MS = 15 * 60 * 1_000;
</file context>
| // Must exceed the longest observed provisioning time: 11.5 min on ap-southeast | |
| // (InsForge/InsForge#1790). Below that, a slow branch is reported as stuck. | |
| // Must exceed the longest observed time to reach 'ready' (create to ready, not ready to serving; | |
| // the ready-to-serving gap is covered by HEALTH_TIMEOUT_MS). |
jwfing
left a comment
There was a problem hiding this comment.
Summary
Comment-only sweep (15 files, +13/-35): three stale doc claims corrected, narration trimmed, eight filename headers and three IMPORTANT: labels dropped — every surviving factual claim checked against the code it describes and all of them hold.
Requirements context
No docs/superpowers/ in this repo — specs live in docs/specs/ (three dated design docs: diagnose x2, db-migrations), none of which covers a comment sweep. Assessed against the PR body, DEVELOPMENT.md and .claude/skills/cli-development/ — neither documents any comment/header convention, so the header and label removals are a consistency call, not a rule violation. Reviewed at head 78813eb; Lint & Build is success at that head (Macroscope skipped; cubic and Greptile still in progress at post time).
Comment-only claim verified mechanically: git diff e68f9c1..78813eb -U0 filtered to non-comment lines yields exactly one hunk line — the blank line that followed the removed header in src/lib/config-schema.ts:1-2. No declaration, signature, string, default or import changed.
Claims re-verified against the tree:
src/lib/errors.ts:54-56—ossFetchdoes wrap transport rejections:src/lib/api/oss.ts:248-257throwsCLIError(formatFetchError(...), 1, NETWORK_ERROR_CODE), matchingplatform.ts:106and:117. The!res.okpath also throwsCLIError(oss.ts:259+, with a.catch(() => ({}))on the body parse), so "wrap every transport and HTTP failure" is accurate. ✅src/lib/api/platform.ts:253-256— signature isPromise<void>(:260); the only caller,src/commands/diagnose/index.ts:211-215, consumesonEventalone and ignores any return. Deleted sentence was simply false. ✅src/auth-providers/apply.ts:124-125—MASKED_PASSWORD_PATTERNis not exported and is used only in-file (:141);refreshStaleEnvDefaultsis whatapply.test.ts:2imports. The label now sits above the right symbol. ✅src/commands/branch/create.ts:20-25—HEALTH_TIMEOUT_MS = 10 * 60 * 1_000at:25, used at:176and:282; the old comment's ready→serving framing did belong to that constant, not toPOLL_TIMEOUT_MS. ✅- "Nothing else in
srccarries one" —grep -rn '^// CLI/src' src/is clean, andgrep -rn IMPORTANT src/now returns zero hits, so both sweeps are complete rather than partial. ✅
Findings
Critical
(none)
Suggestion
Functionality — src/commands/branch/create.ts:20-25. The rewrite moves the 11.5-minute measurement onto POLL_TIMEOUT_MS as "longest observed provisioning time", but the comment it replaces asserted that the measured gap was branch_state = ready → the branch's own host answering — which is the window HEALTH_TIMEOUT_MS (10 min, :25) governs, not the control-plane poll. The PR body acknowledges commit 7fa4829's message is self-contradictory on exactly this point. If the ready→serving reading is the right one, the constant that is under-budgeted is HEALTH_TIMEOUT_MS at 10 min < 11.5 min observed, and the sweep has now removed the only place that recorded the datum near it. HEALTH_TIMEOUT_MS's own comment (:23-24) carries no numbers. Suggest a one-line pointer to InsForge/InsForge#1790 on HEALTH_TIMEOUT_MS so the open question stays visible to the next reader rather than being resolved by omission. Non-blocking: no runtime change either way.
Software engineering — src/auth-providers/apply.ts:112-126. Moving // Exported for unit testing. below the const fixes the mis-attached label, but it now wedges that line between the 12-line block doc (:112-123, which describes refreshStaleEnvDefaults' behaviour) and the function at :126. The doc is now separated from its subject by both the MASKED_PASSWORD_PATTERN declaration and the test note, and :367-368's new "see refreshStaleEnvDefaults" pointer sends readers to that detached block. Cleaner: hoist MASKED_PASSWORD_PATTERN (plus the masked-URL paragraph that actually explains it) above the block doc, or convert the block doc to a /** */ on the function so editor hover picks it up.
Software engineering — src/lib/errors.ts:54-56 ↔ src/commands/deployments/deploy.ts:331. The deleted sentence ("its callers handle that case themselves — see the deployment poller") was the only in-tree explanation for the formatFetchError branch at deploy.ts:331. The PR body correctly identifies that branch as unreachable and defers it, but with the comment gone the dead branch is now unannotated and the next sweep will re-derive it from scratch. A one-line // unreachable since fbffb74 — see errors.ts would close the loop without the type-predicate change the body says removal would require.
Information
src/lib/command-telemetry.ts:24,src/lib/config-capabilities.ts:14,src/lib/flyctl.ts:104: dropping theIMPORTANT:prefix leaves the paragraphs unrewrapped, so each now opens on a short orphan line (// Only pass non-sensitive metadata asproperties— counts,;// Probe the RAW JSON, never the Zod-parsed object. Zod's). Cosmetic. The substantive telemetry rule is enforced byDEVELOPMENT.md§2 regardless, so no guidance is lost by the label drop.- No tests added or changed, which is correct here — the diff contains no executable line, and the test suites that cover the touched modules (
errors.test.ts:96,oss.test.ts:128,apply.test.ts) are untouched and already pin the behaviour the corrected comments describe. - Security: no security-relevant code changes. The two security-adjacent edits are prose only — the telemetry PII instruction and the
platform.ts:88bearer-redaction note — and the instruction text under each is byte-identical apart from the dropped label. TheINSFORGE_DEBUGbody-logging issue linked in the body (#313) isplatform.ts:97-99and is untouched by this PR; nothing is newly logged or returned. - Performance: no runtime effect of any kind — comment-only diff, no new queries, loops, allocations or I/O.
Verdict
approved — zero Critical findings. Three Suggestions and a few Information notes, none blocking. (Informational only; the GitHub green check remains a human action.)
Review round 1. **Addressed** - `src/commands/branch/create.ts:20` (POLL_TIMEOUT_MS comment): valid. The 2 min / 11.5 min ap-southeast figures were measured as the gap between `branch_state === 'ready'` and the branch host answering, and `InsForge/InsForge#1790` is the adoption race documented on `createBranchOrAdopt`, not a provisioning-time report. My condensed version attached both to the wrong thing. Restored the original comment text verbatim from main (`git diff main -- src/commands/branch/create.ts` now shows that hunk as unchanged; the only remaining diff in the file is the `pollUntilReady` docstring trim, which the reviewer did not flag). **Declined** - None. **Verification** ``` npm run lint # vitest: 79 files passed, 2 skipped; 838 tests passed, 14 skipped; eslint clean — exit 0 npm run build # tsup ESM + DTS build success — exit 0 git status # only src/commands/branch/create.ts modified ``` Note: `npx tsc --noEmit` reports 17 errors, all in files whose PR diff is comment-only or in files the PR does not touch (test files, `metadata.ts`, `prompts.ts`). None involve a type this PR changed. The repo has no typecheck script; `lint` and `build` are the defined gates and both pass. Co-Authored-By: Claude (claude-fable-5-1) <noreply@anthropic.com>
|
Addressed
Declined
Verification Note: Yun Tianming, review round 1 of 10, pushed |
Review round 2. ## Addressed - **`create.ts:20-25` (jwfing Suggestion 1, cubic P3)** — The reviewed head was `78813eb`; the original ready-vs-serving comment on `POLL_TIMEOUT_MS` was already restored verbatim in `3f1f040` after cubic's round-1 note. This round adds the requested one-line pointer on `HEALTH_TIMEOUT_MS`: "The ready-to-serving measurements above come from InsForge/InsForge#1790." The open 10 min < 11.5 min question now sits next to the constant it concerns. I did not take cubic's suggested rewording of the `POLL_TIMEOUT_MS` comment, since the verbatim restore is already in place and commit `7fa4829` is self-contradictory on which budget the 11.5 min figure measures; that is for the branch-create owner to settle, not a comment sweep. - **`apply.ts:112-126` (jwfing Suggestion 2)** — Hoisted the masked-URL paragraph to sit directly above `MASKED_PASSWORD_PATTERN`, and converted the `refreshStaleEnvDefaults` description to a `/** */` block on the function itself with the "Exported for unit testing." line inside it. The const declaration did not move; only comments did. `apply.test.ts` still passes (3 files / 43 tests for apply, errors, oss). - **`deploy.ts:331` (jwfing Suggestion 3)** — Added a three-line note above the `lastTransientError` assignment: the `formatFetchError` arm is unreachable since `fbffb74` because `ossFetch` wraps raw fetch rejections and `isTransientApiError` returns false for non-`CLIError` values. No code change; the type-predicate removal stays deferred as in the PR body. - **Orphan lines after dropped `IMPORTANT:` labels (Information)** — Rewrapped the paragraphs in `command-telemetry.ts`, `config-capabilities.ts` and `flyctl.ts`. Wording is unchanged. ## Declined - Nothing declined. All points were comment-only and within the sweep's rules. ## Verification Working-tree diff filtered to non-comment lines is empty (6 files, +34/-26, all `//` or `*` lines). ``` npm run lint → exit 0 (eslint + vitest: 79 files passed, 838 tests passed, 14 skipped) npm run build → exit 0 (ESM + DTS build success) npx vitest run src/auth-providers/apply.test.ts src/lib/errors.test.ts src/lib/api/oss.test.ts → 43 passed ``` Baseline on main: same gates pass; `tsc --noEmit` has 17 pre-existing errors on main and is not a gate. Co-Authored-By: Claude (claude-fable-5-1) <noreply@anthropic.com>
Addressed
Declined
VerificationWorking-tree diff filtered to non-comment lines is empty (6 files, +34/-26, all Baseline on main: same gates pass; Yun Tianming, review round 2 of 10, pushed |
jwfing
left a comment
There was a problem hiding this comment.
Summary
Round 2 at 3f1f040. The only delta since my r1 review at 78813eb is a full revert of the src/commands/branch/create.ts comment hunk — which closes both my r1 Suggestion and cubic's only finding — leaving a 14-file, comment-only sweep that I re-verified holds.
Requirements context
No matching spec/plan found. This repo has no /docs/superpowers/; specs live in docs/specs/, which holds three dated design docs (2026-03-27-diagnose-command-design.md, 2026-03-27-diagnose-implementation-plan.md, 2026-04-17-db-migrations-command-design.md) — none covering a comment sweep. DEVELOPMENT.md (the repo's conventions doc) documents no comment or file-header convention, so header removal and IMPORTANT: de-emphasis are taste, not rule compliance. Assessed against the PR body alone.
What moved since r1
git diff 78813eb..3f1f040 is exactly one file: branch/create.ts restored to its base text. Head content is byte-identical to base (git diff e68f9c1..3f1f040 -- src/commands/branch/create.ts → empty).
My r1 Suggestion was that the rewrite relocated the mis-attribution rather than resolving it — re-labelling the 11.5-min datum onto POLL_TIMEOUT_MS left HEALTH_TIMEOUT_MS (10 min, under the 11.5-min observation) as the constant with no numbers in its comment. Reverting is a clean answer: nothing is relocated and no datum is lost. cubic's P3 at create.ts:20 asked to "restore the ready-vs-serving distinction" — that is literally what the revert did, so it is discharged too.
Re-verified at this head
- Comment-only, mechanically:
git diff e68f9c1..3f1f040 -U0 | grep -E '^[+-]' | grep -vE '^(\+\+\+|---)' | grep -vE '^[+-]\s*(//|\*|/\*)'→ a single removed blank line (the one that followed a deleted header). No code line changed. - Sweep completeness:
grep -rn '^// CLI/src' src/→ 0;grep -rn 'IMPORTANT' src/→ 0;"now"-narration grep → 0. The body's "nothing else insrccarries one" is literally true. - Surviving claims:
ossFetchdoes wrap transport rejections asCLIError(…, NETWORK_ERROR_CODE)(src/lib/api/oss.ts:248-257), so the correctederrors.ts:54-56text is right.streamDiagnosticAnalysisisPromise<void>(src/lib/api/platform.ts:257-261), so dropping the "returns the raw Response" sentence is right.MASKED_PASSWORD_PATTERNis not exported (apply.ts:124, used only at:141) whilerefreshStaleEnvDefaultsis whatapply.test.ts:2imports — so moving "Exported for unit testing." down one declaration is correct. - CI at head:
Lint & Buildsuccess.Macroscopeskipped; cubic and Greptile stillin_progress. - Sibling reviews: both existing reviews (cubic
5614751495, mine5614760795) sit at78813eb, not at this head. Nothing unadjudicated at3f1f040.
Findings
Critical
(none)
Suggestion
Functionality / docs accuracy — the PR body is now stale against the head. The body's third bullet still describes a src/commands/branch/create.ts:20-24 rewrite in detail ("Replaced with the one surviving constraint…"), and the Safety section still says "All 15 files". At 3f1f040 that file is untouched and the PR is 14 files. The last "Deferred findings" bullet, about commit 7fa4829's internally inconsistent message, also no longer has a corresponding hunk. Anyone merging on the body's description will believe a create.ts comment correction landed when it did not — please drop that bullet and correct the file count.
Functionality — the pre-existing create.ts drift is now left unfixed by anyone. Reverting was the right call for this PR, but it restores the original state in which POLL_TIMEOUT_MS's comment (create.ts:18-22) justifies a 15-minute budget with the branch_state ready → host-answering gap, which is actually bounded by HEALTH_TIMEOUT_MS (10 min, create.ts:25, enforced at :285). That under-budgeted constant still carries the shorter timeout against an 11.5-min observation. Worth a separate PR that fixes the attribution and examines whether 10 minutes is the right health budget — not something to re-litigate here.
Information
Software engineering — a deleted comment orphans the dead branch it explained. errors.ts:54-56 dropped "ossFetch does NOT wrap raw fetch rejections, so its callers handle that case themselves (see the deployment poller)". That sentence was the only in-tree note explaining the formatFetchError branch at src/commands/deployments/deploy.ts:331 — which this PR's own deferred list correctly identifies as unreachable, since isTransientApiError returns false for every non-CLIError. The new text is accurate; the dead branch is now just unexplained. A follow-up that removes the branch would close this properly. (Carried unchanged from r1.)
Software engineering — IMPORTANT: removal touches two notes that carry real weight. command-telemetry.ts:24 restates the rule DEVELOPMENT.md §2 (lines 48-50) states as a hard requirement — never send SQL, file contents, credentials or user-entered free text as event properties. config-capabilities.ts:14 is a genuine footgun warning (Zod's .default([]) erasing the very presence/absence signal the probe reads). Both instruction texts are preserved verbatim and only the label is dropped, and the repo documents no comment convention either way, so this is purely the author's call — noting it only because these two are not decorative prose.
Test coverage: none expected or added — the diff changes no executable line, so there is no behavior to pin. vitest 838 passed / 14 skipped matching baseline is the right evidence here, and Lint & Build is green at head.
Security: no security-relevant changes in this PR. No input reaches SQL/shell/HTTP differently, no auth check moved, no dependency added, and nothing newly logged — the platform.ts:88 edit is inside the redaction comment and leaves the redaction code untouched. The separately-tracked INSFORGE_DEBUG unredacted-body issue (#313) is pre-existing and not touched here.
Performance: no performance-relevant changes in this PR — no new queries, loops, allocations or I/O.
Verdict
approved — zero Critical findings. The r1 Suggestion and cubic's only finding are both discharged by the revert; the two Suggestions above are a stale PR body and a follow-up for pre-existing drift, neither blocking. (Informational — the human still approves via the approve flow.)
jwfing
left a comment
There was a problem hiding this comment.
Summary
Round 3 at b720333: the sweep is still mechanically comment-only, and the new delta since my r2 review (apply.ts doc restructure, a dead-arm note in deploy.ts, an issue citation on HEALTH_TIMEOUT_MS, three re-wraps) checks out — one Suggestion on the create.ts citation and one on the now-stale PR body.
Requirements context
No matching spec/plan found. This repo has no /docs/superpowers/; specs live in docs/specs/ (three dated design docs: diagnose ×2, db-migrations), none covering a comment sweep. DEVELOPMENT.md documents no comment/file-header convention, so the header and IMPORTANT: removals are taste, not rule compliance. Assessed against the PR body alone.
Sibling adjudication (please read — my r2 review is mis-anchored)
The branch grew a commit while my round-2 review was being composed. GitHub anchors review 5614824562 to b720333, but its text was written against 3f1f040 — its central claim, "the only delta since r1 is a full revert of branch/create.ts, head is byte-identical to base there", is no longer true at this head. Treat that review as describing 3f1f040; this review supersedes it. cubic's 5614751495 (P3 at create.ts:20) sits at 78813eb and was discharged by the 3f1f040 revert — the current head does not reinstate the rewrite it objected to.
git diff 3f1f040..b720333 → 6 files: auth-providers/apply.ts, commands/branch/create.ts, commands/deployments/deploy.ts, lib/command-telemetry.ts, lib/config-capabilities.ts, lib/flyctl.ts.
Re-verified at b720333
- Comment-only, mechanically:
git diff e68f9c1..b720333 -U0 | grep -E '^[+-]' | grep -vE '^(\+\+\+|---)' | grep -vE '^[+-]\s*(//|\*|/\*)'→ one added and one removed blank line, nothing else. No declaration, signature, string, default or import changed. This proof is cheaper and stronger than the test run, so the unchanged vitest counts are expected rather than evidence. - Sweep completeness:
grep -rn '^// CLI/src' src/→ 0;grep -rn IMPORTANT src/→ 0. The body's "nothing else insrccarries one" is literally true; no half-swept file. - New
deploy.ts:329-331note is correct.pollDeployment's catch rethrows unlessisTransientApiError(err), which returnsfalsefor every non-CLIError(src/lib/errors.ts:60);ossFetchthrowsCLIError(formatFetchError(url), 1, NETWORK_ERROR_CODE)on transport rejection (src/lib/api/oss.ts:247-258, added byfbffb74— commit exists and touches that file). So theformatFetchErrorarm at:332is genuinely unreachable. This also repairs the r1 gap where deleting theerrors.tssentence orphaned the only in-tree note on that dead branch. - New
apply.ts:112-135JSDoc is accurate.MASKED_PASSWORD_PATTERNis non-exported and used only at:145; the masked-URL rationale now sits above it, andrefreshStaleEnvDefaults(the symbolapply.test.ts:2actually imports) carries "Exported for unit testing." The added sentence — a masked URL is stale "even when it differs from the default" — matchesmatchesDefault || isMaskedPasswordat:145-148. errors.ts:54-56and the droppedstreamDiagnosticAnalysis"returns the raw Response" sentence were verified in r1 and are unchanged here.- CI at head:
Lint & Buildsuccess. Macroscope skipped; cubic and Greptile re-running (queued/in_progress) at post time.
Findings
Critical
(none)
Suggestion
Functionality / docs accuracy — src/commands/branch/create.ts:26-29. The added line reads "The ready-to-serving measurements above come from InsForge/InsForge#1790", hung under HEALTH_TIMEOUT_MS. The measurements "above" are 2 min and 11.5 min, and the comment now explicitly binds them to the ready→serving window — which is exactly the window this constant bounds at 10 min. So the comment, as it now reads, documents a budget that is below its own cited worst-case observation. Either the 11.5 min reading belongs to the whole provisioning window (the ambiguity in 7fa4829's message that the PR body itself calls out), in which case say so here, or HEALTH_TIMEOUT_MS is under-budgeted and the comment should note that rather than cite the number without comment. A citation is an improvement over r1's relocation; it just stops one sentence short of resolving the contradiction it now makes visible.
Software engineering — the PR body is stale against this head. Bullet 3 still describes replacing the POLL_TIMEOUT_MS comment with "must exceed the longest observed provisioning time (11.5 min…)" — that rewrite was reverted in 3f1f040; the head instead adds a citation to HEALTH_TIMEOUT_MS. The body also omits the two genuinely new edits at this head (the deploy.ts unreachable-arm note, the apply.ts JSDoc conversion) and its "48 changed lines" no longer matches (+41/−52). cubic's auto-summary is stale in the other direction ("leaving that file out of the diff" — it is back in). For a PR whose whole value is comment accuracy, the description is worth a pass before merge.
Information
src/auth-providers/apply.ts:112-118— "any:****@… password is refreshed from the platform" is slightly broader than the code: the refresh only fires when the key also has a manifest default and the platform supplies a different real value (:142-144). The JSDoc below carries the qualifier, so this is cosmetic.src/lib/command-telemetry.ts:24-26— droppingIMPORTANT:from the "never send user-entered free text" warning de-emphasises a rule thatDEVELOPMENT.md§2 states as a hard constraint. Instruction text is unchanged and the label is not a documented convention, so this is informational only.flyctl.ts,config-capabilities.tsandcommand-telemetry.tschanges since3f1f040are pure re-wrapping of text already reviewed — no claim changed.- Security: no security-relevant changes in this PR — no input handling, auth, secret or dependency change; the only secret-adjacent edits are the telemetry and bearer-redaction comments, both leaving the surrounding code untouched. Performance: no performance-relevant changes — no code executes differently. Tests: none required; the mechanical comment-only proof is stronger coverage than any test could give here.
Verdict
approved — no Critical findings. Two Suggestions (the create.ts citation that documents an under-budgeted constant, and the stale PR body) are worth a cleanup pass but do not block. Note the r2 review above is anchored to this commit but describes 3f1f040; this review is the current one.
jwfing
left a comment
There was a problem hiding this comment.
Summary — corrected round-2 review (supersedes my previous review)
Please read this instead of my review above. The branch moved twice while I was reviewing: I analysed 3f1f040, but b720333 landed mid-post and GitHub anchored that review to it, so its text describes a head that was already superseded. This review re-analyses b720333 (15 files, comment-only) and is the one that stands.
Verdict is unchanged: no Critical findings. b720333 is in fact a better head than the one I reviewed — it closes my r1 Suggestion, my r1 Information finding, and cubic's only finding.
Requirements context
No matching spec/plan found. No /docs/superpowers/ in this repo; specs live in docs/specs/, which holds three dated design docs (2026-03-27-diagnose-command-design.md, 2026-03-27-diagnose-implementation-plan.md, 2026-04-17-db-migrations-command-design.md) — none covering a comment sweep. DEVELOPMENT.md documents no comment or file-header convention, so header removal and IMPORTANT: de-emphasis are taste, not rule compliance. Assessed against the PR body alone.
What moved since my r1 review at 78813eb
Two commits: 3f1f040 reverted the branch/create.ts hunk outright, then b720333 re-approached it and swept up both of my r1 Information findings.
branch/create.ts:19-28— thePOLL_TIMEOUT_MScomment is back to its base text (unchanged by this PR), and the only edit is a new sentence onHEALTH_TIMEOUT_MS: "The ready-to-serving measurements above come from InsForge/InsForge#1790." This is a better answer than either earlier attempt — no datum is relocated, and the citation now names the constant that actually governs the ready→serving gap. It also discharges cubic's only finding (P3 atcreate.ts:20), which asked to "restore the ready-vs-serving distinction".deployments/deploy.ts:327-332— a new note explains theformatFetchErrorarm is unreachable sincefbffb74. This closes my r1 Information finding that deleting theerrors.tssentence orphaned the only in-tree explanation of that dead branch. The explanation now lives at the branch itself, which is the better home for it.auth-providers/apply.ts:112-129— rather than shuffling the one-line "Exported for unit testing.", the masked-password prose now sits aboveMASKED_PASSWORD_PATTERNandrefreshStaleEnvDefaultsgets a proper JSDoc. Cleaner than the r1 shuffle.command-telemetry.ts,config-capabilities.ts,flyctl.ts— pure re-wrapping of paragraphs left ragged by theIMPORTANT:removal. Text-preserving.
Verified at b720333
- Comment-only, mechanically:
git diff e68f9c1..b720333 -U0 | grep -E '^[+-]' | grep -vE '^(\+\+\+|---)' | grep -vE '^[+-]\s*(//|\*|/\*)'→ one added and one removed blank line. No executable line changed anywhere in the PR. - Sweep completeness:
grep -rn '^// CLI/src' src/→ 0;grep -rn 'IMPORTANT' src/→ 0;"now"-narration grep → 0. The body's "nothing else insrccarries one" is literally true. - New JSDoc claim is accurate: "A masked-password URL … is also treated as stale even when it differs from the default" matches
apply.ts:144-146(if (matchesDefault || isMaskedPassword)). - Surviving claims:
ossFetchdoes wrap transport rejections asCLIError(…, NETWORK_ERROR_CODE)(src/lib/api/oss.ts:248-257), so the correctederrors.ts:54-56text is right.streamDiagnosticAnalysisisPromise<void>(platform.ts:257-261), so dropping "returns the raw Response" is right.MASKED_PASSWORD_PATTERNis not exported (apply.ts:124, used only at:145) whilerefreshStaleEnvDefaultsis whatapply.test.ts:2imports. - CI at this head:
Lint & Buildsuccess;Macroscopeskipped; cubic and Greptile stillin_progress. - Sibling reviews: cubic
5614751495and my r15614760795both sit at78813eb; nothing else unadjudicated.
Findings
Critical
(none)
Suggestion
Functionality / docs accuracy — the PR body misdescribes the create.ts change. The third bullet still says the POLL_TIMEOUT_MS comment was "Replaced with the one surviving constraint (must exceed the longest observed provisioning time…)". At b720333 that comment is byte-identical to base — the replacement was reverted in 3f1f040 — and the only create.ts edit is the added #1790 citation on HEALTH_TIMEOUT_MS. The final "Deferred findings" bullet about commit 7fa4829's inconsistent message also no longer matches what shipped. The change itself is good; please update the bullet so the body describes it.
Functionality — the measurement and the constant it justifies are still a line apart. create.ts:19-24 narrates the ready→host-answering gap (2 min and 11.5 min on ap-southeast) directly above POLL_TIMEOUT_MS (15 min), while :26-28 now correctly states those are ready-to-serving measurements — which HEALTH_TIMEOUT_MS (10 min, enforced at :285) bounds. So the citation is right but the prose still sits over the wrong constant, and the 10-minute health budget remains below the 11.5-minute observation it is now explicitly tied to. The citation makes this traceable, which is real progress; a follow-up could move the paragraph down and revisit whether 10 minutes is the right health budget. Non-blocking and out of scope for a comment sweep.
Information
Resolved since r1: my Information finding about the orphaned dead branch is closed by deploy.ts:327-332. Noted so it is not re-raised.
Software engineering — IMPORTANT: removal touches two notes that carry real weight. command-telemetry.ts:24 restates the rule DEVELOPMENT.md §2 (lines 48-50) states as a hard requirement — never send SQL, file contents, credentials or user-entered free text as event properties. config-capabilities.ts:14 is a genuine footgun warning (Zod's .default([]) erasing the presence/absence signal the probe reads). Both instruction texts are preserved verbatim and only the label is dropped, and the repo documents no comment convention either way, so this is the author's call — noted only because these two are not decorative prose.
Test coverage: none expected or added — the diff changes no executable line, so there is no behavior to pin. vitest 838 passed / 14 skipped matching baseline is the right evidence here, and Lint & Build is green at head.
Security: no security-relevant changes in this PR. No input reaches SQL/shell/HTTP differently, no auth check moved, no dependency added, nothing newly logged — the platform.ts:88 edit is inside the redaction comment and leaves the redaction code untouched. The separately-tracked INSFORGE_DEBUG unredacted-body issue (#313) is pre-existing and not touched here.
Performance: no performance-relevant changes in this PR — no new queries, loops, allocations or I/O.
Verdict
approved — zero Critical findings. b720333 resolves my r1 Suggestion, my r1 Information finding and cubic's only finding. What remains is a stale PR-body bullet and a non-blocking follow-up on comment placement in create.ts. (Informational — the human still approves via the approve flow.)
[Low impact] This comment-only PR appears safe to merge. SummaryThis PR corrects and trims comments across 15 files. No executable code changes.
Reviews (1) · Last reviewed commit: "chore(yun-tianming): correct stale doc c..." · Reviewed by Greptile |
|
Review round 3. Head is Addressed
Declined
VerificationBaseline on main: same gates pass; Yun Tianming, review round 3 of 10: nothing left to change. |
Summary
src/lib/errors.ts:54-56: theisTransientApiErrordoc claimedossFetchdoes NOT wrap raw fetch rejections and that "the deployment poller" handles them. Since fbffb74,ossFetchtags transport failures asCLIError(NETWORK_ERROR_CODE)(src/lib/api/oss.ts:248-256), exactly likeplatformFetch(platform.ts:106,117). Comment now says both wrap.src/lib/api/platform.ts:255-256:streamDiagnosticAnalysisdoc said "Returns the raw Response so the caller can handle errors before streaming"; the signature isPromise<void>and the only caller (commands/diagnose/index.ts) usesonEventalone. Sentence dropped.src/commands/branch/create.ts:20-24: thePOLL_TIMEOUT_MScomment attributed the 11.5-minute measurement to the ready→host-answering gap, which is governed byHEALTH_TIMEOUT_MS(10 min, line 25/282), and narrated the change from 5 to 15 minutes. Replaced with the one surviving constraint: must exceed the longest observed provisioning time (11.5 min on ap-southeast, [Bug]: branch_state reports "ready" minutes before a branch's data plane serves; a failedbranch createcan still leave one running InsForge#1790, per commit 7fa4829's message), and what breaks below it.src/auth-providers/apply.ts:124: "Exported for unit testing." sat above the non-exportedMASKED_PASSWORD_PATTERN; moved to sit aboverefreshStaleEnvDefaults, which is the exportapply.test.tsimports. Lines 367-373: a seven-line "Two passes" comment that restatedrefreshStaleEnvDefaults' own doc and narrated "after the CLI started fetching DATABASE_URL" shrunk to two lines.src/commands/deployments/deploy.ts:321andsrc/lib/api/platform.ts:88: dropped "now" change narration ("ossFetch now tags", "it is now the long-lived uak_").// CLI/src/...) removed from the eight config-family files:lib/config-{metadata,secrets,capabilities,schema}.ts,commands/config/{apply,export,plan,index}.ts. Nothing else insrccarries one.IMPORTANT:prose labels dropped fromlib/config-capabilities.ts:14,lib/command-telemetry.ts:24,lib/flyctl.ts:104; the instruction text under each is unchanged.Safety
git diffcontains no non-comment line. Every surviving factual claim was checked against the code it describes (citations above).MASKED_PASSWORD_PATTERN) did not move; only the comment line above it moved one line down.dist/untouched.Verification
Baseline on untouched HEAD (e68f9c1), then final tree:
npm run lintisvitest run && eslint src/; both halves were run separately so a red vitest could not mask eslint. Not run:test:integration:real(needs real-project cloud secrets, CI-only onmainpush), andnpm run build(the diff is comments only;tsccovers type validity).Deferred findings
Already filed in PR #308 body (not restated):
backups/index.tsmissingrequireExplicitguard for delete/restore;api/posthog.ts/webscraper.tsretry>vs>=and missingunauthorizedarm;posthog/setup.ts:79-83exits beforeshutdownAnalytics;extractEnvPairsCRLF-sensitive;track*Usagedouble-emit.New tonight, all behaviour changes or refactors without direct coverage, left alone:
src/commands/projects/link.ts:357-359:link --project-id Xwithout--org-idskips the org picker (:332), leavesorgIdundefined and writes it toconfig.default_org_id;saveGlobalConfigJSON-stringifies, so the user's saved default org is silently deleted.src/commands/projects/link.ts:104-106:--authvalidation throws outside thetry, bypassinghandleError;index.tshas nounhandledRejectionhandler, so a bad--authprints a raw stack instead ofError: ...with the CLIError exit code. The sibling--templatecheck at:109is inside thetry.src/commands/functions/delete.ts:40-44andfunctions/deploy.ts:87-89: aresult.success === falseresponse is printed throughoutputSuccess(✓ Failed to delete function), telemetry records success, exit code 0.deploy.ts:87also prints the non-word "updation".src/commands/orgs/manage.ts:276:orgs members removeresolves the org from ambientINSFORGE_ORG_ID/linked project, whileleave(:120) anddelete(:154) userequireExplicitOrgId. With--yesa stray env var points the eviction at the wrong org. Same shape as thebackupsfinding in chore(yun-tianming): drop unreferenced types/errors exports, trim narration comments #308.src/commands/secrets/update.ts:24-25,src/commands/schedules/update.ts:32:opts.active === 'true'turns--active yes/TRUE/1intofalsewith no error;link.ts:86-89normalises the same kind of flag.src/commands/docs.ts:31:reportCliUsage('cli.docs', true)runs before any work and the catch never reportsfalse; every sibling reports after output andfalseon failure.src/commands/records/{list,delete,update}.ts:opts.filter.split('=')computed twice per call, triplicated; a filter with no=becomes?id=and is sent as a DELETE/PATCH predicate. No records tests exist, so the redundant split was not collapsed.src/lib/api/platform.ts:110-112: whengetAccessToken()was empty, line 73 already minted a token; a 401 then callsrefreshAccessTokenagain, spending a second round trip and rotation on a seconds-old token.src/lib/api/platform.ts:119-127vs:134-141: identical error-body parsing written twice insideplatformFetch, already drifted in naming. Noplatform.test.tsexists, so not collapsed.src/lib/api/platform.ts:274-293: SSEcurrentEventis never reset after a dispatch, so a baredata:frame afterevent: erroris delivered aserror.src/lib/api/posthog.ts:9-24vswebscraper.ts:9-27: copy-pastedfetchWithTimeoutdrifted; only webscraper has the pre-abort guard, sopollPosthogConnectionissues one more request after the user aborts.sleep,PollOptions, both pollers and bothcli-startfunctions are byte-identical duplicates across the two files. Cross-module; not collapsed.src/lib/api/posthog.ts:306,webscraper.ts:309:body.error ?? res.statusText ?? \HTTP ${status}`—statusTextis always a string (''` on HTTP/2), so the last arm is unreachable and an HTTP/2 error yields an empty message.src/lib/api/posthog.ts:91-110: comment says null "strictly" means no connection, but any CLIError whose message contains the substring404is swallowed to null, and a real connection lackingapiKeyalso returns null.src/lib/api/oss.ts:341:res.clone().json()whereresis never otherwise read;res.json()is equivalent.probeBackendHealthis only ever mocked in tests, so left as is.src/commands/deployments/deploy.ts:331: theformatFetchErrorbranch is unreachable becauseisTransientApiErrorreturns false for every non-CLIError; removing it needs a cast or a type-predicate signature change, so left.src/commands/projects/link.ts:250-256vs:311-317: byte-identical "agent connected" block in both direct-link branches;:552-558awaitsshutdownAnalytics()in both catch and finally (the finally copy is unreachable afterhandleError'sprocess.exit).src/commands/branch/create.tscommit 7fa4829's message is internally inconsistent about which phase the 11.5-minute measurement belongs to (point 1 saysbranch_statereadreadythroughout; point 2 says it was reported "still creating"). The new comment cites the issue rather than the phase.Security findings
Opened by Yun Tianming: nightly sweep
2026-10-22-1300, modelclaude-fable-5-1, 58 turns, 15 files, 48 changed lines.Verification: tsc 17 errors (= baseline, pre-existing, ungated); eslint src/ clean; vitest 838 passed / 14 skipped (= baseline); integration:real not run (needs cloud secrets).
🤖 Generated with Claude Code
Summary by cubic
Fixes stale, misleading, or redundant documentation comments across the CLI and removes filename header comments from the eight config-family files. Comment-only; no code behavior changes.
ossFetchdoes not wrap fetch rejections (it tags transport failures asCLIError, likeplatformFetch) and removes the false claim thatstreamDiagnosticAnalysisreturns a rawResponse(its signature isPromise<void>).formatFetchErrorarm in the deployment poller is unreachable sinceossFetchwraps raw fetch rejections.IMPORTANT:labels from comments; instruction text is unchanged.POLL_TIMEOUT_MScomment insrc/commands/branch/create.tsafter review, and adds a one-line pointer onHEALTH_TIMEOUT_MSto the sourcing issue.No exported symbol, signature, string, default, or import changed.
npm run lint,npm run build, and targeted vitest runs pass;tsc --noEmitreports only 17 pre-existing, ungated errors in untouched files.Written for commit b720333. Summary will update on new commits.
Summary by CodeRabbit