Skip to content

fix(review-residue): the Tests line's printed command reproduces the class beside it (doMock, vi.mock(import()), the prose rule) and rendered paths are shell-quoted #1589

Open

Description

@admarble

Follow-up of #1520 (PR #1587); from QA 3's advisory notes and the independent code review.

Problem

R-3 on #1520 says every residue and test line carries the command that produced it, so a reviewer can re-run it. Two things break that promise on the Tests lines:

  1. The printed command is grep -nE 'vi\.mock|jest\.mock|SKILL\.md' <path> (src/lib/workflow/review-residue.ts:294), but the class beside it comes from MOCK_CALL_RE (:186), which also matches doMock and vitest's typed vi.mock(import("x")), and from isProseGate (src/lib/prose-gate.ts), which needs a read of a SKILL.md plus an assertion. A file classed mock because of vi.doMock("child_process") prints a grep that returns nothing; a file with // see SKILL.md prints a grep that hits while the class says real. The command does not reproduce the classification it sits beside. Today the command string names none of doMock, import( or the read rule (sed -n 294p … | grep -c doMock → 0).
  2. Paths in every rendered command (numstatCmd, the hot-file git log, the test-line grep) are interpolated bare. A path with a space or a shell metacharacter breaks the copy-paste command.

Acceptance Criteria

  • AC-1: Each Tests line's command, run on the test file's text, agrees with the class shown: it hits exactly when the class is mock or prose, and reports nothing for real. A case runs the printed command (through sh -c on fixture sources written to a temp dir) for a vi.doMock file, a vi.mock(import(...)) file, a prose gate and a // see SKILL.md mention, and compares. Evidence: npx vitest run src/lib/workflow/review-residue.test.ts -t "printed command" → ≥ 1 passed, 0 failed (new case; today the filter matches 0 of 13 tests)
  • AC-1 is classified as a gate test by isGateTestEvidence; the PR body carries its SEQUANT_MUTATION record (revert the command string to the current grep → the doMock comparison fails; restore).
  • AC-2: A diff path containing a space renders inside every command single-quoted (or otherwise shell-escaped), and sh -c on the rendered numstat command for that path exits 0 against a fixture repo. Evidence: npx vitest run src/lib/workflow/review-residue.test.ts -t "space" → ≥ 1 passed, 0 failed (new case; today 0 of 13)
  • AC-3: docs/reference/review-residue.md's command table shows the new test-line command. Evidence: grep -c 'doMock' docs/reference/review-residue.md → ≥ 1 (today 0)

May touch

src/lib/workflow/review-residue.ts (the command strings and a shared quoting helper), review-residue.test.ts, docs/reference/review-residue.md, CHANGELOG.

Non-Goals

Activity

  1. added
    bug
    on Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions