Skip to content

chore(test): drop test-only tool-use interfaces from shared/tools - #2258

Merged
edelauna merged 2 commits into
Zoo-Code-Org:mainfrom
myk1yt:chore/d2-residual-dead-exports
Oct 31, 2026
Merged

edelauna merged 2 commits into
Zoo-Code-Org:mainfrom
myk1yt:chore/d2-residual-dead-exports

Conversation

@myk1yt

@myk1yt myk1yt commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Removes two test-only interface declarations from src/shared/tools.ts and retypes their spec consumers to the generic ToolUse<TName>. This is the residual of the diet wave's PR-D2 plan, re-baselined against current origin/main (159c42e15).

Net: 38 insertions / 52 deletions across 4 files (net −14 L).

Per-row evidence

Every row was re-proven against origin/main before any edit.

Row origin/main status Evidence Action
WriteToFileToolUse DEAD (test-only) 0 prod refs across src webview-ui/src apps packages scripts; only truncated-native-tool-args.spec.ts:24,63,79,103 Removed
AttemptCompletionToolUse DEAD (test-only) 0 prod refs; only attemptCompletionTool.spec.ts:3 + 31 sites, Task.persistence.spec.ts:23,536. The apps/cli hit is a local function looksLikeAttemptCompletionToolUse, not the type. Removed
TOOL_DISPLAY_NAMES ALREADY-REMOVED-UPSTREAM git grep -c TOOL_DISPLAY_NAMES origin/main → exit 1, zero hits. Removed by 1cbc0f4d6 (#527), which cut 122 L from tools.ts. Not touched (premise falsified)
directoryExists dedup STOPPED — copies not equivalent See below Kept, not cut

Why knip did not catch the two interfaces

Corrected mechanism (per review seat, verified against knip 5.88.1 source): the ! suffix on knip.json:49 does NOT exempt files from unused-export reporting (default mode strips it before globbing; production mode keeps it as a project pattern). knip stayed quiet for two other reasons: AttemptCompletionToolUse carried a @public JSDoc tag (knip's should-ignore handler suppresses tagged exports in all modes), and WriteToFileToolUse was referenced only from test files (graph members in default mode, @internal-suppressed in production). Net effect unchanged: knip could not have caught this row, and deadness was proven by importer grep.

Why the directoryExists row was stopped

The two copies enforce different error contracts:

Copy Location On EACCES
A (local, unexported) src/core/prompts/sections/custom-instructions.ts:35 swallows → false
B (exported) src/services/roo-config/index.ts:111 re-throws

Empirically confirmed by replicating both bodies against a simulated EACCES:

strict(roo-config)           => THREW EACCES
lenient(custom-instructions) => false

This is observable, not theoretical:

  • Copy B's throw is test-locked at src/services/roo-config/__tests__/index.spec.ts:127-132 (rejects.toThrow("Permission denied")).
  • Copy A's loadRuleFiles call site (custom-instructions.ts:485) has no try/catch, and it propagates through addCustomInstructions → Task.getSystemPrompt. So a permission-denied .roo/rules directory silently skips rules under A but would abort prompt construction under B.
  • Copy B's consumers depend on the throw: SkillsManager.ts:182-190 classifies via isNotFoundError(error) and records pass.failedPaths for anything else.

Unifying them is a behavior change requiring a product decision, not a dedup. Kept open; recommended follow-up is a separate PR that picks the strict contract and adds an explicit tolerant wrapper at the prompt-assembly call site.

Type-safety note

The rewiring is type-identical, not a widening of what the tests exercise. ToolUse<"write_to_file"> resolves nativeArgs to NativeToolArgs["write_to_file"] = { path: string; content: string } (src/shared/tools.ts:108-131), exactly what the deleted interface inherited; same for attempt_completion → { result: string }. params widens from a Pick of one or two keys to Partial<Record<ToolParamName, string>>, which accepts a superset.

Verification

Gate Result
pnpm --dir src run check-types PASS
pnpm --dir webview-ui run check-types PASS
pnpm --dir packages/types run build PASS (ESM/CJS/DTS)
pnpm knip / pnpm knip:production both exit 0 (5 pre-existing config hints, unchanged)
eslint on the 4 touched files PASS
vitest run core/tools/__tests__/ core/task/__tests__/ 64 files, 1246 passed, 5 skipped
Full vitest run (src) 550 passed / 2 failed / 3 skipped (555 files); 11894 passed / 41 failed / 37 skipped
prettier (LF-normalized content) clean
src/eslint-suppressions.json unchanged

Pre-existing failures (verified on clean base)

Both failing specs reproduce identically with all changes stashed:

Spec Failure Base run
api/providers/__tests__/mistral.spec.ts AbortError vs TimeoutError at :932 1 failed | 49 passed
__tests__/dist_assets.spec.ts 40 tests: bundled marketplace assets absent (asserts on built artifacts) fails identically

Combined base run: 2 failed (2) | 41 failed | 49 passed (90) — matches the full-suite failure counts exactly.

Out of scope

The original PR-D2 plan is much smaller than written, per docs/261031_0001_session_caching-diet-wave/research-report-diet-rebaseline.md:

Original D2 row Status Why not here
SearchAndReplaceTool.ts (2 L re-export shim) + its 15 L spec ALREADY-REMOVED-UPSTREAM (1cbc0f4d6, #527) Does not exist on origin/main. The live SearchReplaceTool.ts is a different file (presentAssistantMessage.ts:26) and was not touched.
TOOL_DISPLAY_NAMES row entries ALREADY-REMOVED-UPSTREAM (1cbc0f4d6) Whole constant is gone.
directoryExists dedup STOPPED Divergent error contracts (above).

Also untouched per hard exclusions: WorkspacePathResolver.ts, versionToken.ts (owner-flagged, knip-exempt), the ChatRow placeholder, ui-wrappers, the i18n sweep, and packages/types/src/__tests__/provider-settings.test.ts.

#1735 independence

No overlap. This PR touches only src/shared/tools.ts and three src/**/__tests__/*.spec.ts files; provider-settings.test.ts is untouched. The branch fix/delete-profile-purge-config is not present on the remote, and no merge commit referencing #1735 exists on origin/main. No rebase conflict is possible from this side.

Hygiene

No changeset, no CHANGELOG entry (per AGENTS.md). No zero-byte files, no conflict markers. Index and worktree line endings are LF for all four files (git ls-files --eol).

What: remove the AttemptCompletionToolUse and WriteToFileToolUse interface
declarations from src/shared/tools.ts and retype their three spec consumers to
the generic ToolUse<"attempt_completion"> / ToolUse<"write_to_file">.

Why: both interfaces had zero production references at origin/main; the only
importers were three specs. ToolUse<TName> already resolves nativeArgs through
NativeToolArgs, so the named aliases added no type information over the generic
form. knip could not report them because knip.json exempts src/shared/*.ts with
a "!" suffix, so the deadness was proven by importer grep instead.

Impact: no behavior change. Type-level only: params widens from a Pick of one
or two keys to Partial<Record<ToolParamName, string>>, which accepts a superset,
and nativeArgs keeps its exact shape. src and webview-ui typecheck, knip dev and
production stay clean, and the affected suites (1246 tests across core/tools and
core/task) pass.

The TOOL_DISPLAY_NAMES row from the same plan was already removed upstream by
1cbc0f4 (Zoo-Code-Org#527), and the directoryExists dedup was stopped because the two
copies enforce different error contracts (the roo-config copy re-throws on
EACCES and is test-locked; the custom-instructions copy swallows all errors).
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one): 1
  • coderabbit-review-active

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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 159c42e and cc2cb36.

Files selected for processing: 4
  • src/core/task/__tests__/Task.persistence.spec.ts
  • src/core/task/__tests__/truncated-native-tool-args.spec.ts
  • src/core/tools/__tests__/attemptCompletionTool.spec.ts
  • src/shared/tools.ts

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

Recent review details
CI failures not shown inline: 2

GitHub Actions: Visual Regression / 0_theme-fixtures.txt: chore(test): drop test-only tool-use interfaces from shared/tools

Conclusion: failure

View job details

ld/assets/prisma-BsRQq5mF.js                            6.36 kB │ map:      9.28 kB
 ../src/webview-ui/build/assets/ara-4CJ0cIlV.js                               6.39 kB │ map:      9.26 kB
 ../src/webview-ui/build/assets/clojure-DqKBuwfJ.js                           6.45 kB │ map:      9.29 kB
 ../src/webview-ui/build/assets/postcss-BXeXVLqQ.js                           6.45 kB │ map:      9.12 kB
 ../src/webview-ui/build/assets/toml-CcmNWLt0.js                              6.46 kB │ map:      9.48 kB
 ../src/webview-ui/build/assets/solarized-light-DSh2HLQt.js                   6.53 kB │ map:      9.25 kB
 ../src/webview-ui/build/assets/proto-DB4EqR-F.js                             6.58 kB │ map:      9.91 kB
 ../src/webview-ui/build/assets/smalltalk-B16xEiuN.js                         6.62 kB │ map:      9.26 kB
 ../src/webview-ui/build/assets/r-DJVojnqI.js                                 6.64 kB │ map:     10.16 kB
 ../src/webview-ui/build/assets/talonscript-CohzipZa.js                       6.79 kB │ map:     10.08 kB
 ../src/webview-ui/build/assets/solarized-dark-DV17i1UV.js                    6.89 kB │ map:      9.71 kB
 ../src/webview-ui/build/assets/riscv-Ckw8ddFX.js                             6.95 kB │ map:      9.60 kB
 ../src/webview-ui/build/assets/soy-BwFmmWPz.js                               6.96 kB │ map:     10.74 kB
 ../src/webview-ui/build/assets/min-light-DDpmG2fV.js                         7.01 kB │ map:      9.56 kB
 ../src/webview-ui/build/assets/scheme-DQCgrYNe.js                            7.20 kB │ map:      9.80 kB
 ../src/webview-ui/build/assets/hlsl-Cvrh5tZx.js                              7.29 kB │ map:      9.25 kB
 ../src/webview-ui/build/assets/qss-Fe1Jh2GI.js                               7.50 kB │ map:      9.41 kB
 ../src/webview-ui/build/assets/dart-DkHntEIa.js                              7.84 kB │ map:     11.53 kB
 ../src/webview-ui/build/assets/systemd-BxMlprV5.js                           7.90 kB │ map:     10.65 kB
 ../s...

GitHub Actions: Visual Regression / theme-fixtures: chore(test): drop test-only tool-use interfaces from shared/tools

Conclusion: failure

View job details

ld/assets/prisma-BsRQq5mF.js                            6.36 kB │ map:      9.28 kB
 ../src/webview-ui/build/assets/ara-4CJ0cIlV.js                               6.39 kB │ map:      9.26 kB
 ../src/webview-ui/build/assets/clojure-DqKBuwfJ.js                           6.45 kB │ map:      9.29 kB
 ../src/webview-ui/build/assets/postcss-BXeXVLqQ.js                           6.45 kB │ map:      9.12 kB
 ../src/webview-ui/build/assets/toml-CcmNWLt0.js                              6.46 kB │ map:      9.48 kB
 ../src/webview-ui/build/assets/solarized-light-DSh2HLQt.js                   6.53 kB │ map:      9.25 kB
 ../src/webview-ui/build/assets/proto-DB4EqR-F.js                             6.58 kB │ map:      9.91 kB
 ../src/webview-ui/build/assets/smalltalk-B16xEiuN.js                         6.62 kB │ map:      9.26 kB
 ../src/webview-ui/build/assets/r-DJVojnqI.js                                 6.64 kB │ map:     10.16 kB
 ../src/webview-ui/build/assets/talonscript-CohzipZa.js                       6.79 kB │ map:     10.08 kB
 ../src/webview-ui/build/assets/solarized-dark-DV17i1UV.js                    6.89 kB │ map:      9.71 kB
 ../src/webview-ui/build/assets/riscv-Ckw8ddFX.js                             6.95 kB │ map:      9.60 kB
 ../src/webview-ui/build/assets/soy-BwFmmWPz.js                               6.96 kB │ map:     10.74 kB
 ../src/webview-ui/build/assets/min-light-DDpmG2fV.js                         7.01 kB │ map:      9.56 kB
 ../src/webview-ui/build/assets/scheme-DQCgrYNe.js                            7.20 kB │ map:      9.80 kB
 ../src/webview-ui/build/assets/hlsl-Cvrh5tZx.js                              7.29 kB │ map:      9.25 kB
 ../src/webview-ui/build/assets/qss-Fe1Jh2GI.js                               7.50 kB │ map:      9.41 kB
 ../src/webview-ui/build/assets/dart-DkHntEIa.js                              7.84 kB │ map:     11.53 kB
 ../src/webview-ui/build/assets/systemd-BxMlprV5.js                           7.90 kB │ map:     10.65 kB
 ../s...
Additional context used
Path-based instructions: 6
Check persistence and lifecycle invariants: awaited atomic writes, rollback or explicit partial-failure behavior, cross-window state consistency, stale listeners/watchers, cancellation, idempotency, and safe restart/resume without lost or d...

CodeRabbit configuration file

Files:

  • src/core/task/__tests__/Task.persistence.spec.ts
  • src/core/task/__tests__/truncated-native-tool-args.spec.ts
Treat model, provider, MCP, path, command, and tool data as untrusted.

CodeRabbit configuration file

Files:

  • src/core/tools/__tests__/attemptCompletionTool.spec.ts
Require regression coverage at the lowest valid harness with behavior-focused assertions, including relevant negative, error, false/unset, and boundary cases.

CodeRabbit configuration file

Files:

  • src/core/task/__tests__/Task.persistence.spec.ts
  • src/core/task/__tests__/truncated-native-tool-args.spec.ts
  • src/core/tools/__tests__/attemptCompletionTool.spec.ts
Check strict typing and exhaustive behavior across normal, boundary, error, cancellation, retry, and compatibility paths.

CodeRabbit configuration file

Files:

  • src/core/task/__tests__/Task.persistence.spec.ts
  • src/core/task/__tests__/truncated-native-tool-args.spec.ts
  • src/shared/tools.ts
  • src/core/tools/__tests__/attemptCompletionTool.spec.ts
Verify extension/webview contracts, cancellation and error propagation, VS Code lifecycle correctness, and behavior under retries and partial failure.

CodeRabbit configuration file

Files:

  • src/core/task/__tests__/Task.persistence.spec.ts
  • src/core/task/__tests__/truncated-native-tool-args.spec.ts
  • src/shared/tools.ts
  • src/core/tools/__tests__/attemptCompletionTool.spec.ts
Act as an adversarial second-opinion reviewer.

CodeRabbit configuration file

Files:

  • src/core/task/__tests__/Task.persistence.spec.ts
  • src/core/task/__tests__/truncated-native-tool-args.spec.ts
  • src/shared/tools.ts
  • src/core/tools/__tests__/attemptCompletionTool.spec.ts
📝 Summary

Summary by CodeRabbit

  • Refactor
    • Standardized internal handling of tool-related data. There are no changes to tool behavior or other user-facing functionality.
  • Tests
    • Updated test coverage to match the internal changes; existing test behavior and expectations remain unchanged.

The change removes two tool-specific interfaces from src/shared/tools.ts. Tests now use the shared ToolUse type with the matching tool name. Test scenarios and assertions are unchanged.

Changes: Shared tool type usage

Layer / File(s) Summary
Replace specialized tool types in tests
src/shared/tools.ts, src/core/task/__tests__/Task.persistence.spec.ts, src/core/task/__tests__/truncated-native-tool-args.spec.ts, src/core/tools/__tests__/attemptCompletionTool.spec.ts
The two specialized interfaces were removed. Completion and file-write test fixtures now use ToolUse with the corresponding tool name. Test scenarios and assertions are unchanged.

Priority: Low

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

Change: Other

Merge Risk: Minimal · previous review cc2cb

This type-only cleanup has no identified behavioral regression or merge-blocking issue. It is mergeable subject to normal checks.

Pre-merge checks: Passed 7 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Description check Warning The description is detailed and explains the implementation, scope, testing, and known failures. It does not follow the required template. It does not include a Closes: #<issue> entry for an approve… Add the required template sections. Link an approved GitHub Issue with Closes: #<number>, complete the pre-submission checklist, state whether documentation updates are required, and add the contributor Discord username. Retain the existi…
Passed Passed checks: 7 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: removing test-only tool-use interfaces from shared/tools.
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.
Regression Evidence Passed PASS. The PR changes only TypeScript types and test imports. It removes two interfaces and replaces their fixtures with ToolUse<"attempt_completion"> and ToolUse<"write_to_file">. ToolUse still …
Security Boundaries Passed No changed path meets a security failure condition. The PR only removes two TypeScript interfaces from src/shared/tools.ts and changes test annotations to ToolUse<"attempt_completion"> or `ToolUse…
Persistence Integrity Passed PASS — The pull request changes only test type annotations/imports and removes two interfaces from src/shared/tools.ts. It does not change a persistence operation, write path, await behavior, atomic…
Lifecycle Resource Cleanup Passed PASS. The pull request changes only TypeScript type annotations in three test files and removes two exported interfaces from src/shared/tools.ts. The diff does not add or alter listeners, watchers, …
Full details: Regression Evidence

Explanation

PASS. The PR changes only TypeScript types and test imports. It removes two interfaces and replaces their fixtures with ToolUse&lt;"attempt_completion"&gt; and ToolUse&lt;"write_to_file"&gt;. ToolUse still provides the same nativeArgs mappings for both tools, and the test assertions and runtime code are unchanged. The affected specs retain focused coverage for completion, persistence, and truncated native arguments. No UI behavior changed, so no Playwright snapshot is required.

Full details: Security Boundaries

Explanation

No changed path meets a security failure condition. The PR only removes two TypeScript interfaces from src/shared/tools.ts and changes test annotations to ToolUse&lt;"attempt_completion"&gt; or ToolUse&lt;"write_to_file"&gt;. The diff contains no runtime logic, input execution, secret handling, PII flow, approval checks, or allowlist changes.

Full details: Persistence Integrity

Explanation

PASS — The pull request changes only test type annotations/imports and removes two interfaces from src/shared/tools.ts. It does not change a persistence operation, write path, await behavior, atomicity, rollback, partial-failure handling, or default propagation. No concrete changed persistence path can trigger the stated failure condition.

Full details: Lifecycle Resource Cleanup

Explanation

PASS. The pull request changes only TypeScript type annotations in three test files and removes two exported interfaces from src/shared/tools.ts. The diff does not add or alter listeners, watchers, providers, timers, tasks, disposal logic, cancellation logic, or restart logic. No changed lifecycle path can leak a resource or duplicate work.

Full details: Description check

Explanation

The description is detailed and explains the implementation, scope, testing, and known failures. It does not follow the required template. It does not include a Closes: #&lt;issue&gt; entry for an approved issue or the required completed pre-submission checklist. It also omits the required documentation impact and contributor contact sections.

Resolution

Add the required template sections. Link an approved GitHub Issue with Closes: #&lt;number&gt;, complete the pre-submission checklist, state whether documentation updates are required, and add the contributor Discord username. Retain the existing implementation and verification details under the matching template headings.

Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • 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

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

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Review status

Thanks for contributing. This comment tracks the review sequence and the next action.

Current step: The required review sequence passed. Remaining merge requirements apply.

Review-state labels are managed by this workflow; do not edit them manually. community-approved is managed the same way — do not add or remove it manually. It signals a fresh community code approval for the current head as an advisory priority only; maintainer review is still required.

@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions github-actions Bot added coderabbit-review-active Required CI passed; CodeRabbit review is active awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit labels Oct 30, 2026
@github-actions github-actions Bot added awaiting-maintainer CodeRabbit approved; waiting for a human maintainer and removed coderabbit-review-active Required CI passed; CodeRabbit review is active awaiting-coderabbit Waiting for CodeRabbit to approve the latest commit labels Oct 30, 2026
What: empty retrigger commit, no content change.
Why: theme-fixtures died in @vscode/test-electron 'Resolving version...' download (recorded infra signature; no fixture diff emitted). Same base is green on Zoo-Code-Org#2254/Zoo-Code-Org#2256/Zoo-Code-Org#2257 minutes apart; diff is type-declaration-only with no causal path. No admin rerun rights on the org repo; push-retrigger is the documented recovery.
Impact: all CI legs re-run on identical trees (cc2cb36 content == this commit's tree).
@github-actions github-actions Bot added awaiting-maintainer CodeRabbit approved; waiting for a human maintainer and removed awaiting-maintainer CodeRabbit approved; waiting for a human maintainer labels Oct 30, 2026
@github-actions github-actions Bot added the community-approved Fresh community approval on the current head; maintainer review still required label Oct 30, 2026

@edelauna edelauna 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.

Thanks!

@edelauna
edelauna added this pull request to the merge queue Oct 31, 2026
@github-actions github-actions Bot removed awaiting-maintainer CodeRabbit approved; waiting for a human maintainer community-approved Fresh community approval on the current head; maintainer review still required labels Oct 31, 2026
Merged via the queue into Zoo-Code-Org:main with commit a90133d Oct 31, 2026
23 checks passed
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.

3 participants