Skip to content

fix: resolve 46 unused local findings (batch 6) - #2458

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

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

Conversation

@jatmn

@jatmn jatmn commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Resolve 46 js/unused-local-variable Code Quality findings across 19 files, excluding findings covered by #2451, #2453, #2454, #2456, and #2457.

Remove unused imports, locals and uncalled private helpers, including the private helpers/constants used only by a discarded resume-search map. Preserve module loading, initializer calls with possible effects, public reexports, active test assertions and SDK pending-prompt handling.

Finding IDs: 3086, 3085, 3083, 3084, 3081, 3082, 3080, 3078, 3079, 3077, 3076, 3075, 3074, 3061, 3062, 3063, 3060, 3059, 3035, 3036, 3034, 2999, 2997, 2998, 2996, 2994, 2995, 2968, 2966, 2967, 2965, 2964, 2950, 2942, 2941, 2927, 2928, 2925, 2926, 2924, 2923, 2922, 2921, 2912, 2908, 2906.

Impact

No intended user-facing behavior or presentation change. Removes dead bindings and unreachable private code that generated these quality findings. No dependencies, configuration or public interfaces changed.

Testing

  • Followed CONTRIBUTING.md Validation and reviewed both CONTRIBUTING.md and AGENTS.md.
  • Validated commit: 1ead00536ab030d250a9cca509d4ddc54621dda0; committed diff matches the reviewed candidate.
  • bun install --frozen-lockfile — passed.
  • bun run check:static — passed (lint, any budget, smoke build, deadcode).
  • bun run typecheck:fast and bun run typecheck:type-tests — passed.
  • node bin/openclaude --version and NODE_DISABLE_COMPILE_CACHE=1 node bin/openclaude --version — passed, 0.33.0.
  • bun run test:conversation-arc — 1 passed; bun run test:context-efficiency — 4 passed.
  • npm --prefix vscode-extension/openclaude-vscode run lint — passed.
  • bun run --cwd vscode-extension/openclaude-vscode test — 51 passed. The sandbox run interfered with child-process output and timed out; the identical command passed with host process access, without source changes.
  • git diff --check — passed.
  • git fetch https://github.com/Twigpine/openclaude.git main followed by bun run security:pr-scan -- --base FETCH_HEAD --head HEAD — passed on the committed candidate.
  • Focused guarded test command — 668 passed across 18 files:
bun run test src/commands/provider/provider.test.tsx src/components/LogSelector.resumeBranches.test.ts src/query.abortClassification.test.ts src/screens/REPL.queryLifecycle.test.ts src/services/api/openaiShim.test.ts src/services/api/openaiShim/requestExecutor.test.ts src/services/tools/toolExecution.test.ts src/utils/attachments.extractors.test.ts src/utils/attachments.nestedDirs.test.ts src/utils/attachments.performance.test.ts src/utils/contextPartitioning.test.ts src/utils/conversationArc.test.ts src/utils/messages/streaming.test.ts src/utils/providerProfile.test.ts tests/sdk/mcp-cleanup.test.ts tests/sdk/query-lifecycle.test.ts tests/sdk/query-methods.test.ts tests/sdk/sdk-v2-lifecycle.test.ts

An external AST/transpilation check verified identical emitted JavaScript for all 8 import-only files and preserved 455 non-import top-level statements across 8 test files (normalizing only the unused arc binding to its retained initialization call). Three removed private test helpers have no surviving references; active assertions remain.

Focused local validation follows the contributor contract for dead-code removal with no shared runtime behavior changes. No website/build configuration inputs changed, so web checks are inapplicable. Local platform: Linux with Node 26; native Windows and the full clean-runner/Node matrix are covered by CI. All CI workflows passed on the validated revision: PR Checks, CodeQL, Install hygiene, and VS Code Windows launcher. CodeRabbit approved with no requested changes; this PR remains a draft.

Notes

Provider chooser/profile, API shim/request executor, SDK lifecycle, tool execution, resume selection, message streaming and attachment paths were covered by existing tests. No live-provider behavior changed, and no live API call was needed. No visual change; screenshots are inapplicable. Quality findings should close after merge and the next analysis. No alert dismissals or earlier-batch changes are included.

@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 1cead2c and 1ead005.

Files selected for processing: 19
  • src/commands/provider/provider.tsx
  • src/components/LogSelector.tsx
  • src/entrypoints/sdk/query.ts
  • src/main.tsx
  • src/query.ts
  • src/services/api/openaiShim.test.ts
  • src/services/api/openaiShim/requestExecutor.test.ts
  • src/services/tools/toolExecution.ts
  • src/utils/attachments.ts
  • src/utils/contextPartitioning.test.ts
  • src/utils/conversationArc.test.ts
  • src/utils/messages.ts
  • src/utils/providerProfile.test.ts
  • src/utils/providerProfile.ts
  • tests/sdk/mcp-cleanup.test.ts
  • tests/sdk/query-lifecycle.test.ts
  • tests/sdk/sdk-v2-lifecycle.test.ts
  • vscode-extension/openclaude-vscode/src/chat/chatProvider.js
  • vscode-extension/openclaude-vscode/src/chat/sessionManager.js
Files with no reviewable changes: 5
  • tests/sdk/sdk-v2-lifecycle.test.ts
  • src/services/api/openaiShim/requestExecutor.test.ts
  • vscode-extension/openclaude-vscode/src/chat/chatProvider.js
  • src/utils/providerProfile.ts
  • src/utils/providerProfile.test.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: 3
  • GitHub Check: CodeRabbit
  • GitHub Check: unit-tests (7)
  • GitHub Check: CodeQL (javascript-typescript)
Additional context used
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/commands/provider/provider.tsx
  • src/services/api/openaiShim.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/query.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/utils/conversationArc.test.ts
  • tests/sdk/query-lifecycle.test.ts
  • src/utils/contextPartitioning.test.ts
  • tests/sdk/mcp-cleanup.test.ts
  • src/services/api/openaiShim.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/query.ts
  • src/main.tsx
Review VS Code bridge and extension changes for schema compatibility, permission response integrity, command execution boundaries, message validation, and user-visible failure modes.

CodeRabbit configuration file

Files:

  • vscode-extension/openclaude-vscode/src/chat/sessionManager.js
Apply the OpenClaude maintainer review rubric from AGENTS.md.

CodeRabbit configuration file

Files:

  • vscode-extension/openclaude-vscode/src/chat/sessionManager.js
  • src/utils/conversationArc.test.ts
  • tests/sdk/query-lifecycle.test.ts
  • src/utils/contextPartitioning.test.ts
  • src/entrypoints/sdk/query.ts
  • src/query.ts
  • tests/sdk/mcp-cleanup.test.ts
  • src/utils/attachments.ts
  • src/commands/provider/provider.tsx
  • src/main.tsx
  • src/utils/messages.ts
  • src/components/LogSelector.tsx
  • src/services/tools/toolExecution.ts
  • src/services/api/openaiShim.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:

  • vscode-extension/openclaude-vscode/src/chat/sessionManager.js
  • src/utils/conversationArc.test.ts
  • tests/sdk/query-lifecycle.test.ts
  • src/utils/contextPartitioning.test.ts
  • src/entrypoints/sdk/query.ts
  • src/query.ts
  • tests/sdk/mcp-cleanup.test.ts
  • src/utils/attachments.ts
  • src/commands/provider/provider.tsx
  • src/main.tsx
  • src/utils/messages.ts
  • src/components/LogSelector.tsx
  • src/services/tools/toolExecution.ts
  • src/services/api/openaiShim.test.ts
Walkthrough

This pull request removes unused helpers, imports, and local bindings across application and test code. It also removes log-search text extraction utilities and changes the TEMPLATES classifier load to a side-effect import.

Changes: Unused-code cleanup

Layer / File(s) Summary
Remove unused code
src/commands/provider/provider.tsx, src/components/LogSelector.tsx, src/entrypoints/sdk/query.ts, src/main.tsx, src/query.ts, src/services/api/openaiShim.test.ts, src/services/api/openaiShim/requestExecutor.test.ts, src/services/tools/toolExecution.ts, src/utils/*, tests/sdk/*, vscode-extension/openclaude-vscode/src/chat/*
Removes unused imports, locals, helpers, and test utilities. LogSelector no longer builds searchable transcript text. The TEMPLATES-enabled query path loads the classifier for side effects. Existing permission-denial behavior and provider-profile re-exports remain.

Priority: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Possibly related PRs

  • Twigpine/openclaude#2456: Both PRs are batches in the same unused-local cleanup sequence and touch overlapping areas.
  • Twigpine/openclaude#2440: It removes Fuse-based deep-search execution in LogSelector.tsx; this PR removes related search-text helpers and constants.
  • Twigpine/openclaude#2457: Both PRs are batches in the same cleanup sequence and include SDK and OpenAI shim areas.

Suggested reviewers: chioarub, kevincodex1

Merge Risk: Minimal · up to 1ead0

No concrete current-head behavior or operational risk was identified; the cleanup is mergeable with normal checks.

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 is concise, scoped, and accurately describes the removal of 46 unused local findings across the changeset.
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 diff touches provider setup, SDK permission interruption, tool execution, MCP scope handling, and startup/module-loading paths. The PR description identifies provider chooser/profile, SDK pe…
No Hidden Policy Change Passed PASS — The diff contains cleanup only. The provider helper was unreferenced, and the active /provider help text and provider choices remain. The TEMPLATES classifier still loads under the same featu…
Description check Passed The pull request description follows the repository template. It explains the changes and rationale, documents user-facing and maintainer impact, lists detailed validation commands and results, identi…
Full details: Risk Surface Disclosed

Explanation

PASS. The diff touches provider setup, SDK permission interruption, tool execution, MCP scope handling, and startup/module-loading paths. The PR description identifies provider chooser/profile, SDK pending-prompt handling, tool execution, and preserved module loading or side effects. It also states that no live-provider behavior, live API behavior, user-facing behavior, or public interface changed. The current review reports zero actionable findings, so no blocker is identified.

Full details: No Hidden Policy Change

Explanation

PASS — The diff contains cleanup only. The provider helper was unreferenced, and the active /provider help text and provider choices remain. The TEMPLATES classifier still loads under the same feature gate. Permission interruption still resolves every pending prompt as denied. Telemetry and MCP metadata calls remain. Module-loading calls for Gemini metadata and crypto remain. No product, trust-model, routing-default, network, telemetry, or permission-policy decision changed.

Full details: Description check

Explanation

The pull request description follows the repository template. It explains the changes and rationale, documents user-facing and maintainer impact, lists detailed validation commands and results, identifies inapplicable checks and platform limits, records CI and CodeRabbit status, and includes relevant notes.

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 4 functions across 14 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:47
@jatmn
jatmn merged commit 20a5049 into Twigpine:main Oct 27, 2026
28 checks passed
@jatmn
jatmn deleted the fix/unused-locals-batch-6 branch October 27, 2026 17:47
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