Skip to content

[Air #641] test: verify SPIR solo mode emits single consultation task#642

Merged
waleedkadous merged 1 commit intomainfrom
builder/air-641-test-verify-spir-solo-mode-emi
Mar 28, 2026
Merged

[Air #641] test: verify SPIR solo mode emits single consultation task#642
waleedkadous merged 1 commit intomainfrom
builder/air-641-test-verify-spir-solo-mode-emi

Conversation

@waleedkadous
Copy link
Copy Markdown
Contributor

Summary

Adds missing test coverage verifying that porch next respects consultation model configuration — specifically solo mode (single model) and none mode (consultation disabled).

Implements #641

What Changed

Two new tests in next.test.ts:

  1. Solo mode test: Mocks loadConfig to return models: ['claude'], asserts porch next emits exactly 1 consultation task containing only claude (not gemini or codex)
  2. None mode test: Mocks loadConfig to return models: 'none', asserts porch next emits a "Consultation skipped" task with no consult -m commands

Also refactored the loadConfig mock to use vi.hoisted with a mutable ref (configRef), allowing per-test overrides while keeping the default 3-model behavior for all existing tests. The afterEach resets configRef.models to the default.

Key Decisions

  • Used vi.hoisted mutable ref pattern instead of vi.fn().mockReturnValueOnce() because vitest's async mock factories don't properly propagate mockReturnValueOnce overrides to the imported module reference.
  • Kept assertions aligned with actual source behavior: solo mode checks N-way consultation subject, none mode checks Consultation skipped subject.

Test Plan

  • 2 new unit tests added (solo mode + none mode)
  • Build passes (tsc --noEmit)
  • All 26 tests in next.test.ts pass
  • Full test suite: 2301 passed, 13 skipped, 23 pre-existing failures (unrelated: adopt, consult, update, session-manager)

Review Notes

Net diff is ~45 lines. The configRef approach is minimal and isolated — existing tests are unaffected since afterEach resets to defaults.

Add two tests to next.test.ts:
- Solo mode: when config has models: ['claude'], porch next emits exactly
  1 consultation task mentioning only claude (not gemini/codex)
- None mode: when config has models: 'none', porch next emits a
  'Consultation skipped' task with no consult commands

Refactors the loadConfig mock to use vi.hoisted mutable ref so individual
tests can override consultation models without affecting other tests.
@waleedkadous waleedkadous merged commit 1c14a63 into main Mar 28, 2026
6 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