Skip to content

feat(qa): short-circuit re-run when prior qa:completed SHA matches HEAD #530

Closed

Description

@admarble

Summary

QA emits commitSHA in every qa:completed phase marker (.claude/skills/qa/SKILL.md:102-118). Phase 0 detects "implementation exists vs not" but does not compare the recorded SHA against current HEAD to skip a redundant full re-run.

Motivation

Re-running /qa 27 28 on two already-QA'd issues after merge fired the full 2410-line skill pipeline (sub-agents, quality checks, CI lookup) despite the previous run's verdict still being valid against the same commit. Token and wall-clock waste.

Acceptance Criteria

  • AC-1: In Phase 0, parse the latest qa:completed phase marker from issue comments and extract commitSHA
  • AC-2: If commitSHA matches current git rev-parse HEAD and the marker status is completed, skip sub-agent spawning and output a short "QA already completed at SHA X — no changes since" summary with the prior verdict
  • AC-3: --force CLI flag bypasses the short-circuit
  • AC-4: --no-cache also bypasses (consistency with existing flag at line 170)
  • AC-5: When marker status is failed (AC_NOT_MET), do NOT short-circuit — user likely wants to re-run after a fix
  • AC-6: Update SKILL.md across all three skill directories

Additional context

  • Related: per-check caching at lines 164-190 caches individual quality checks but not the overall phase
  • Low-risk change — additive, gated behind SHA equality + explicit bypass flags

Complexity

simple

Activity

  1. added
    enhancement
    qa
    on Apr 17, 2026
  2. admarble commented on Apr 17, 2026

    @admarble
    ContributorAuthor

    → PROCEED — Short-circuit QA when prior qa:completed SHA matches HEAD

    Workflow: spec → exec → qa · 6 ACs

    npx sequant run 530 -q
    

    ⚠ Run sequentially with #529 (both edit qa/SKILL.md across 3 mirrors)
    ⚠ SKILL.md sync across 3 dirs — known pitfall

  3. admarble commented on Apr 17, 2026

    @admarble
    ContributorAuthor

    Spec Review — Issue #530

    Complexity: Simple (6 ACs, 1 directory × 3 mirrors)

    AC Quality Check

    All 6 ACs passed lint — no vague, unmeasurable, or open-ended criteria detected.

    Scope Assessment

    Verdict: ✅ SCOPE_OK (1 feature, 6 ACs, 1 directory × 3 mirrors)


    Acceptance Criteria with Verification

    • AC-1: Parse latest qa:completed phase marker and extract commitSHA
      • Verification: Integration Test — Given issue has prior qa:completed with commitSHA → When /qa <N> Phase 0 runs → Then SHA extracted from latest marker
    • AC-2: Short-circuit when SHA matches HEAD and status is completed
      • Verification: Integration Test — Given commitSHA == git rev-parse HEAD AND status completed → When /qa <N> → Then sub-agents NOT spawned, summary output with prior verdict
    • AC-3: --force CLI flag bypasses short-circuit
      • Verification: Integration Test — Given SHA match → When /qa <N> --force → Then full pipeline runs
    • AC-4: --no-cache also bypasses (consistency with line 170)
      • Verification: Integration Test — Given SHA match → When /qa <N> --no-cache → Then full pipeline runs
    • AC-5: failed (AC_NOT_MET) does NOT short-circuit
      • Verification: Integration Test — Given latest marker status: "failed" even if SHA matches → Then full pipeline runs
    • AC-6: Update SKILL.md across all three skill directories
      • Verification: Unit Test — cmp confirms .claude/skills/qa/SKILL.md, templates/skills/qa/SKILL.md, skills/qa/SKILL.md are byte-identical

    Implementation Plan

    Phase 1: Add SHA short-circuit to Phase 0 in SKILL.md

    1. Insert "Phase 0a: Prior QA SHA Check" as a new subsection before existing Phase 0 Implementation Status Check (line ~396)
    2. SHA extraction: parse latest qa:completed/qa:failed marker from issue comments via gh issue view --json comments
    3. Decision matrix:
      • completed + SHA match + no --force/--no-cache → short-circuit with summary
      • failed → always proceed (AC-5)
      • SHA mismatch → always proceed
    4. Add short-circuit output template (prior verdict, SHA, "no changes since" message)

    Phase 2: Sync all 3 directories

    1. Apply identical edits to templates/skills/qa/SKILL.md and skills/qa/SKILL.md
    2. Verify sync with cmp

    Design Decisions

    • Location: QA SKILL.md Phase 0 block (prompt-level, not TypeScript) — consistent with spec skill's phase detection pattern
    • Prior verdict output: Status + link to original comment (not full replay) to avoid stale data
    • grep || true: All grep commands must use || true (known pitfall)

    Conflict Risk

    ⚠️ Both #529 and #530 edit qa/SKILL.md × 3 mirrors. Run sequentially — complete one before the other.

    Recommended Workflow

    Phases: spec → exec → qa · Quality loop enabled

    npx sequant run 530 --phases exec,qa
    
  4. added
    planned
    on Apr 17, 2026
  5. admarble commented on Apr 17, 2026

    @admarble
    ContributorAuthor

    QA Review for Issue #530

    Implementation Status: NOT FOUND

    No implementation detected for this issue:

    • Commits on feature branch: None
    • Uncommitted changes: None
    • Open PR: None

    Verdict: AC_NOT_MET

    No code changes found to review. The acceptance criteria cannot be evaluated without an implementation.

    Next Steps

    1. Run /exec 530 to implement the feature
    2. Re-run /qa 530 after implementation is complete

    QA skipped: No implementation to review

  6. added
    needs-work
    on Apr 17, 2026
  7. admarble commented on Apr 17, 2026

    @admarble
    ContributorAuthor

    QA Review for Issue #530

    Implementation Status: NOT FOUND

    No implementation detected for this issue:

    • Commits on feature branch: None
    • Uncommitted changes: None
    • Open PR: None

    Verdict: AC_NOT_MET

    No code changes found to review. The acceptance criteria cannot be evaluated without an implementation.

    Next Steps

    1. Run /exec 530 to implement the feature
    2. Re-run /qa 530 after implementation is complete

    QA skipped: No implementation to review

  8. added a commit that references this issue on Apr 19, 2026
  9. admarble commented on Apr 19, 2026

    @admarble
    ContributorAuthor

    QA Review for Issue #530

    AC Coverage

    AC Source Description Status Evidence
    AC-1 Original Parse latest qa:completed phase marker and extract commitSHA MET .claude/skills/qa/SKILL.md:515-531 — greps {[^}]*"phase":"qa"[^}]*}, tail -1, extracts status, commitSHA, timestamp via jq
    AC-2 Original Short-circuit when SHA matches HEAD + status=completed, skip sub-agents, output summary with prior verdict MET Decision matrix at :533-540 — completed + SHA match → Short-circuit; actions list at :542-547 (skip sub-agents, skip review, output template); short-circuit template at :551-566
    AC-3 Original --force CLI flag bypasses MET Invocation docs at :129; skip check at :509
    AC-4 Original --no-cache bypasses (consistency with existing flag at line 170) MET Skip check at :510; existing --no-cache flag preserved at :172
    AC-5 Original failed status must NOT short-circuit MET Decision matrix: failed | Yes or No | Proceed with full QA (user likely wants re-run after fix)
    AC-6 Original Mirror across three skill directories MET All three files received identical 69-line diff; npx tsx scripts/check-skill-sync.ts reports synced qa/SKILL.md — 3/3 match

    Coverage: 6/6 AC items fully met


    CI Status

    No PR yet (created after QA). CI will be validated post-push.


    Quality Metrics

    Metric Value Status
    Type issues (any) 0 OK (no TS changes)
    Deleted tests 0 OK
    Files changed 4 OK
    Lines added +211 OK (docs-only)
    Lines deleted 0 -

    Test Coverage Analysis

    All changes are prose in SKILL.md + CHANGELOG.md. No runtime code, no tests apply. Full suite (528 tests) passed in /exec phase verifying no regression.


    Code Review

    Strengths:

    • Pattern {[^}]*"phase":"qa"[^}]*} correctly matches both qa:completed and qa:failed markers; status field discriminates in the decision matrix, satisfying AC-1 + AC-5 together
    • tail -1 selects the most-recent marker (matches "latest" in AC-1)
    • Bypass flags are OR'd cleanly, with --no-cache piggybacking on the existing flag semantics
    • Three-dir mirror is byte-identical (verified via diff -q and sync script)
    • Commands use well-established tools (gh, jq, grep, git rev-parse) — no exotic dependencies

    Issues:

    • Minor: short-circuit template has a Prior Verdict: field but the phase marker only stores status and commitSHA, not the full verdict (READY_FOR_MERGE / AC_MET_BUT_NOT_A_PLUS / etc.). The skill acknowledges this and falls back to "the prior QA comment on the issue contains the full details." Non-blocking since AC-2 is satisfied by pointing to the prior comment.

    Suggestions:


    Skill Command Verification

    Command Verified
    gh issue view <N> --json comments --jq '[.comments[].body]' ✅ Standard, widely used
    grep -o '<!-- SEQUANT_PHASE: {[^}]*"phase":"qa"[^}]*} -->' ✅ Matches phase-marker format at line 110
    jq -r '.status // empty', jq -r '.commitSHA // empty' ✅ Safe null-handling
    git rev-parse HEAD ✅ Standard

    Placeholders (<issue-number>) require manual substitution at runtime — skill context.

    Verification Status: Passed


    Skill Change Review

    • Command verified: All commands use established tools with standard flags
    • Fields verified: commitSHA field exists in emit format at line 110
    • Patterns complete: Decision matrix covers completed, failed, and no-marker cases
    • Dependencies explicit: Relies on gh + jq + grep + git (all already skill-wide dependencies)

    Three-Directory Sync

    npx tsx scripts/check-skill-sync.ts → synced qa/SKILL.md — 3/3 match ✅


    CHANGELOG Verification

    Check Status
    CHANGELOG.md exists ✅
    User-facing change ✅ Yes (feat)
    [Unreleased] entry ✅ Present
    Entry format ✅ Includes (#530) issue ref

    Risk Assessment

    • Likely failure mode: A phase-marker JSON containing the substring "phase":"qa" inside a nested field (e.g., within an error message) could theoretically be mis-extracted by the {[^}]*} pattern. In practice markers are flat and emitted by a known writer, so this is very low risk.
    • Not tested: SKILL.md is prose, not executable. Real verification happens next time /qa runs on an already-reviewed issue. Behavior is straightforward shell composition; no hidden runtime paths.

    Verdict: READY_FOR_MERGE

    All 6 ACs literally met. Implementation is pure skill-prose with standard tooling, mirrored cleanly across three directories, CHANGELOG updated. The Prior Verdict template gap is minor and explicitly handled by falling back to the prior comment.

    Documentation

    • CHANGELOG entry added (## [Unreleased] > ### Added)
    • SKILL.md docs updated (invocation section + Phase 0a)
    • N/A — no README change (skill-internal)

    Next Steps

    1. Create PR (fullsolve Phase 5)
    2. Verify CI passes post-push
    3. Merge when green
  10. added
    ready-for-review
    and removed
    needs-work
    on Apr 19, 2026
  11. admarble commented on Apr 19, 2026

    @admarble
    ContributorAuthor

    /fullsolve Complete

    Issue: #530
    Status: READY_FOR_MERGE
    PR: #541

    Summary

    Phase Iterations Status
    Spec 1/1 Complete (prior run)
    Exec 1/3 Complete — committed dd028cb
    Test - Skipped (no ui/frontend/admin label)
    QA 1/2 Complete — READY_FOR_MERGE

    AC Coverage

    6/6 literally met:

    • AC-1: Parse latest qa phase marker, extract commitSHA ✅
    • AC-2: Short-circuit on SHA match + status=completed, skip sub-agents ✅
    • AC-3: --force bypasses ✅
    • AC-4: --no-cache bypasses ✅
    • AC-5: status=failed never short-circuits ✅
    • AC-6: Mirrored across .claude/skills/, skills/, templates/skills/ (3/3 synced) ✅

    Quality Metrics

    • Build: ✅ passed
    • Lint: ✅ passed
    • Tests: ✅ 528/528 passed
    • Three-dir sync: ✅ qa/SKILL.md synced
    • CHANGELOG: ✅ [Unreleased] entry added

    Risk Assessment

    • Likely failure mode: JSON containing "phase":"qa" as a substring in a nested field could be mis-extracted — very low likelihood since markers are flat and writer-controlled.
    • Not tested: SKILL.md is prose; no unit tests apply. Real verification occurs on next /qa invocation against an already-QA'd issue.

    Notes


    Ready for human review and merge.

  12. added 3 commits that reference this issue on Apr 20, 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

    enhancementplannedqaready-for-review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions