Skip to content

fix: remove next 40 unused local findings (batch 5) - #2457

Merged
jatmn merged 1 commit into
Twigpine:mainfrom
jatmn:fix/unused-locals-batch-5
Oct 27, 2026
Merged

jatmn merged 1 commit into
Twigpine:mainfrom
jatmn:fix/unused-locals-batch-5

Conversation

@jatmn

@jatmn jatmn commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fix the next 40 bottom findings from js/unused-local-variable, excluding the 160 IDs covered by #2451, #2453, #2454 and #2456. Selection preserves the managed API's default descending order captured before editing.

Remove unused imports, constants, bindings and uncalled private functions. Most deleted lines are unused streaming-test helpers left behind after test extraction, plus their now-unused private types/helpers. Active stall/idle helpers in the integration tests remain. No test registration or active assertion is removed.

Finding IDs: 2904, 2905, 2903, 2901, 2902, 2899, 2900, 2897, 2898, 2896, 2884, 2877, 2868, 2820, 2795, 2794, 2785, 2784, 2766, 2765, 2764, 2763, 2762, 2761, 2718, 2712, 2695, 2694, 2688, 2687, 2662, 2648, 2647, 2646, 2645, 2603, 2586, 2584, 2583, 2582.

Impact

  • User-facing impact: no intended behavior change. Preserve the React compiler hook call, SDK pending-permission resolution loop, request context interface and live streaming/abort behavior.
  • Developer/maintainer impact: 40 findings addressed across 22 files. The only overlap with the earlier open batches is REPL.tsx in fix: remove next 40 unused local findings (batch 4) #2456, which removes a different import. This PR does not include earlier batches' fixes. The open SDK environment PR feat(sdk): let a v2 session carry its own environment #2268 affects different behavior and does not cover this unused loop-key finding.

Testing

  • Followed Validation, including applicable static/type checks and regression tests.
  • Affected surfaces: root source, scripts and tests. All local checks ran on the exact tree committed as dad5b8f5ba9142c75e5fde70a512e1661e243692; no prior batch's test results reused.
  • Passed: bun install --frozen-lockfile; bun run check:static (ESLint, any budget, smoke build, deadcode); bun run typecheck:fast; bun run typecheck:type-tests (11 files); node bin/openclaude --version; NODE_DISABLE_COMPILE_CACHE=1 node bin/openclaude --version; git diff --check.
  • Focused command: bun run test ./scripts/openclaude-bin-heap.test.ts ./scripts/provider-launch.test.ts ./src/memdir/autoExtractFacts.test.ts ./src/memdir/vectorIndex.test.ts ./src/services/api/claude.lifecycle.test.ts ./src/services/api/claude.streamWatchdog.test.ts ./src/services/api/openaiShim/providerStreamInterruptionTrace.test.ts ./src/services/api/openaiShim/requestExecutor.integration.test.ts ./src/services/api/openaiShim/requestExecutor.test.ts ./src/services/api/openaiShim/streamControl.test.ts ./src/services/compact/compact.test.ts ./src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.test.ts ./src/tools/WebSearchTool/providers/exa.test.ts ./src/utils/conversationArc.test.ts ./src/utils/knowledgeGraph.test.ts ./src/utils/providerValidation.test.ts ./src/utils/sessionStorage.atomicReplace.test.ts ./tests/sdk/sdk-v2-lifecycle.test.ts — 629 passed across 18 files, 1850 assertions. bun run test:conversation-arc — 1 passed, 9 assertions. Both guarded reports completed.
  • Committed intent scan passed after git fetch https://github.com/Twigpine/openclaude.git main: bun run security:pr-scan -- --base FETCH_HEAD --head HEAD.
  • Reviewed every changed hunk. AST comparison verifies all 396 surviving top-level test statements in eight edited test files are unchanged, and removed private helpers/types have no remaining references. All 11 import-only files emit identical TypeScript JavaScript. Existing stream control, provider interruption traces, idle timeouts and SDK lifecycle tests pass.
  • Local environment: Bun 1.4.4 / Node 26 on Linux. The launcher stdout-capture assertion failed on both unchanged base ec6bc3fd5d75dae8c5657d16125a2f7ffd9c9ac1 and this candidate inside the sandbox. Unchanged base tests and the complete candidate suite passed outside it; no source/assertion changes were needed.
  • Inapplicable checks: website and extension inputs, dependencies and configuration are unchanged. Full local suite unnecessary for behavior-preserving unused-code removal; full unit and Node matrices run in CI. Existing mocks retained; no live API claims.
  • CI: all 25 checks passed on dad5b8f5ba9142c75e5fde70a512e1661e243692, including the required PR/install/VS Code aggregate checks, full unit shards, dedicated feature tests, supported Node launchers and CodeQL; three unrelated jobs skipped as expected. CodeRabbit review approved the same revision with no requested changes.

Notes

  • Provider/model paths: existing OpenAI-compatible, Claude lifecycle/watchdog, Exa and provider-validation tests; provider behavior is unchanged.
  • Screenshots: not applicable; rendering unchanged.
  • Managed findings close after merge and Code Quality rescan. Draft retained; no alert dismissal.

@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 31274c1 and dad5b8f.

Files selected for processing: 22
  • scripts/openclaude-bin-heap.test.ts
  • scripts/provider-launch.ts
  • src/components/ClaudeMdExternalIncludesDialog.tsx
  • src/components/HighlightedCode/Fallback.tsx
  • src/components/PromptInput/PromptInput.tsx
  • src/entrypoints/sdk/v2.ts
  • src/memdir/autoExtractFacts.ts
  • src/memdir/vectorIndex.test.ts
  • src/screens/REPL.tsx
  • src/services/api/bootstrap.ts
  • src/services/api/claude.lifecycle.test.ts
  • src/services/api/openaiShim.ts
  • src/services/api/openaiShim/requestExecutor.integration.test.ts
  • src/services/api/openaiShim/requestExecutor.test.ts
  • src/services/api/openaiShim/requestExecutor.ts
  • src/services/compact/compact.test.ts
  • src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.test.ts
  • src/tools/WebSearchTool/providers/exa.ts
  • src/utils/conversationArc.ts
  • src/utils/knowledgeGraph.ts
  • src/utils/providerValidation.test.ts
  • src/utils/sessionStorage.ts
Files with no reviewable changes: 12
  • src/services/api/openaiShim/requestExecutor.ts
  • src/services/api/bootstrap.ts
  • src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.test.ts
  • scripts/provider-launch.ts
  • src/services/api/claude.lifecycle.test.ts
  • src/services/api/openaiShim/requestExecutor.integration.test.ts
  • src/components/PromptInput/PromptInput.tsx
  • src/screens/REPL.tsx
  • src/services/compact/compact.test.ts
  • scripts/openclaude-bin-heap.test.ts
  • src/services/api/openaiShim.ts
  • src/utils/conversationArc.ts

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

Recent review details
Context from checks skipped due to timeout: 2
  • GitHub Check: CodeRabbit
  • GitHub Check: CodeQL (javascript-typescript)
Additional context used
Code guidelines: 1
AGENTS.md — configured
Path-based instructions: 7
Review provider routing, model selection, env precedence, auth/token handling, OpenAI-compatible shims, retries, proxy behavior, and outbound HTTP behavior with high scrutiny.

CodeRabbit configuration file

Files:

  • src/utils/providerValidation.test.ts
  • src/services/api/openaiShim/requestExecutor.test.ts
Review permission prompts, auto-allow logic, sandbox behavior, SDK permission schemas, shell/PowerShell execution, and background execution paths as security-sensitive.

CodeRabbit configuration file

Files:

  • src/entrypoints/sdk/v2.ts
  • src/tools/WebSearchTool/providers/exa.ts
Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions.

CodeRabbit configuration file

Files:

  • src/memdir/vectorIndex.test.ts
  • src/utils/providerValidation.test.ts
  • src/services/api/openaiShim/requestExecutor.test.ts
Review install, launcher, build, packaging, startup, and entrypoint changes for cross-platform compatibility, tracked-source rewrites, env/config precedence, and release safety.

CodeRabbit configuration file

Files:

  • src/entrypoints/sdk/v2.ts
Apply the OpenClaude maintainer review rubric from AGENTS.md.

CodeRabbit configuration file

Files:

  • src/components/ClaudeMdExternalIncludesDialog.tsx
  • src/utils/knowledgeGraph.ts
  • src/memdir/vectorIndex.test.ts
  • src/utils/providerValidation.test.ts
  • src/entrypoints/sdk/v2.ts
  • src/components/HighlightedCode/Fallback.tsx
  • src/memdir/autoExtractFacts.ts
  • src/utils/sessionStorage.ts
  • src/tools/WebSearchTool/providers/exa.ts
  • src/services/api/openaiShim/requestExecutor.test.ts
Source excerpt: No hidden policy change: Verify that product, trust-model, routing-default, telemetry/network, and permission-policy changes are not hidden inside unrelated cleanup.

CodeRabbit inference engine (Custom checks)

Files:

  • src/components/ClaudeMdExternalIncludesDialog.tsx
  • src/utils/knowledgeGraph.ts
  • src/memdir/vectorIndex.test.ts
  • src/utils/providerValidation.test.ts
  • src/entrypoints/sdk/v2.ts
  • src/components/HighlightedCode/Fallback.tsx
  • src/memdir/autoExtractFacts.ts
  • src/utils/sessionStorage.ts
  • src/tools/WebSearchTool/providers/exa.ts
  • src/services/api/openaiShim/requestExecutor.test.ts
Source excerpt: TypeScript with strict mode and ESM imports.

CodeRabbit inference engine (AGENTS.md)

Files:

  • src/components/ClaudeMdExternalIncludesDialog.tsx
  • src/utils/knowledgeGraph.ts
  • src/memdir/vectorIndex.test.ts
  • src/utils/providerValidation.test.ts
  • src/entrypoints/sdk/v2.ts
  • src/components/HighlightedCode/Fallback.tsx
  • src/memdir/autoExtractFacts.ts
  • src/utils/sessionStorage.ts
  • src/tools/WebSearchTool/providers/exa.ts
  • src/services/api/openaiShim/requestExecutor.test.ts
