Skip to content

test: remove obsolete editor cache cleanup and its tests - #29485

Merged
OrcaWin merged 2 commits into
mainfrom
OrcaWin/test-audit-editor-dead-cache-cleanup
Oct 16, 2026
Merged

OrcaWin merged 2 commits into
mainfrom
OrcaWin/test-audit-editor-dead-cache-cleanup

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

Stop testing an old editor-close behavior that the app no longer uses. Closing an editor frees its model while keeping bounded view-state caches so reopening can restore the user's position.

What Changed

Remove the unused close wrapper, its cache-deletion functions, the dedicated sweep module and 11 obsolete cache-deletion tests. Keep the model-disposal function the app actually calls and retarget its four existing tests without changing their assertions. The combined-diff reopen test now closes and reopens through the real controller with a cold model registry instead of calling the dead wrapper. Remove its unchecked fixture casts and correct a stale PDF recorder comment.

Why

The app-shell hook calls the model-only controller; none of the removed functions has a production caller. The earlier retention change #21178 deliberately preserved bounded caches, leaving this path behind. Testing it maintained an obsolete alternative behavior. Removing the dead path is clearer than optimizing its sweep or replaying it through mocks. Model lifecycle, attached/reopened ownership, reentrant disposal, bounded cache retention, undo and shell mounting coverage remain.

Linked Issue

Internal test audit; follows the bounded-state retention behavior in #21178.

Visual Proof

N/A — removes unused code and changes tests; application UI and editor-close behavior are unchanged.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Original: seven suites, 53 passed. Candidate: six suites, 42 passed, including a shuffled run (seed104729). Lifecycle18, shell3, view-state-retention9, diff-disposal5 and combined restoration3 remain; four batch model tests remain. Model-only production function and four unchanged keeper suites are byte-identical. Web typecheck, changed-code-quality checks, normal/anti-slop lint, formatting and whitespace checks passed, but another task switched the shared checkout before these final checks. They must be repeated on this exact branch before merge. The six alternating measurement runs finished before that switch and are anchored to the intended base.

A deliberate controller regression erasing combined view state passes the old dead-wrapper test and fails the new cold-controller test on loaded-section equality. A dropped model-disposal batch fails both original and retargeted keeper at the same exact closed-path assertion. All temporary owner mutations restored. These controls also ran after the checkout switch and must be repeated on the exact branch before merge. The cold combined test proves that controller close path plus restoration; it does not claim a model-backed editor widget, the store closeFile command or a network refetch count. Existing real Monaco lifecycle/retention tests and React shell tests remain. Executed on Linux in the background; no native desktop/Windows/macOS run claimed.

Three alternating original-first local pairs, Bun1.4.3 runner with pinned Node24.21 for node-runtime projects, single worker, official module reporter:

Seven original / six retained suites Original median Candidate median
Sum of module times 9,354 ms 9,079 ms
Process wall time 11,502 ms 11,141 ms

This is a small local difference, not a whole-PR speed claim. Source-qualified hosted original run38850544014 has 53 passes across five clean reports and 18,506 ms summed official module time. Its Node24.19/Bun1.4.3, Blacksmith X64 four-worker workload differs from local and later main. Candidate CI measurement remains pending; compare the same metric after all five shards are clean and disclose workload/runner drift.

Review

Independent declaration ledger and history/caller pre-review approved the removal and keeper plan. Concrete final preservation review of the recovered commit and exact-branch local reruns remain pending before merge.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

No execution-host, SSH, wire, git-provider or folder-workspace behavior changes. No new production test seam or line-limit exemption. Removes 119 net production lines and 138 net test lines.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Refresh validation: Refreshed onto main 723c258 after #29499 repaired inherited CI failures. All six patch paths retain the approved bytes. Refreshed local six-suite set passes all 42 cases. Independent refresh preservation review approved unchanged controls and keepers. Fresh exact-head run 38866725238 has passed.

Hosted validation: Exact-head full PR run 38866725238 passed, including aggregate PR checks passed and all five clean unit shards. Six retained suites passed all 42 cases, no skips; summed official module cost 17,635 ms versus historical original 18,506 ms across 53 cases. Workloads and broad inputs differ; this does not establish a causal speedup or whole-PR saving.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7be44597-9953-4594-95c2-f1bd59fcd4f6
📥 Commits

Reviewing files that changed from the base of the PR and between 8570b0a and dbcce46.

📒 Files selected for processing: 6
  • src/renderer/src/components/editor/closed-editor-tab-cache-sweep.test.ts
  • src/renderer/src/components/editor/closed-editor-tab-cache-sweep.ts
  • src/renderer/src/components/editor/closed-editor-tab-disposal.test.ts
  • src/renderer/src/components/editor/closed-editor-tab-disposal.ts
  • src/renderer/src/components/editor/combined-diff/remember-view/use-combined-diff-view-restore.test.tsx
  • src/renderer/src/components/editor/pdf-view-position.ts
💤 Files with no reviewable changes: 3
  • src/renderer/src/components/editor/closed-editor-tab-cache-sweep.test.ts
  • src/renderer/src/components/editor/closed-editor-tab-cache-sweep.ts
  • src/renderer/src/components/editor/closed-editor-tab-disposal.ts

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

📝 Walkthrough

The change removes cache-sweep helpers and closed-tab disposal wrappers. Model disposal remains, and its tests now call disposeClosedEditorModels. The combined-diff restoration test now attaches closed-tab cleanup to a store and checks that cached sections return after the tab is reopened. The PDF view-position disposal comment now describes preventing late recordings from overwriting newer state.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to dbcce

No actionable merge-blocking issue is identified. Repeat the reported checks on the exact branch before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
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.
Title check Passed The title clearly identifies the main change: removing obsolete editor cache cleanup code and its tests.
Description check Passed The description is detailed and covers the required sections, including the change, rationale, testing, scope, compatibility considerations, and checklist. It also identifies the related issue and rep…
Full details: Description check

Explanation

The description is detailed and covers the required sections, including the change, rationale, testing, scope, compatibility considerations, and checklist. It also identifies the related issue and reports exact-head hosted validation.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 2
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • 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

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

@OrcaWin
OrcaWin merged commit 4416a8e into main Oct 16, 2026
31 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.

1 participant