Skip to content

chore(review): close the mutation-verified test-pin gaps from PR #9096 review rounds 5-6 #9194

Description

@wenshao

Follow-up to PR #9096 (review platform subcommands). Across review rounds 5–6 the automated reviewer flagged a consistent class of hardening gaps that are real but non-blocking: tests that under-pin their stated contract (a mutation in the production code ships the suite green). These are test-robustness and a few minor code-hygiene items, not behavior bugs — landing them is worthwhile but should not hold the PR.

Pin-completeness gaps (the dominant theme — each was mutation-verified by the reviewer)

Extend the new subcommand tests so the assertion actually fails when the named invariant is broken:

  • Full emitted-command prefix: several pins match only from the subcommand name, not the "${QWEN_CODE_CLI:-qwen}" review wrapper (pr-context inline/issue/review kinds, agent-prompt weld, SKILL.test.ts).
  • Negative assertions: rule-4 guard lacks not.toContain('gh issue view'); the 422 drift guard is positive-only (no headRefOid absence check).
  • Ordering invariants pinned half-way: the host/auth/gh ordering pins host < min(auth, gh) but not auth < gh; mkdir-before-write ordering is unpinned in fetch-diff/comment-body/issue-context/pr-context.
  • Write-target path never asserted: tests read writeFileSyncMock.mock.calls[0][1] (content) but never calls[0][0] (path) — a redirected write ships green.
  • Error-message assertions dropped/never pinned: several catch/guard stderr writes are unasserted (writeStderrLineSafe mocked anonymously).
  • Numeric-guard Number.isInteger half untested in comment-body/issue-context (only non-positive cases).
  • Whitespace-only --host refusal unpinned in handler tests (setGhHost is mocked wholesale, so the real validator never runs in-handler).
  • Omitted-host path (setGhHost(undefined)) unpinned in some handlers.
  • Success-path extras header wording ('NOT in the closing set') never positively asserted; unfetchable/JSON↔file agreement partially unpinned.
  • pr-context host routing: setGhHost(host) handler call had no assertion (addressed) — audit siblings for the same gap.
  • meta exit-1 classification for a HOSTNAME_RE-rejected discovered host is untested; the error message's GH_HOST env attribution branch is missing (three-way source attribution needed).

Code-hygiene items worth a second look

  • compose-review planPrIdentity re-validates the plan host with HOSTNAME_RE WITHOUT trimming — now consistent because fetch-pr records the trimmed host (round-6), but the reader-side trim that agent-prompt does is the more robust pattern; consider aligning.
  • Design doc (docs/design/2026-08-13-…) "no behavior change" invariant was falsified by three probe-confirmed regressions during the PR (ghRaw utf8 decode, resolveRepo parent hop, publish-assets whitespace host) — correct the invariant wording or add a caveat.
  • yargs-layer usage errors exit 1 (missing required arg / invalid --kind), not the exit-2 the handler contract implies — the global .fail() in config.ts governs this; tree-wide exit-2 semantics would need a scoped change there.
  • plan-diff records --repo/--pr into the plan without isOwnerRepo/numeric validation at record time (the agent-prompt weld re-validates before interpolating, so this is defense-in-depth, not a live hole).
  • pr-context handler calls setGhHost(host) without the try/catch TypeError→exit-2 classification its siblings have.
  • Render-adjudication carve-out (Step 4) availability is tied to the PR's Enterprise host in the prose, but the call targets the user-designated QWEN_REVIEW_SCRATCH_REPO, whose host is independent.
  • Stale comment/test-title: agent-prompt weld comment says "fetch-pr records the raw flag" but fetch-pr now records the trimmed host.

Each item above links to a specific inline comment on PR #9096 (rounds 5–6, reviewer qwen-code-ci-bot); see those threads for the probe evidence and exact file:line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    category/cliCommand line interface and interactionpriority/P3Low - Minor, cosmetic, nice-to-fix issuesscope/cliscope/testingTest frameworks and casestype/enhancementNon-bug improvement or optimization

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions