Skip to content

chore(yun-tianming): correct stale doc comments, drop filename headers - #314

Merged
Fermionic-Lyu merged 3 commits into
mainfrom
yun-tianming/2026-10-22-1300
Oct 22, 2026
Merged

Fermionic-Lyu merged 3 commits into
mainfrom
yun-tianming/2026-10-22-1300

Conversation

@Fermionic-Lyu

@Fermionic-Lyu Fermionic-Lyu commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

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, [Bug]: branch_state reports "ready" minutes before a branch's data plane serves; a failed branch create can 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-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 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/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.

Security findings


Opened by Yun Tianming: nightly sweep 2026-10-22-1300, model claude-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.

  • Corrects the doc claiming ossFetch does not wrap fetch rejections (it tags transport failures as CLIError, like platformFetch) and removes the false claim that streamDiagnosticAnalysis returns a raw Response (its signature is Promise<void>).
  • Moves the "Exported for unit testing." comment above the export it refers to, and trims a seven-line comment that restated the function's own doc.
  • Adds a note that the formatFetchError arm in the deployment poller is unreachable since ossFetch wraps raw fetch rejections.
  • Drops change narration ("now") and IMPORTANT: labels from comments; instruction text is unchanged.
  • Restores the original POLL_TIMEOUT_MS comment in src/commands/branch/create.ts after review, and adds a one-line pointer on HEALTH_TIMEOUT_MS to the sourcing issue.

No exported symbol, signature, string, default, or import changed. npm run lint, npm run build, and targeted vitest runs pass; tsc --noEmit reports only 17 pre-existing, ungated errors in untouched files.

Written for commit b720333. Summary will update on new commits.

View guided diff Turn on auto-fix

Summary by CodeRabbit

  • Documentation
    • Updated internal code comments to clarify authentication, provisioning timeouts, deployment polling, error handling, and credential redaction.
    • Removed file-path headers and revised emphasis in several technical notes.
    • No user-facing behavior changed.

## 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>
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 70346bf9-9392-48b0-9c5f-87edc00ead4a
📥 Commits

Reviewing files that changed from the base of the PR and between 3f1f040 and b720333.

📒 Files selected for processing: 6
  • src/auth-providers/apply.ts
  • src/commands/branch/create.ts
  • src/commands/deployments/deploy.ts
  • src/lib/command-telemetry.ts
  • src/lib/config-capabilities.ts
  • src/lib/flyctl.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1af0e317-d058-4e82-9388-8de6530b0caa
📥 Commits

Reviewing files that changed from the base of the PR and between e68f9c1 and 78813eb.

📒 Files selected for processing: 15
  • src/auth-providers/apply.ts
  • src/commands/branch/create.ts
  • src/commands/config/apply.ts
  • src/commands/config/export.ts
  • src/commands/config/index.ts
  • src/commands/config/plan.ts
  • src/commands/deployments/deploy.ts
  • src/lib/api/platform.ts
  • src/lib/command-telemetry.ts
  • src/lib/config-capabilities.ts
  • src/lib/config-metadata.ts
  • src/lib/config-schema.ts
  • src/lib/config-secrets.ts
  • src/lib/errors.ts
  • src/lib/flyctl.ts
💤 Files with no reviewable changes: 7
  • src/lib/config-metadata.ts
  • src/lib/config-schema.ts
  • src/commands/config/apply.ts
  • src/commands/config/index.ts
  • src/commands/config/plan.ts
  • src/commands/config/export.ts
  • src/lib/config-secrets.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

Comments 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.

Changes

Comment updates

Layer / File(s) Summary
Comment and header updates
src/auth-providers/apply.ts, src/commands/branch/create.ts, src/commands/config/*, src/commands/deployments/deploy.ts, src/lib/api/platform.ts, src/lib/command-telemetry.ts, src/lib/config-capabilities.ts, src/lib/config-metadata.ts, src/lib/config-schema.ts, src/lib/config-secrets.ts, src/lib/errors.ts, src/lib/flyctl.ts
Comments were clarified or condensed, and file-path headers were removed. The edits describe existing polling timing and fetch-error handling, credential redaction, configuration processing, and other existing behavior. No executable code changed.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~4 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to 3f1f0

Merge Risk: ⚪ Minimal · up to 3f1f0

No runtime behavior changes are present, so the PR is mergeable after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the main changes: correcting stale documentation comments and removing filename headers.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit reads the comments in the morning light
The notes grow clear, the headers take their flight
No code has changed beneath the words
The branch waits calmly as it stirs
I nibble clover, pleased with what I write

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread src/commands/branch/create.ts Outdated
Comment on lines +20 to +21
// 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Suggested change
// 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 jwfing left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 — ossFetch does wrap transport rejections: src/lib/api/oss.ts:248-257 throws CLIError(formatFetchError(...), 1, NETWORK_ERROR_CODE), matching platform.ts:106 and :117. The !res.ok path also throws CLIError (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 is Promise<void> (:260); the only caller, src/commands/diagnose/index.ts:211-215, consumes onEvent alone and ignores any return. Deleted sentence was simply false. ✅
  • src/auth-providers/apply.ts:124-125 — MASKED_PASSWORD_PATTERN is not exported and is used only in-file (:141); refreshStaleEnvDefaults is what apply.test.ts:2 imports. The label now sits above the right symbol. ✅
  • src/commands/branch/create.ts:20-25 — HEALTH_TIMEOUT_MS = 10 * 60 * 1_000 at :25, used at :176 and :282; the old comment's ready→serving framing did belong to that constant, not to POLL_TIMEOUT_MS. ✅
  • "Nothing else in src carries one" — grep -rn '^// CLI/src' src/ is clean, and grep -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 the IMPORTANT: prefix leaves the paragraphs unrewrapped, so each now opens on a short orphan line (// Only pass non-sensitive metadata as properties — counts,; // Probe the RAW JSON, never the Zod-parsed object. Zod's). Cosmetic. The substantive telemetry rule is enforced by DEVELOPMENT.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:88 bearer-redaction note — and the instruction text under each is byte-identical apart from the dropped label. The INSFORGE_DEBUG body-logging issue linked in the body (#313) is platform.ts:97-99 and 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>
@Fermionic-Lyu

Copy link
Copy Markdown
Member Author

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.


Yun Tianming, review round 1 of 10, pushed 3f1f04006ab2.

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>
@Fermionic-Lyu

Copy link
Copy Markdown
Member Author

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 [Bug]: branch_state reports "ready" minutes before a branch's data plane serves; a failed branch create can still leave one running 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.


Yun Tianming, review round 2 of 10, pushed b72033364eb3.

@jwfing jwfing left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 in src carries one" is literally true.
  • Surviving claims: ossFetch does wrap transport rejections as CLIError(…, NETWORK_ERROR_CODE) (src/lib/api/oss.ts:248-257), so the corrected errors.ts:54-56 text is right. streamDiagnosticAnalysis is Promise<void> (src/lib/api/platform.ts:257-261), so dropping the "returns the raw Response" sentence is right. MASKED_PASSWORD_PATTERN is not exported (apply.ts:124, used only at :141) while refreshStaleEnvDefaults is what apply.test.ts:2 imports — so moving "Exported for unit testing." down one declaration is correct.
  • CI at head: Lint & Build success. Macroscope skipped; cubic and Greptile still in_progress.
  • Sibling reviews: both existing reviews (cubic 5614751495, mine 5614760795) sit at 78813eb, not at this head. Nothing unadjudicated at 3f1f040.

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 jwfing left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 in src carries one" is literally true; no half-swept file.
  • New deploy.ts:329-331 note is correct. pollDeployment's catch rethrows unless isTransientApiError(err), which returns false for every non-CLIError (src/lib/errors.ts:60); ossFetch throws CLIError(formatFetchError(url), 1, NETWORK_ERROR_CODE) on transport rejection (src/lib/api/oss.ts:247-258, added by fbffb74 — commit exists and touches that file). So the formatFetchError arm at :332 is genuinely unreachable. This also repairs the r1 gap where deleting the errors.ts sentence orphaned the only in-tree note on that dead branch.
  • New apply.ts:112-135 JSDoc is accurate. MASKED_PASSWORD_PATTERN is non-exported and used only at :145; the masked-URL rationale now sits above it, and refreshStaleEnvDefaults (the symbol apply.test.ts:2 actually imports) carries "Exported for unit testing." The added sentence — a masked URL is stale "even when it differs from the default" — matches matchesDefault || isMaskedPassword at :145-148.
  • errors.ts:54-56 and the dropped streamDiagnosticAnalysis "returns the raw Response" sentence were verified in r1 and are unchanged here.
  • CI at head: Lint & Build success. 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 — dropping IMPORTANT: from the "never send user-entered free text" warning de-emphasises a rule that DEVELOPMENT.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.ts and command-telemetry.ts changes since 3f1f040 are 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 jwfing left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 — the POLL_TIMEOUT_MS comment is back to its base text (unchanged by this PR), and the only edit is a new sentence on HEALTH_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 at create.ts:20), which asked to "restore the ready-vs-serving distinction".
  • deployments/deploy.ts:327-332 — a new note explains the formatFetchError arm is unreachable since fbffb74. This closes my r1 Information finding that deleting the errors.ts sentence 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 above MASKED_PASSWORD_PATTERN and refreshStaleEnvDefaults gets a proper JSDoc. Cleaner than the r1 shuffle.
  • command-telemetry.ts, config-capabilities.ts, flyctl.ts — pure re-wrapping of paragraphs left ragged by the IMPORTANT: 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 in src carries 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: ossFetch does wrap transport rejections as CLIError(…, NETWORK_ERROR_CODE) (src/lib/api/oss.ts:248-257), so the corrected errors.ts:54-56 text is right. streamDiagnosticAnalysis is Promise<void> (platform.ts:257-261), so dropping "returns the raw Response" is right. MASKED_PASSWORD_PATTERN is not exported (apply.ts:124, used only at :145) while refreshStaleEnvDefaults is what apply.test.ts:2 imports.
  • CI at this head: Lint & Build success; Macroscope skipped; cubic and Greptile still in_progress.
  • Sibling reviews: cubic 5614751495 and my r1 5614760795 both sit at 78813eb; 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.)

@greptile-apps

greptile-apps Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This comment-only PR appears safe to merge.

Summary

This PR corrects and trims comments across 15 files. No executable code changes.

  • API comments match how polling and diagnostic calls work.
  • Auth-provider notes explain how saved environment values get refreshed.
  • Other CLI notes keep their guidance without stale wording or emphasis labels.
  • Config files no longer start with filename labels.

Reviews (1) · Last reviewed commit: "chore(yun-tianming): correct stale doc c..." · Reviewed by Greptile

@Fermionic-Lyu

Copy link
Copy Markdown
Member Author

Review round 3. Head is b720333, one commit past the 3f1f040 this review was written against. That commit was the round-2 response and is the only delta: it added the one-line #1790 pointer on HEALTH_TIMEOUT_MS, the "unreachable since fbffb74" note on the formatFetchError arm in deploy.ts, the /** */ conversion in auth-providers/apply.ts, and rewrapped the three paragraphs that lost their IMPORTANT: label. No working-tree change this round.

Addressed

  • Stale PR body (Suggestion 1) — Valid. gh is denied in this session, so I cannot run gh pr edit; the corrected text is below for whoever has write access to the description. Three corrections: the create.ts:20-24 bullet, the file count, and the 7fa4829 deferred bullet.

    Replace the third Summary bullet with:

    src/commands/branch/create.ts:27-28: the POLL_TIMEOUT_MS comment is restored verbatim (round 1). Round 2 added one sentence on HEALTH_TIMEOUT_MS: "The ready-to-serving measurements above come from [Bug]: branch_state reports "ready" minutes before a branch's data plane serves; a failed branch create can still leave one running InsForge#1790", so the 10 min < 11.5 min question sits next to the constant it concerns.

    The file count is correct again at this head: git diff e68f9c1..b720333 --stat → 15 files, +41/−52 (the create.ts pointer brings the file back in). "All 15 files: comment edits only" stands.

    Replace the last Deferred bullet with:

    src/commands/branch/create.ts:18-28: POLL_TIMEOUT_MS (15 min) is justified by the ready → host-answering gap, which HEALTH_TIMEOUT_MS (10 min, enforced at :285) actually bounds, against an 11.5 min observation. Pre-existing; needs the branch-create owner to decide whether 10 min is the right health budget. Separate PR.

  • Orphaned dead-branch explanation (Information 1) — Already closed at b720333: deploy.ts:330-332 now says the formatFetchError arm is unreachable since fbffb74 because ossFetch wraps raw rejections and isTransientApiError returns false for non-CLIError. Removing the arm itself stays deferred (needs a cast or type-predicate change).

Declined

  • create.ts under-budgeted HEALTH_TIMEOUT_MS (Suggestion 2) — Agreed it is a pre-existing drift and belongs in a separate PR; it would change a timeout default, which this sweep may not touch. Lives in the Deferred bullet above.
  • cubic P3 at create.ts:21 — The ready-vs-serving distinction was restored verbatim at 3f1f040 (git diff e68f9c1..HEAD -- src/commands/branch/create.ts shows only the HEALTH_TIMEOUT_MS sentence). I did not take the suggested rewording, since the original text already makes the distinction and commit 7fa4829's message is self-contradictory on which phase the 11.5 min figure measures; not for a comment sweep to settle.
  • IMPORTANT: labels on command-telemetry.ts:24 and config-capabilities.ts:14 (Information 2) — Kept dropped. Both instruction texts are preserved verbatim and the telemetry rule is already a hard requirement in DEVELOPMENT.md §2, which is where the weight lives.

Verification

npm run lint   → exit 0 (vitest 79 files passed / 2 skipped, 838 tests passed / 14 skipped; eslint clean)
npm run build  → exit 0 (ESM + DTS build success)
git diff e68f9c1..HEAD -U0 | non-comment filter → 2 lines, both blank (one removed after a dropped header, one added before the new /** */ block)
grep -rn 'IMPORTANT' src/ → 0; grep -rn '^// CLI/src' src/ → 0
git status → clean

Baseline on main: same gates pass; tsc --noEmit has 17 pre-existing errors and is not a gate.


Yun Tianming, review round 3 of 10: nothing left to change.

@jwfing jwfing left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - approved.

@Fermionic-Lyu
Fermionic-Lyu merged commit d57d0c4 into main Oct 22, 2026
5 checks passed
@Fermionic-Lyu
Fermionic-Lyu deleted the yun-tianming/2026-10-22-1300 branch October 22, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants