Skip to content

chore(tests): remove 6 dead pi-embedded vi.mock shims#2390

Merged
alexey-pelykh merged 1 commit intomainfrom
fix/hq-35-pi-embedded-test-mocks
Apr 17, 2026
Merged

chore(tests): remove 6 dead pi-embedded vi.mock shims#2390
alexey-pelykh merged 1 commit intomainfrom
fix/hq-35-pi-embedded-test-mocks

Conversation

@alexey-pelykh
Copy link
Copy Markdown

Summary

Production code no longer imports pi-embedded.js or pi-embedded-runner/runs.js — they were removed by prior gut commits (#2146/#2273, #2367, #2377). The 6 vi.mock calls identified in remoteclaw/hq#35 registered mock factories against paths nothing resolves; vitest never invoked them, and the mock state those tests configured had zero effect on production behavior.

This PR deletes all 6 dead vi.mock shims and the local state each one was paired with.

Files touched

File What was deleted
src/agents/subagent-announce.timeout.test.ts vi.mock("./pi-embedded.js", ...) (3-function shim)
src/agents/subagent-announce.format.e2e.test.ts vi.mock("./pi-embedded.js", () => embeddedRunMock) only (see §Out of scope below)
src/auto-reply/reply/abort.test.ts vi.mock("../../agents/pi-embedded.js", ...) (2-function shim)
src/auto-reply/reply/get-reply-run.media-only.test.ts vi.mock("../../agents/pi-embedded.js", ...) (4-function shim)
src/cli/gateway-cli/run-loop.test.ts vi.mock("../../agents/pi-embedded-runner/runs.js", ...) + local abortEmbeddedPiRun / getActiveEmbeddedRunCount / waitForActiveEmbeddedRuns vi.fn()s + their setup calls in the SIGUSR1 restart test + obsolete comment
src/cron/isolated-agent/run.test-harness.ts vi.mock("../../agents/pi-embedded.js", ...) + exported runEmbeddedPiAgentMock + makeDefaultEmbeddedResult() helper + harness reset lines

Diffstat: 6 files changed, 51 deletions, 0 additions.

Verification

  • grep -rn "vi.mock.*pi-embedded" src/ returns 0 matches (was 6)
  • pnpm lint: 0 warnings, 0 errors
  • pnpm tsgo: exit 0
  • pnpm test:fast: 761 files / 6829 passed / 2 skipped / 0 failed
  • Directly-affected tests: run-loop.test.ts 8/8 pass; src/cron/isolated-agent/ 118/118 pass

Out of scope

Four of the touched files have pre-existing failures unrelated to this PR (session routing, ACP cancel flow, think-level extraction, message content format). Pass/fail counts are identical before and after this change:

File Before After
subagent-announce.timeout.test.ts 4F/4P 4F/4P
abort.test.ts 9F/10P 9F/10P
get-reply-run.media-only.test.ts 1F/11P 1F/11P
subagent-announce.format.e2e.test.ts (e2e, excluded from CI) 44F/25P 44F/25P

subagent-announce.format.e2e.test.ts still references a dead embeddedRunMock object throughout its body. Deleting those ~42 references would be a ~200-line refactor touching pre-existing-failing tests — deferred as out of scope.

Follow-up

After this merges, HQ will ratchet .claude/skills/fork-openclaw/SKILL.md § Semantic Invariants § Test Infrastructure from "≤6 matches" back to "0 matches" to restore the stricter check (tracked alongside remoteclaw/hq#35).

Test plan

  • Local: pnpm lint clean
  • Local: pnpm tsgo clean
  • Local: pnpm test:fast 6829 passed / 0 failed
  • Local: directly-affected test files green (run-loop, cron isolated-agent)
  • CI: full pnpm test (parallel lanes) green

Refs: remoteclaw/hq#35

🤖 Generated with Claude Code

Production code no longer imports `pi-embedded.js` or
`pi-embedded-runner/runs.js` — they were removed by prior gut commits
(#2146/#2273, #2367, #2377). These 6 vi.mock calls registered mock
factories against paths nothing resolves; vitest never invoked them.

Deleted mocks:
- src/agents/subagent-announce.timeout.test.ts
- src/agents/subagent-announce.format.e2e.test.ts
- src/auto-reply/reply/abort.test.ts
- src/auto-reply/reply/get-reply-run.media-only.test.ts
- src/cli/gateway-cli/run-loop.test.ts
- src/cron/isolated-agent/run.test-harness.ts

Also removed dead state tied to each mock:
- run-loop.test.ts: local abortEmbeddedPiRun / getActiveEmbeddedRunCount /
  waitForActiveEmbeddedRuns vi.fn()s plus their setup calls and the
  comment at the SIGUSR1 restart assertion
- run.test-harness.ts: runEmbeddedPiAgentMock export and its
  makeDefaultEmbeddedResult/reset helpers

Pre-existing failures in four of the touched files
(subagent-announce.timeout.test.ts, abort.test.ts,
get-reply-run.media-only.test.ts, subagent-announce.format.e2e.test.ts)
are unrelated semantic drift (session routing, ACP cancel flow,
think-level extraction, message format) — pass/fail counts are
identical before and after this change.

Follow-up: ratchet the fork-openclaw skill's "≤6" invariant back to
"0 matches" in HQ once this lands.

Refs: remoteclaw/hq#35

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@alexey-pelykh alexey-pelykh merged commit a0ec36f into main Apr 17, 2026
12 checks passed
@alexey-pelykh alexey-pelykh deleted the fix/hq-35-pi-embedded-test-mocks branch April 17, 2026 19:45
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