Skip to content

Build a safe PR mutation-target selector #22

Description

@jonbaldie

Parent

#21

What to build

Provide one CI-facing mutation-target selector that compares a pull-request head with the merge base of its actual target branch and reports exactly one deterministic mode: selected production paths, full suite, or clean skip. The command must handle Git paths safely, explain its decision in logs, and fail closed to a full run whenever PR metadata or Git comparison cannot be trusted.

This is the enabling prefactor for both mutation engines: it delivers a complete, directly executable selection behavior without coupling target discovery to either engine.

Acceptance criteria

  • A real PR diff containing added or modified production TypeScript files returns selected mode with their head paths.
  • Renamed and copied production files are returned under their head paths; deleted paths are excluded.
  • A diff with no mutation-relevant change returns clean skip with an explicit reason.
  • A test, mutation-runner, threshold, mutation-configuration, or CI mutation-orchestration change returns full-suite mode.
  • A non-PR build returns full-suite mode.
  • An unavailable target branch, failed fetch, ambiguous metadata, or failed merge-base calculation logs the failure and returns full-suite mode.
  • The actual PR target branch is used rather than assuming main.
  • Output is structured or delimiter-safe so filenames remain data, including names with spaces and shell metacharacters.
  • Logs identify the comparison base, selected mode, reason, and selected production paths.
  • Tests invoke the command against real temporary Git repositories and real commits; Git and CI command output are not mocked.

Blocked by

None — can start immediately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentFully specified and ready for an implementation agent

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions