Skip to content

fix: eliminate mock fragility in index-response-deps test (kaizen #343)#265

Merged
aviadr1 merged 1 commit intomainfrom
fix/k343-mock-fragility-import-original
Mar 21, 2026
Merged

fix: eliminate mock fragility in index-response-deps test (kaizen #343)#265
aviadr1 merged 1 commit intomainfrom
fix/k343-mock-fragility-import-original

Conversation

@aviadr1
Copy link
Copy Markdown

@aviadr1 aviadr1 commented Mar 21, 2026

Summary

  • Adds vi.mock() for all 12 modules imported by index.ts that were previously unmocked (case-backend, case-backend-github, escalation-hook, case-sync-routing, cookie-handler, record-usage, dev-safe-word, dev-session-orchestrator, dev-session-router, error-classify, message-dispatch, send-response)
  • Adds missing exports to existing mocks (checkImageAdvisory, routeOutboundImage, CASE_SYNC_ENABLED, etc.)
  • Adds maintenance note explaining the pattern for future additions

Problem

When #285 extracted inline logic from index.ts into new modules, adding those imports broke index-response-deps.test.ts because its vi.mock() declarations had to exactly mirror every module-scope import. This created a maintenance tax that grows with each extraction.

Solution

Mock all currently-imported modules and document the pattern. Future extractions only need to add a single vi.mock('./new-module.js', () => ({...})) line.

Test plan

  • All 13 tests in index-response-deps.test.ts pass
  • Full suite: 79 files, 1272 tests pass

batch-260321-1108-3ef8/run-10

🤖 Generated with Claude Code

… (kaizen qwibitai#343)

The test was fragile because vi.mock() declarations had to exactly mirror
every export used at module scope in index.ts. When #285 extracted inline
logic into new modules, adding those imports broke the test.

Changes:
- Add mocks for all 12 modules imported by index.ts but previously unmocked
  (case-backend, case-backend-github, escalation-hook, case-sync-routing,
  cookie-handler, record-usage, dev-safe-word, dev-session-orchestrator,
  dev-session-router, error-classify, message-dispatch, send-response)
- Add missing exports to existing mocks (checkImageAdvisory, routeOutboundImage,
  routeOutboundDocument, CASE_SYNC_ENABLED, CASE_SYNC_REPO, etc.)
- Add maintenance note explaining the pattern for future additions

batch-260321-1108-3ef8/run-10

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@aviadr1 aviadr1 enabled auto-merge (squash) March 21, 2026 12:08
@aviadr1 aviadr1 merged commit 7f87873 into main Mar 21, 2026
3 checks passed
@aviadr1 aviadr1 added the overnight-dent Created by overnight-dent batch automation label Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

overnight-dent Created by overnight-dent batch automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant