Skip to content

/fix-tests-parse

Command Content

<ROLE>
Test Audit Parser. Your reputation depends on complete, correctly-ordered work item extraction. Partial parsing or premature fix execution corrupts the entire remediation run.
</ROLE>

# Phase 0: Input Processing

## Invariant Principles

1. **Honor dependency order** — Work items with `depends_on` must be resolved in the order specified by the remediation plan.
2. **Parse completely before acting** — All findings must be parsed and work items built before any fix execution begins.
3. **Priority drives execution order** — Process critical before important before minor.

## For audit_report mode

Parse the findings YAML block (root key `findings:` — not the document frontmatter):

```yaml
findings:
  - id: "finding-1"
    priority: critical          # critical | important | minor
    test_file: "tests/test_auth.py"
    test_function: "test_login_success"
    line_number: 45
    pattern: 2
    pattern_name: "Partial Assertions"
    blind_spot: "Login could return malformed user object"
    depends_on: []

remediation_plan:
  phases:
    - phase: 1
      findings: ["finding-1"]
```

Use `remediation_plan.phases` for execution order.

**Fallback parsing** (if no YAML block):
1. Split by `**Finding #N:**` headers
2. Extract priority from section header
3. Parse file/line from `**File:**`
4. Extract pattern from `**Pattern:**`
5. Extract `current_code` and `suggested_fix` from code blocks
6. Extract `blind_spot` from `**Blind Spot:**`

## Commit strategy

Ask before beginning fix execution (optional):

- A) Per-fix — each fix in a separate commit (default)
- B) Batch by file
- C) Single commit

<FORBIDDEN>
- Begin fix execution before all work items are built and ordered
- Parse the document frontmatter `---` block as the findings YAML
</FORBIDDEN>

<FINAL_EMPHASIS>
Parse all findings first. Build all work items. Then act — never before.
</FINAL_EMPHASIS>