Skip to content

Phase 4: Copilot fake fixture and offline test suite #7

Description

@tinkermonkey

Create the fake-copilot.mjs fixture (if not already present from the feat/v0.4-copilot-backend merge) and a corresponding offline test file CliProcess.copilot.test.ts that exercises CliProcess with backend: 'copilot' against the fixture. This phase is blocked until the Copilot backend implementation is merged to main.

Requirements

  • Prerequisite: feat/v0.4-copilot-backend must be merged to main before this phase begins
  • If fake-copilot.mjs and CliProcess.copilot.test.ts are not brought in by the merge, create them:
    • fake-copilot.mjs driven by FAKE_SCENARIO env var, consuming ACP JSON-RPC requests from stdin, writing ACP-compliant NDJSON to stdout
    • Scenarios: golden-path (full handshake + one assistant turn + idle), stall, ignore-sigterm, nonzero-exit, permission-request
  • CliProcess.copilot.test.ts must mirror the structure of the existing CliProcess.test.ts: inject fake-copilot.mjs into PATH as copilot binary via beforeAll, instantiate CliProcess with backend: 'copilot'
  • Cover the same scenario categories as the Claude fake suite: golden path, stall (idle_timeout), SIGTERM/SIGKILL escalation, nonzero exit, AbortSignal (pre-flight and mid-run)
  • ReadyEvent, TextEvent, and DoneEvent emitted by the Copilot backend must satisfy the same normalized field contracts as the Claude backend
  • All tests must pass under npm test with no live binary or credentials

Design Guidance

Implements the 'Copilot Fake Fixture' (FR-4) and 'Copilot Fake Test Suite' (FR-5) from the business requirements, and the 'Extended Fake Fixture Scenarios' and 'PATH Injection for Fake Binaries' patterns from the architecture design. The ACP protocol handshake sequence for the golden-path scenario is specified in the architecture's component design.

Acceptance Criteria

  • feat/v0.4-copilot-backend is merged to main before work begins
  • fake-copilot.mjs exists under src/__tests__/fixtures/ with all five scenarios implemented
  • FAKE_SCENARIO=golden-path reads ACP initialize from stdin and writes a valid ACP response sequence to stdout, then exits 0
  • CliProcess.copilot.test.ts exists and covers golden path, stall, SIGTERM/SIGKILL, nonzero exit, and AbortSignal
  • Collected events from the golden-path scenario include ReadyEvent, TextEvent, and DoneEvent with the same field contracts as the Claude backend
  • All Copilot fake tests pass under npm test without the real copilot binary
  • Code is reviewed and approved

Dependencies

Prerequisite: feat/v0.4-copilot-backend merged to main

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions