Repository navigation
test: remove mock echoes and duplicate contracts that only reading finds - #23953
Conversation
Two veins in one wave, both requiring the production path to be read rather than
pattern-matched.
Mock echoes (36 strongest candidates reviewed, 2 real): the flagged shape —
literals shared between a mock factory and an expect matcher — is almost always
a test feeding an input and asserting a transform. The two genuine echoes are in
`pty-management.test.ts`, where the handler returns
`getDaemonFolderAccessMismatch(identity)` verbatim, so asserting the mock's own
`evidence('allowed')` object and its `null` proved only the mock. One case's own
comment conceded the handler makes no decision. The branch-exercising cases in
that file stay.
Semantic sweep of 80 files no detector flagged, 27 junk cases removed. What it
found has no mechanical signature:
- a handler that is literally `() => getComputerUsePermissionStatus()`, so
`resolves.toBe(result)` guarded nothing;
- "does not mutate a stale registration off Linux" whose refusal came from a
DIFFERENT guard — `cli.ts` has no platform check, and the test's own mock made
`resolveAppImageRuntimeIdentity` return null, which a sibling case already owns;
- "keeps probing a host that is still retained" asserting a no-op, because
`retainScopes` only cancels queued probes and stores no state;
- two cases comparing against `referenceAllowedRoots`, a verbatim copy of the
pre-change algorithm kept in the test file — expected values produced by the
thing under test. The third such case stays: it calls the old algorithm to
COUNT its work (100_000 containment checks vs 100), a real bound on the
authorization hot path;
- a remote-folder refusal that came from the fake provider's own rejection
message rather than any Orca guard;
- "advertises each capability once", where a duplicate entry is inert in
production because membership is `includes`;
- an Antigravity `scaffold self-check` built on a hand-typed five-line screen —
the exact fixture shape docs/reference/antigravity-readiness-evidence.md blames
for five failed detector attempts — whose banner had already drifted to
`Antigravity CLI 1.0.3` against a real captured `1.2.0`. The raw-capture
provenance guard and the transcript checklist ratchet in that file stay.
No production file is touched and no test file is deleted.
Continues the semantic sweep into src/main/ipc filesystem handlers and src/main/daemon. 16 cases removed across 13 files; no production file touched. The recurring shape is a case that reaches the same branch as its sibling by a different-looking route: - `parseArgs` is a flag-scanning loop, so "handles flags in any order" asserts the identical result object as the in-order case, and "throws with no args" lands on the same `Usage:` throw the two missing-flag cases already reach; - an ENOENT case with "no code at all" and its sibling with a numeric transport code both fall through to the same `ENOENT_MESSAGE.test` branch; - "establishes connection with hello handshake" and "receives stream events" are strict subsets of cases that require two matching authenticated sockets and a frame split inside a multibyte character. Two were vacuous rather than duplicated: a fixture self-comparison asserting `String.normalize` gives different NFC and NFD spellings, and a `not.toThrow` batch case whose 200k events are truncated by `MAX_BATCHED_WATCHER_EVENTS = 5_000` long before the argument spread it was written to exercise. One whole-file deletion was reversed: `freebuff-detection.test.ts` looked like a table restatement, but the sibling detection test covers only dependency ordering and platform gating, not freebuff/codebuff independence — and those two names share a suffix, so it is the only guard against one shadowing the other.
32e3a69 to
94792ea
Compare
|
| @@ -285,28 +285,6 @@ describe('getAllowedRoots', () => { | |||
| expect(isPathInsideOrEqual).toHaveBeenCalledTimes(100_000) | |||
There was a problem hiding this comment.
Mixed authorization cases lose coverage Removing the mixed-fixture comparisons leaves only an all-local comparison against the reference implementation. Other tests check individual remote and mixed scopes, but none checks a local repo bound to a remote group or whether changing repository order preserves the roots. A regression in either case could pass unnoticed. Please keep a targeted assertion for those cases.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| @@ -101,17 +101,6 @@ describe('registerFilesystemHandlers', () => { | |||
| expect(readdirMock).not.toHaveBeenCalled() | |||
| }) | |||
|
|
|||
There was a problem hiding this comment.
WSL option forwarding loses coverage The remaining document-listing IPC test forwards only empty local options. If this handler stops passing
wslDistro to document discovery, that test will still pass even though discovery for a WSL workspace may run in the wrong environment. Please retain an assertion with a nonempty WSL option.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
ℹ️ No critical issues. The removals hold up under adversarial checking — one minor coverage note inline.
Reviewed changes
Deletion-only test-audit wave: −420 lines across 18 test files, no production or test file touched. I read all 18 files, checked every removed case against its surviving coverage and the production code it points at, ran the 18 files (231 passed, 10 skipped), and ran oxlint over the changed set (clean).
- Pass-through / mock echoes —
computer-use-permissions,pty-management,desktop-renderer-runtime-capabilities: removed cases asserted a value the test's own mock produced, or an invariant (includes-based membership) no production path can fail. - Duplicate cases with a surviving owner —
crash-reporting,feedback,emulator-stream-listener-cleanup,ai-vault-search-all-hosts-real-index,cli-appimage-stale-registration,filesystem-commit-message-generation,filesystem-download-transfers,filesystem-git-commit-dispatch,dashboard-payload-validation,automations-external-scope,agent-prompt-submission-windows-submit-delay: each removal is re-asserted by a sibling. The aborted-verification case survives verbatim inagent-prompt-submission-runtime-hook-and-generation.test.ts:504, the malformed-cursor case inai-vault-search-all-hosts.test.ts:295, and the off-Linux AppImage refusal incli-appimage-stale-registration.test.ts:339. - Self-referential oracle —
filesystem-allowed-roots: the helper is still load-bearing for the surviving hot-path bound test (:284), so it is not orphaned, andfilesystem-canonical-owner.test.tspins the remote/folder-scope roots with explicit expectations. The three-way split is correct. - Antigravity scaffold — the removed hand-typed-screen self-check leaves every import still referenced by the transcript-driven cases; the raw-capture and doc-checklist ratchets stay.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| @@ -242,17 +242,6 @@ describe('submitFeedback', () => { | |||
| expect(postedBody(1)).not.toHaveProperty('diagnosticBundle') | |||
| }) | |||
|
|
|||
| it('retries a proxy-rejected diagnostic attachment as website JSON', async () => { | |||
There was a problem hiding this comment.
Removing this case leaves 413 as the only member of ATTACHMENT_JSON_RETRY_STATUSES with a retrying test — the other retry cases pin 502/network/timeout, and it.each([401, 409, 429]) only pins no-retry. feedback.ts:37 lists 400, 403, 408, 413, 415, 422, and the comment at feedback.ts:34 calls out 403 specifically as the corporate-filter case, so a future edit that drops 403 from the set would now pass CI. Consider parameterizing the retry test over the full set rather than deleting the 403 case.
There was a problem hiding this comment.
ℹ️ Minor coverage notes on the second commit — the rest verified clean.
Reviewed changes
This is the delta added since the prior pullfrog review: commit 94792ea ("retire duplicate daemon and filesystem cases the sweep found") adds 19 files to the PR (now 37 files, net −830). Ran the 19 files (272 passed, 1 skipped) and oxlint (clean).
- Daemon cluster —
client,daemon-adoption-telemetry-event,daemon-checkpoint-session-queue,daemon-endpoint-publish,daemon-entry: each removed case has a surviving owner (stalled-session serialization →serializes operations for one session; dead-incumbent replacement →leaves the published endpoint behind when its own owner closes; throwing-client swallow → the app-env throw case; hello/stream events → the UTF-8 stream case; no-args/logFilePath-absent → other exact-shapeparseArgscases). - Watcher cluster —
filesystem-watcher-large-batch,filesystem-watcher-local-events,filesystem-watcher,filesystem.test: the 200k-event case never reaches the append loop (the overflow guard short-circuits before any spread), so the surviving 5001-event case is the real guard; the WSL child-capacity pair is covered by the native-capacity twins plusfilesystem-watcher-wsl.test.ts:107; the sustained-flush case is re-asserted in the large-batch file. - Folder-repo upgrade —
folder-repo-git-upgrade,folder-repo-git-upgrade-lifetime: all four removals have surviving equivalents (retries after the last extra folder workspace is removedcovers both the extra-workspace refusal and the root-only upgrade;re-probes once the rejected marker itself changescovers the garbage.git;folder-repo-git-upgrade-lifetime.test.ts:169covers the SSH/WSL/nonlocal exclusion). - Filesystem misc —
import,runtime-upload-staging,pull-request-linked-issue-lifetime,github-issue-source-preference,path-containment-remote-enoent: covered by survivors. One gap and one debatable canary inline.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| expect(readdirMock).not.toHaveBeenCalled() | ||
| }) | ||
|
|
||
| it('passes the workspace runtime distro into document discovery', async () => { |
There was a problem hiding this comment.
Removing this case leaves nothing pinning that a non-empty getLocalGitOptionsForRegisteredWorktree result (here { wslDistro: 'Ubuntu' }) reaches listMarkdownDocuments. The surviving local case mocks the helper to {} and asserts listMarkdownDocumentsMock was called with {} (filesystem-markdown-document-listing.test.ts:100), and toEqual still accepts { wslDistro: undefined }, so a regression that drops the distro would pass. WSL markdown discovery would then silently read the wrong host. Consider keeping a non-empty option case.
| }) | ||
|
|
||
| describe('path containment across Unicode forms', () => { | ||
| it('spells the fixture two ways, or the rest of this file proves nothing', () => { |
There was a problem hiding this comment.
These constants are FOLDER.normalize('NFC'/'NFD') (:26-27), so this assertion is a fixture canary: it can only fail if FOLDER is later changed to a spelling that does not decompose. If that happens the rest of the file goes vacuous (makeOneDirectoryTwoSpellings swallows EEXIST, the distinct-sibling case early-returns) with no failing test to say so. Not blocking — just flagging that the canary is what keeps the file meaningful.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (37)
💤 Files with no reviewable changes (36)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe pull request removes tests from daemon, IPC, filesystem, and runtime suites. It replaces one daemon stream-event test with a test that checks an intact payload when a multibyte UTF-8 character is split across writes. No runtime implementation changes are described. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The changes simplify test coverage without identified production behavior changes. No merge-blocking issue is established; merge after normal CI checks pass. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 1 system. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |

ELI5
Earlier PRs in this audit used pattern-matching to find junk tests. This one is the first where a machine couldn't help: every find required reading the production code the test points at, then asking whether the test could actually fail if that code broke.
Several couldn't. One asserted a value the test's own mock had just produced. One checked "does not mutate off Linux" against a file that has no platform check at all. One asserted a no-op. One compared the code against a copy of its own older version, kept in the test file.
What Changed
−420 lines across 18 files. No production file touched, no test file deleted.
Mock echoes (36 strongest candidates reviewed, 2 real). The flagged shape — string literals shared between a mock factory and an
expectmatcher — turns out to be a near-worthless signal: it usually means the test fed an input and asserted a transform. The test that works is "would this still pass if the function under test werex => x?" Both genuine echoes are inpty-management.test.ts, where the handler returnsgetDaemonFolderAccessMismatch(identity)verbatim, so asserting the mock's ownevidence('allowed')object and itsnullproved only the mock. One case's own comment conceded the handler makes no decision. The branch-exercising cases there — the.catch(() => 'unknown')fail-open, the re-probe ordering, null-identity — all stay.Semantic sweep of 80 files no detector flagged: 27 junk cases. The instructive ones:
computer-use-permissions"returns permission status"() => getComputerUsePermissionStatus(); no arg mapping to guardcli-appimage-stale-registration"does not mutate off Linux"cli.ts:24-39has no platform check; the refusal came from the!runtimeIdentityguard a sibling case already ownsautomations-external-scope"keeps probing a host that is still retained"retainScopesonly cancels queued probes and stores no state, so retaining with nothing in flight is a no-opfilesystem-download-transfers"rejects when the remote path is not a directory"desktop-renderer-runtime-capabilities"advertises each capability once"includes, so a duplicate entry is inert in production — nothing could fail it for the right reasondashboard-payload-validation"mirrors isDashboardSnapshot on every rejection"filesystem-allowed-roots×2referenceAllowedRoots, a verbatim copy of the pre-change algorithm kept in the test fileOne nuance worth flagging for review: a third
referenceAllowedRootscase was kept. It calls the old algorithm to count its work — 100,000 containment checks against the new implementation's 100 — which is a real bound on the authorization hot path, withtoEqualconfirming the two still agree. So the same helper is junk in two cases and load-bearing in a third; removing it wholesale would have deleted a genuine regression guard.Antigravity: deleted a
scaffold self-checkbuilt on a hand-typed five-line screen.docs/reference/antigravity-readiness-evidence.md(which AGENTS.md requires reading before touching this area) exists becausefindAntigravityReadyPromptIndexwas written five times, each tuned against exactly that fixture shape, and three of the first four shipped worse than the bug they replaced. That fixture's banner had already drifted toAntigravity CLI 1.0.3against a real captured1.2.0. The raw-capture provenance guard and the transcript-checklist ratchet in that file stay — those are the defences against the failure mode the doc describes.Why
The remaining junk in this repo has no mechanical signature, and this PR is the evidence. Measured hit rates:
Three further detectors were built and deliberately not dispatched: all-negative-assertion cases (5,339 files — "rejects invalid input" is a legitimate contract and looks identical), intra-file structural repetition (117 files — legitimate per-variant coverage, one case per agent or per SSH directive), and mock-echo at full breadth (308 → narrowed to 36). Knowing where mechanisation stops is most of what the detector phase established.
Production wiring gaps found, left intact
The sweep keeps surfacing production gaps, because from a test's point of view an unwired writer and dead weight look identical. Nothing below was touched; in each case the test is the only remaining evidence the path is incomplete.
Conversation names are rendered but never written.
AgentSessionRecordStore.setConversationName(agent-session-record-store.ts:166) has no production caller — only its test. The read side is fully wired:conversationNameis consumed by the dashboard snapshot,agent-row-conversation-name.ts, payload validation, the sidebar compact agent row,AgentKanbanCard.tsx, and board filtering. So three UI surfaces render a field that is permanently null, with dead filtering logic behind it. This is unwired write wiring, not dead code — nobody wires seven readers for a field they never intend to set.Also: an
adopt-exempting branch inagent-session-reservation-admission.tsthat its own test documents as unreachable ("No wire shape reaches it today").Linked Issue
N/A — test-suite hygiene, no pre-existing issue.
Visual Proof
N/A — no production code changes in this PR.
Testing
Verified locally on macOS after committing:
node config/scripts/check-reliability-gates.mjs— passes, 140 gates.oxlintclean across the changed set.pnpm tcnot required — zero production files changed.src/main/ipc/pty-management.ts:84-100to confirm the handler really is a pass-through for those inputs, and confirmedreferenceAllowedRootsis still load-bearing for the surviving bound test rather than orphaned.Not run locally: e2e and the Windows/Linux/SSH jobs — left to CI.
Removal-only; no new tests.
Review
The useful review here is adversarial on the reasoning, not the diff: for any removed case, is there a regression that would have failed it which I've missed? The
referenceAllowedRootssplit and the Antigravity scaffold are the two I'd look at first. ThesetConversationNamegap is worth a real owner's attention independently of this PR.Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
token-2 → []half is the distinction between "not found" and "host cannot enumerate" (null), which the sibling case does not cover. No guard removed.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)