Additional comments: 10
src/services/api/openaiShim/requestExecutor.test.ts: 1

8-8: LGTM!

Also applies to: 14-14

src/memdir/vectorIndex.test.ts: 1

2-2: LGTM!

src/utils/providerValidation.test.ts: 1

3-3: LGTM!

src/components/ClaudeMdExternalIncludesDialog.tsx: 1

35-35: LGTM!

src/components/HighlightedCode/Fallback.tsx: 1

4-4: LGTM!

src/entrypoints/sdk/v2.ts: 1

404-404: LGTM!

src/memdir/autoExtractFacts.ts: 1

10-10: LGTM!

src/tools/WebSearchTool/providers/exa.ts: 1

31-31: LGTM!

src/utils/knowledgeGraph.ts: 1

11-11: LGTM!

src/utils/sessionStorage.ts: 1

82-82: LGTM!

Also applies to: 90-90

Walkthrough

This pull request removes unused imports, local bindings, constants, wrappers, and test helpers across scripts and application modules. It also removes stream-abort test utilities from OpenAI shim tests.

Changes: Code cleanup

Layer / File(s) Summary
OpenAI shim cleanup
src/services/api/openaiShim.ts, src/services/api/openaiShim/requestExecutor.ts, src/services/api/openaiShim/requestExecutor*.test.ts
The shim and request executor remove unused bindings. The request executor tests remove stream-abort helpers and related test utilities.
Application binding cleanup
src/components/*, src/entrypoints/sdk/v2.ts, src/memdir/*, src/screens/REPL.tsx, src/services/api/bootstrap.ts, src/tools/WebSearchTool/providers/exa.ts, src/utils/*
Application modules remove unused imports and local helpers. The pending-prompt loop still denies each pending prompt.
Script and test helper cleanup
scripts/*, src/memdir/vectorIndex.test.ts, src/services/api/claude.lifecycle.test.ts, src/services/compact/compact.test.ts, src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.test.ts, src/utils/providerValidation.test.ts
Scripts and tests remove unused imports, a command wrapper, a timeout helper, and a test context helper.

Priority: Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Suggested reviewers: gravirei

Merge Risk: Minimal · up to dad5b

The cleanup has no identified merge-blocking behavior change.

Pre-merge checks: Passed 6 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within survi… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 6 passed
Check name Status Explanation
Title check Passed The title "fix: remove next 40 unused local findings (batch 5)" accurately describes the changeset, which removes unused imports, constants, bindings, and uncalled private helpers across 22 files. It …
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.
Risk Surface Disclosed Passed PASS. The PR description calls out the relevant risk surfaces: SDK pending-permission resolution, provider request context, and streaming/abort behavior. The diff confirms that production changes only…
No Hidden Policy Change Passed PASS. The reviewed diff contains unused-import, unused-binding, and dead-helper cleanup. The only permission-related line changes the loop binding from [toolUseId, pending] to [, pending]; it stil…
Description check Passed The pull request description follows the required template. It explains the changes and rationale, documents user-facing and maintainer impact, lists validation commands and results, records the sandb…
Full details: Title check

Explanation

The title "fix: remove next 40 unused local findings (batch 5)" accurately describes the changeset, which removes unused imports, constants, bindings, and uncalled private helpers across 22 files. It follows a conventional prefix and is scoped to the change. It does not name the affected areas, but it is not vague or misleading.

Full details: Risk Surface Disclosed

Explanation

PASS. The PR description calls out the relevant risk surfaces: SDK pending-permission resolution, provider request context, and streaming/abort behavior. The diff confirms that production changes only remove unused bindings/imports or an unused private wrapper; the SDK loop still denies every pending prompt, and OpenAI/WebSearch routing behavior is unchanged. The description states no intended behavior change, and the current review reports zero actionable findings, so no blocker is identified.

Full details: No Hidden Policy Change

Explanation

PASS. The reviewed diff contains unused-import, unused-binding, and dead-helper cleanup. The only permission-related line changes the loop binding from [toolUseId, pending] to [, pending]; it still resolves every pending prompt with behavior: 'deny' and the same message. The request executor still receives fastPath; only an unused local destructuring is removed. No product, trust-model, routing-default, telemetry/network, or permission-policy decision changes. Affected test registration counts remain unchanged.

Full details: Description check

Explanation

The pull request description follows the required template. It explains the changes and rationale, documents user-facing and maintainer impact, lists validation commands and results, records the sandbox limitation and CI status, and includes relevant notes. No critical information is missing.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 10 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@jatmn jatmn self-assigned this Oct 27, 2026
@jatmn
jatmn marked this pull request as ready for review October 27, 2026 17:24
@jatmn
jatmn merged commit 1ce3c30 into Twigpine:main Oct 27, 2026
28 checks passed
@jatmn
jatmn deleted the fix/unused-locals-batch-5 branch October 27, 2026 17:24
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.

1 participant