Skip to content

feat: Implement touchSet conflict prediction and blast radius scoring #16

@nigel-dev

Description

@nigel-dev

Description

The touchSet field exists in the JobSpec schema (file glob patterns indicating which files a job expects to modify), but no logic uses it. Implementing conflict prediction would warn users before launching jobs with overlapping file globs, preventing wasted compute on work that will inevitably conflict at merge time.

Use Case

When orchestrating a plan with multiple jobs, two jobs may unknowingly modify the same files. Currently, this is only discovered at merge time — after both jobs have run to completion. With touchSet conflict prediction:

  1. Pre-launch validation: Before launching a plan, check for overlapping touchSets between parallel jobs (jobs without dependency ordering). Warn or block.
  2. Blast radius scoring: Score each job by how many files it touches and how many overlap with other jobs, helping the user assess risk.
  3. Auto-inference: After a job completes, capture git diff --name-only and store as the actual touchSet for future reference.

Proposed Solution

Phase 1: Static conflict detection

  • In orchestrator.ts validatePlan() or startPlan(), compare touchSets of jobs that can run in parallel (no dependency chain between them).
  • Use glob matching (e.g., Bun.glob or minimatch) to detect overlaps.
  • Return warnings in the plan creation response.

Phase 2: Auto-inference

  • After a job completes and before merge, run git diff --name-only on the job's branch.
  • Store the result as actualTouchSet in the job state.
  • Use this for future plans with similar prompts.

Phase 3: Blast radius scoring

  • Score: (overlapping files with other jobs) / (total files touched).
  • Surface in mc_plan_status and mc_overview.

Files Involved

  • src/lib/schemas.ts:58touchSet field definition (already exists)
  • src/lib/plan-types.ts:47touchSet type (already exists)
  • src/lib/orchestrator.tsvalidatePlan() needs conflict checking logic
  • src/tools/plan.ts — surface warnings in plan creation response

Additional Context

From the master audit report (Section 9: Phase 2 roadmap): "Implement touchSet conflict prediction + blast radius scoring" and "Auto-infer touchSet from git diff --name-only." The schema infrastructure is already in place — this is purely logic implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2: mediumShould fix — improves reliability or DXenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions