Repository navigation
test(editor): isolate prefix bleed in the batched model sweep, drop a dead export - #18240
Conversation
… dead export Readiness-review follow-ups to #18144. The parity test in closed-editor-tab-disposal.test.ts cannot see prefix bleed: buildScenario closes tab-0..tab-99, so tab-10 is in the closed batch too and the per-tab oracle disposes its models via tab-10's own prefix. Batched and oracle agree and the assertion passes even with a bleeding predicate. Verified by mutation: replacing the boundary probe with a naive startsWith leaves all five of that file's tests green. Adds a test through the batched disposeClosedEditorTabs entry point with a still-OPEN tab-10 alongside a closed tab-1, which does fail under that mutation. Also records the `boundary + 1` advance in hasPaneScopeOwner as load-bearing for `:::` runs, with a test that fails under a `+ 2` "tidy-up", and removes disposeUnattachedMonacoModelsByPathPrefix, which #18144 left with zero production callers and a comment claiming it was kept for callers that do not exist. Finally, documents why title-derived rows carry `startedAt: 0`, which is the sole reason their `now` stamps cannot move a dashboard bucket.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (6)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughAdded boundary-focused tests for Merge Risk: ⚪ Minimal · up to This change strengthens editor cleanup regression coverage and removes an unused export without changing runtime behavior, dependencies, or deployment architecture. No actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description is detailed and explains the changes, rationale, tests, and verification. However, it does not provide the required linked issue in the
✨ Finishing Touches📝 Generate docstrings
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. Comment |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Test-only hardening follow-up to #18144; the sole production change is removing a dead export.
closed-editor-tab-cache-sweep.test.ts— adds direct unit coverage fordeletePaneScopedCacheEntries(owner-extension,:::-run boundary, multi-owner batch, empty batch).closed-editor-tab-cache-sweep.ts— documents why theboundary + 1advance (not+ 2) is load-bearing.closed-editor-tab-disposal.test.ts— adds a prefix-bleed isolation test at the batcheddisposeClosedEditorTabsentry point: closestab-1whiletab-10stays open.diff-monaco-model-disposal.ts/.test.ts— removes the deaddisposeUnattachedMonacoModelsByPathPrefixexport and points the two test call sites at the plural form.worktree-title-derived-agent-rows.ts— documents whystartedAt: 0is load-bearing, not a placeholder.
Both new tests use exact toEqual assertions and are claimed (and verify-ably) fail-first against their target mutations — naive startsWith prefix bleed and the + 2 advance. The startedAt === 0 → isTitleDerived → unseen short-circuit is confirmed by dashboard-row-bucket.ts; the removed export has zero remaining references.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
… dead export (stablyai#18240) Readiness-review follow-ups to stablyai#18144. The parity test in closed-editor-tab-disposal.test.ts cannot see prefix bleed: buildScenario closes tab-0..tab-99, so tab-10 is in the closed batch too and the per-tab oracle disposes its models via tab-10's own prefix. Batched and oracle agree and the assertion passes even with a bleeding predicate. Verified by mutation: replacing the boundary probe with a naive startsWith leaves all five of that file's tests green. Adds a test through the batched disposeClosedEditorTabs entry point with a still-OPEN tab-10 alongside a closed tab-1, which does fail under that mutation. Also records the `boundary + 1` advance in hasPaneScopeOwner as load-bearing for `:::` runs, with a test that fails under a `+ 2` "tidy-up", and removes disposeUnattachedMonacoModelsByPathPrefix, which stablyai#18144 left with zero production callers and a comment claiming it was kept for callers that do not exist. Finally, documents why title-derived rows carry `startedAt: 0`, which is the sole reason their `now` stamps cannot move a dashboard bucket.

ELI5
A test that looked like it was guarding against a whole class of bug turned out to be structurally unable to see it. This adds a test that can, records two invariants that a future "cleanup" would silently break, and deletes an export #18144 left behind with a false justification attached.
Follow-up to #18144, found during readiness review. No production behaviour change except the removal of an unused export.
1. The parity test cannot see prefix bleed
closed-editor-tab-disposal.test.tsproves the batched sweep disposes exactly what the pre-batch per-tab sweep disposed, by running both over the same fixture. That is a good test, but it is blind to prefix bleed — the bug where closingtab-1also disposestab-10's models.buildScenarioclosestab-0…tab-99, sotab-10is in the closed batch too. A bleeding predicate would disposetab-10's models, but the per-tab oracle disposes them as well viatab-10's own prefix. The two agree, anddisposedPaths(batched) === disposedPaths(perTab)still passes.Verified rather than assumed. Replacing the boundary probe in
isOwnedByPathPrefixwith a naivestartsWithover the prefix set:All five pre-existing tests in that file stayed green under a predicate that disposes the wrong tab's models.
The new test closes
tab-1while leavingtab-10open, and goes through the batcheddisposeClosedEditorTabsentry point on purpose — that is where the owned prefixes become aSetprobed at the URI's own:boundaries againstshortestPrefixLength/longestPrefixLength, which is a different predicate from the pre-batch per-prefixstartsWith.Scope correction
diff-monaco-model-disposal.test.tsdoes already cover prefix bleed, for the encoded-colon sibling shape (foovsfoo:bar) — both of its prefix tests fail under the same mutation. So this was never entirely uncovered. What was missing is coverage at the batched entry point, with a multi-prefixSet, in the realistictab-1vstab-10shape.2.
boundary + 1is load-bearinghasPaneScopeOwneradvances by one character, not two. In a:::run the second::starts one character after the first, and it can be the only boundary an owner ends at — ownera:against keya:::b. Advancing by+ 2steps over it and silently leaks the entry.That reads like an off-by-one waiting to be tidied up, so it now has both a comment and a test that fails under the
+ 2version:This also gives
deletePaneScopedCacheEntriesdirect unit coverage (owner-extension, batch sweep, empty batch), which it did not have — it was only exercised throughsweepClosedPdfViewPositionsand the disposal hook.3. Dead export with a false justification
#18144's description says
disposeUnattachedMonacoModelsByPathPrefixwas "kept as a one-element wrapper for its other callers". It has no other callers — after that PR the only two call sites are in its own test file. Removed, and both call sites now use the plural form directly.4. Why
startedAt: 0is load-bearingNot part of the #18144 change, but the same review turned up a landmine worth writing down where someone will actually see it.
buildTitleDerivedAgentRowstampsupdatedAt,stateStartedAt, andobservation.revision/observedAtfromargs.now. Those look freshness-dependent, and a reader could reasonably conclude a title-derived row's bucket decays with the clock. It does not — solely because the row carriesstartedAt: 0, which makesdashboardRowBucketProjectionsetisTitleDerivedand short-circuitunseen.Every dashboard bucket cache keys its invalidation on the freshness boundary in
isExplicitAgentStatusFreshalone. Give title-derived rows a real timestamp and all of them start serving stale counts, with no test failing at the point of the change. That is now a comment on the line.Verification
editor/,sidebar/,dashboard/pnpm tcclean,oxlintclean,oxfmt --checkclean