You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
QA skill: optimize re-runs by diffing against prior findings #377
When /qa is re-run on an issue that already has QA comments, it currently repeats all checks from scratch. In a recent session (#371), only AC-6 changed between runs but all 9 ACs were re-evaluated, quality agents re-spawned, and the full diff re-read.
Goal
When prior QA findings exist in issue comments, focus the re-run on what changed since the last QA rather than repeating everything.
Acceptance Criteria
On re-run, detect prior QA comment(s) via phase markers
Identify which files changed since the last QA commit (compare HEADs)
Commit SHA at time of QA can be stored in cache metadata
--no-cache flag already exists and disables cache (confirmed)
Existing QACache diff hash logic is correct and reusable
Implementation Plan
Phase 1: Extend cache metadata
Add lastQACommitSha field to QACacheSchema in src/lib/workflow/qa-cache.ts
Add setLastQACommit(sha) and getLastQACommit() methods
Add computeIncrementalDiffHash(sinceCommit) method (diff since last QA, not since main)
Phase 2: Prior QA detection
4. Create detectPriorQAFindings(issueNumber) helper — parses issue comments for QA phase markers, extracts commit SHA and prior AC statuses
5. Add ALWAYS_RERUN_CHECKS constant (["build"]) — checks that bypass cache on re-run
Phase 3: Update QA skill prompt
6. Add re-run detection flow to .claude/skills/qa/SKILL.md before quality agent spawning
7. Update .claude/skills/qa/scripts/quality-checks.sh with --since-commit flag support
8. Sync skills/qa/ templates
Phase 4: Output formatting
9. Enhance print_cache_status() to distinguish skipped/re-ran/always-re-run with reason column
Design Decisions
lastQACommitSha stored in cache.json — Not in phase markers (which are read-only after posting). Cache is local and writable. Fresh clones lose context but that's acceptable for P3.
MET AC items get abbreviated verification — Confirm file exists, don't re-read full implementation. Functional regressions caught by quality checks (type safety, tests).
ALWAYS_RERUN_CHECKS is a constant — Follows existing CHECK_INVALIDATION_PATTERNS pattern. Easy to extend.
Open Questions
Prior AC status extraction: Parse from QA comment body or add structured data in HTML comment? Rec: Parse comment body, add structured data as stretch goal.
MET AC re-evaluation depth: Skip entirely or abbreviated check? Rec: Abbreviated (confirm file exists).
Non-Goals
Incremental AC text diffing (comparing AC wording changes)
⚠️AC-3: "Skip unchanged quality checks (type safety, security, etc.) if diff hash matches"
→ Partially covered: Quality checks already have diff-hash caching via qa-cache.ts. The new work is extending this to AC evaluations and code review findings.
→ Suggest: Clarify that "quality checks" here means both automated checks (already cached) AND manual AC evaluation (not cached).
⚠️AC-5: "Always re-evaluate: any AC item whose status was NOT_MET or PARTIALLY_MET"
→ Note: State schema uses not_met only (no partially_met). SKILL.md maps PARTIALLY_MET → not_met with notes. AC will be evaluated against not_met status.
✅ AC-1, AC-2, AC-4, AC-6: Clear and testable
Summary: 2/6 AC items flagged for review (clarification, not blockers)
Scope Assessment
Non-Goals (Required)
⚠️Non-Goals section not found in issue. Recommended non-goals:
Caching individual code review findings (too subjective, prone to stale assessments)
File-to-AC dependency mapping (over-engineering for P3 scope)
⚠️SCOPE_WARNING — Single feature but touches 3 directories and 6 AC items. Manageable given that the existing cache infrastructure handles most of the heavy lifting.
Acceptance Criteria
AC-1: Detect prior QA comments via phase markers on re-run
SKILL.md Phase 1 CI check — already runs fresh each time
AC-5: Always re-evaluate NOT_MET or PARTIALLY_MET AC items
Verification Method: Unit Test
Test Scenario:
Given: Prior QA stored AC-1=met, AC-2=not_met, AC-3=met in state
When: QA re-runs with file changes only affecting AC-2's area
Then: AC-2 is re-evaluated (status was not_met), AC-1 and AC-3 could be skipped if no relevant changes
Integration Points:
src/lib/workflow/state-manager.ts — getAcceptanceCriteria() reads prior AC statuses
New: skip logic for met ACs when diff is unchanged
AC-6: Output clearly indicates skipped vs re-run checks
Verification Method: Manual Test + Integration Test
Test Scenario:
Given: QA re-run with some cached checks and some fresh
When: QA output is generated
Then: Output contains a table like:
| Check / AC | Status | Re-run? | Reason |
|------------|--------|---------|--------|
| type-safety | ✅ PASS | Cached | Diff hash unchanged |
| build | ✅ PASS | Re-run | Always fresh |
| CI status | ✅ PASS | Re-run | Always fresh |
| AC-1 | MET | Skipped | Previously MET, no file changes |
| AC-2 | MET | Re-evaluated | Was NOT_MET |
Implementation Plan
Phase 1: Extend Phase Marker with Commit SHA (Foundation)
Extend PhaseMarkerSchema in src/lib/workflow/phase-detection.ts to include optional commitSHA field
Update QA skill (SKILL.md) to emit commitSHA: HEAD in the phase marker when posting QA results
Add parseLastQAContext() helper that extracts the most recent QA phase marker's commit SHA and timestamp from issue comments
Phase 2: Extend QA Cache with Run Context
Add qa-run entry type to qa-cache.ts — a new cache entry that stores:
lastQACommitSHA: HEAD at time of QA
lastQADiffHash: diff hash at time of QA
acStatuses: map of AC ID → status from last run
timestamp: when last QA completed
Add CLI commands to scripts/qa/qa-cache-cli.ts: set-run-context and get-run-context
Phase 3: Implement Skip Logic in SKILL.md
Add "Prior QA Detection" section to SKILL.md (before quality checks):
Fetch prior QA comment via phase markers
Extract commitSHA from last QA marker
Compute git diff <lastQACommitSHA>...HEAD --name-only to get incremental changes
If no changes → short-circuit with "No changes since last QA"
Add AC skip logic to the code review section:
Load prior AC statuses from cache run context
For each AC with prior status met: skip unless files changed since last QA
For each AC with prior status not_met: always re-evaluate
For each AC with prior status pending/blocked: always re-evaluate
Phase 4: Output Formatting
Add "Incremental QA Summary" section to SKILL.md output template:
Table showing each check/AC with re-run status and reason
Summary line: "X checks cached, Y re-evaluated, Z always-fresh"
Parallel Groups
Steps 1-2 can be done in parallel (schema + cache are independent).
Steps 3-5 depend on 1-2.
Steps 6-7 depend on 3-5.
Step 8 can be done alongside 6-7.
What's the simplest correct approach?
Store the commit SHA in the phase marker (already emitted) and prior AC statuses in the QA cache (already has infrastructure). The QA skill prompt then reads both, computes incremental diff, and decides what to skip. No new TypeScript modules needed — just extending existing ones.
Rejected alternatives:
File-to-AC dependency mapping: Over-engineered; the QA agent can determine relevance from the diff
Storing AC history in state-schema: Adds permanent state for a cache concern; cache is the right layer
New standalone "incremental QA" module: Unnecessary abstraction for what's essentially a cache extension + prompt change
What existing pattern does this follow?
Mirrors the existing quality check caching pattern exactly: compute hash → check cache → skip or re-run → report status. Extending it from "per-check" granularity to "per-QA-run" granularity.
What would a senior reviewer challenge?
"Why not just let the existing diff-hash cache handle everything?" → The diff-hash cache only covers automated checks (type-safety, security). AC evaluation is manual/LLM-driven and has no caching today.
"Won't skipping AC re-evaluation miss regressions?" → Safeguards: always re-evaluate not_met ACs, always re-run CI/build, and --no-cache forces full re-run.
"Is the commit SHA in the phase marker reliable?" → It's the HEAD at QA time, which is the correct baseline for "what changed since QA."
Feature Quality Planning
Completeness Check
All AC items have corresponding implementation steps
Backward compatible — old QA comments without commitSHA still work
Test Coverage Plan
Unit tests for phase marker parsing with commitSHA field
Unit tests for QA run context cache get/set
Unit tests for AC skip logic (met → skip, not_met → re-evaluate)
Integration test for incremental diff computation
Edge case: first run (no prior QA), corrupted cache, missing SHA
Best Practices
Logging: Output cache hit/miss reasons for debugging
Security: No new external inputs; commit SHAs from own markers
Documentation: SKILL.md is self-documenting (prompt-layer changes)
Derived ACs
Source
Derived AC
Priority
Error Handling
AC-7: Gracefully fall back to full re-run when prior QA marker lacks commitSHA
High
Error Handling
AC-8: Gracefully fall back to full re-run when cached commit SHA is no longer in git history
Medium
Test Coverage
AC-9: Unit tests for QA run context cache operations
High
Open Questions
Should AC re-evaluation use file-level or diff-level granularity?
Recommendation: Diff-level (any file change triggers AC re-evaluation for non-met ACs). File-to-AC mapping is over-engineering for P3.
Impact: If too coarse, some MET ACs get re-evaluated unnecessarily (minor token cost). If too fine, risk missing regressions.
Should the "incremental summary" replace or supplement the existing QA output?
Recommendation: Supplement — add an "Incremental QA Summary" section at the top, keep full verdict at the bottom.
Impact: If replaced, reviewers lose context on first read. If supplemented, slightly longer output.
Should MET ACs be skippable even when files changed (if changes are unrelated)?
Recommendation: No — if ANY files changed since last QA, re-evaluate all non-met ACs. Skip only MET ACs when zero files changed. This is simple and safe.
Impact: More conservative = more token usage on re-runs, but avoids false skips.
Recommended Workflow
Phases: spec → testgen → exec → qa Quality Loop: enabled (auto-enabled due to scope warning) Reasoning: 6 ACs with Unit Test + Integration Test verification methods warrant test stub generation. Quality loop enabled due to 3-directory spread and the risk of cache/prompt desync.
Label Review
Current: (none) Recommended:enhancement, cli Reason: This is a QA skill enhancement touching CLI scripts and prompt files. No UI components involved. Quality Loop: Auto-enabled due to scope warning (independent of labels).
All 8 AC items (6 original + 2 derived) are MET. Clean implementation extending existing patterns with comprehensive tests. Build passes. All SKILL.md copies synced. Recommend rebase onto main to drop stale #421 commit before merge.
Detect prior QA comments via phase markers on re-run
MET
detectPriorQAFindings() in phase-detection.ts extracts latest QA marker's commitSHA, timestamp, status. 7 unit tests cover: no markers, with/without commitSHA, multiple markers (returns latest), failed markers, empty input.
AC-2
Original
Identify files changed since last QA commit
MET
getChangedFilesSince() in qa-cache.ts + changed-since CLI command. Verified working via smoke test (changed-since HEAD~1 returns correct file list). 3 unit tests.
AC-3
Original
Skip unchanged quality checks if diff hash matches
MET
Existing diff-hash cache handles automated quality checks. Phase 0c in SKILL.md extends skip logic to AC evaluations with clear skip/re-run decision table.
AC-4
Original
Always re-run CI status and build verification
MET
ALWAYS_RERUN_CHECKS constant contains "build". SKILL.md skip table explicitly marks build and CI status as "Never skip".
AC-5
Original
Always re-evaluate NOT_MET/PARTIALLY_MET AC items
MET
Phase 0c AC Re-evaluation Rules: not_met, partially_met, pending, blocked are always re-evaluated. Only met + NO_FILE_CHANGES=true = skip.
AC-6
Original
Output clearly indicates skipped vs re-run
MET
Incremental QA Summary table in output template with Status/Re-run?/Reason columns. Summary line shows "X cached, Y re-evaluated, Z always-fresh".
Derived ACs
AC-7
Derived (Error Handling)
Fall back to full QA when commitSHA missing/invalid
MET
SKILL.md validates SHA with git cat-file -t; falls through to INCREMENTAL_MODE=false. TypeScript computeIncrementalDiffHash() and getChangedFilesSince() return null for invalid SHA. Unit tested.
AC-8
Derived (Error Handling)
--no-cache forces full re-run
MET
SKILL.md sets INCREMENTAL_MODE=false when --no-cache is passed. clearAll() also clears runContext.
Coverage: 8/8 AC items fully met Original ACs: 6/6 met Derived ACs: 2/2 met
Quality Plan Verification
Quality Plan found: Yes
Dimension
Items Planned
Items Addressed
Status
Completeness
5
5
✅ Complete
Error Handling
4
4
✅ Complete
Code Quality
4
4
✅ Complete
Test Coverage
5
5
✅ Complete
Best Practices
3
3
✅ Complete
Polish
N/A
N/A
- (not UI feature)
Derived ACs: 2/2 addressed (AC-7, AC-8 from Error Handling) Quality Plan Status: Complete
Incremental QA Summary
Last QA: 2026-03-25T08:15:00Z (commit: 76bfee2) Changes since last QA: 0 files
Coverage: 4/4 changed source files have corresponding tests Critical paths without tests: None
Code Review
Strengths:
Clean extension of existing patterns (QACacheSchema, PhaseMarkerSchema)
QARunContextSchema uses Zod for runtime validation — consistent with codebase
ALWAYS_RERUN_CHECKS as a named constant follows the existing CHECK_INVALIDATION_PATTERNS pattern
Backward compatible: commitSHA is optional in PhaseMarkerSchema, runContext is optional in QACacheSchema
clearAll() correctly clears runContext — no stale state after cache clear
SKILL.md changes are well-structured with clear decision tables
All three SKILL.md copies are in sync
Issues:
Low severity:computeIncrementalDiffHash() and getChangedFilesSince() use execSync with string interpolation (${sinceCommit}). The input comes from local cache (user-controlled) and is validated with git cat-file -t in SKILL.md before use, but the TypeScript methods themselves don't validate the SHA format. This follows the existing pattern in the file (lines 213, 295, 325 use hardcoded strings), so the new code is the first to accept dynamic input. Risk is minimal since this is a local dev tool, but a SHA format regex check would add defense-in-depth.
Suggestions:
Consider adding a SHA format validation (e.g., /^[a-f0-9]{4,40}$/) in the TypeScript methods as defense-in-depth. Not blocking.
Test Quality Review
Category
Status
Notes
Behavior vs Implementation
✅ OK
Tests assert on outputs (return values, exit codes), not internals
Verified working: Yes — executed all new CLI commands, verified roundtrip data integrity, confirmed tests pass (104/104)
Test efficacy: High — unit tests cover core logic (run context CRUD, incremental diff, prior QA detection), edge cases (invalid SHA, empty cache, overwrite)
Likely failure mode: If a user's cache file becomes corrupt between runs, getRunContext() could return unexpected data. Mitigated by Zod schema validation in QACacheSchema and graceful fallback to full re-run in SKILL.md.
Verdict confidence: High — clean extension of existing patterns, comprehensive test coverage, all CLI commands verified working
Verdict: READY_FOR_MERGE
All 8 AC items (6 original + 2 derived) are MET. Implementation cleanly extends existing cache and phase-detection patterns. Comprehensive unit tests (163 new lines in qa-cache.test.ts, 127 in phase-detection.test.ts). All SKILL.md copies synced. Build passes. CI passes (2 failures are pre-existing on main). CLI commands verified via smoke tests.
One minor suggestion (non-blocking): Add SHA format validation in computeIncrementalDiffHash() and getChangedFilesSince() for defense-in-depth against command injection via corrupted cache.
Documentation
CHANGELOG entry added (for user-facing changes)
N/A — No README/docs changes needed (internal optimization)
Activity
admarble commentedon Mar 25, 2026
Spec Plan — QA Re-Run Optimization (#377)
Acceptance Criteria
--no-cacheflag forces full re-run regardless of prior QA findings (derived)Verification Methods Summary
Assumptions
SEQUANT_PHASEmarkers--no-cacheflag already exists and disables cache (confirmed)QACachediff hash logic is correct and reusableImplementation Plan
Phase 1: Extend cache metadata
lastQACommitShafield toQACacheSchemainsrc/lib/workflow/qa-cache.tssetLastQACommit(sha)andgetLastQACommit()methodscomputeIncrementalDiffHash(sinceCommit)method (diff since last QA, not since main)Phase 2: Prior QA detection
4. Create
detectPriorQAFindings(issueNumber)helper — parses issue comments for QA phase markers, extracts commit SHA and prior AC statuses5. Add
ALWAYS_RERUN_CHECKSconstant (["build"]) — checks that bypass cache on re-runPhase 3: Update QA skill prompt
6. Add re-run detection flow to
.claude/skills/qa/SKILL.mdbefore quality agent spawning7. Update
.claude/skills/qa/scripts/quality-checks.shwith--since-commitflag support8. Sync
skills/qa/templatesPhase 4: Output formatting
9. Enhance
print_cache_status()to distinguish skipped/re-ran/always-re-run with reason columnDesign Decisions
ALWAYS_RERUN_CHECKSis a constant — Follows existingCHECK_INVALIDATION_PATTERNSpattern. Easy to extend.Open Questions
Non-Goals
Recommended Workflow
Phases: spec → testgen → exec → qa
Quality Loop: enabled (auto-enabled due to scope — 6 AC items, 3 directories)
admarble commentedon Mar 25, 2026
Spec Plan: QA Skill Incremental Re-Runs (#377)
AC Quality Check
→ Partially covered: Quality checks already have diff-hash caching via
qa-cache.ts. The new work is extending this to AC evaluations and code review findings.→ Suggest: Clarify that "quality checks" here means both automated checks (already cached) AND manual AC evaluation (not cached).
→ Note: State schema uses
not_metonly (nopartially_met). SKILL.md maps PARTIALLY_MET →not_metwith notes. AC will be evaluated againstnot_metstatus.✅ AC-1, AC-2, AC-4, AC-6: Clear and testable
Summary: 2/6 AC items flagged for review (clarification, not blockers)
Scope Assessment
Non-Goals (Required)
--no-cachebehaviorScope Metrics
src/lib/workflow/,.claude/skills/qa/,scripts/qa/)Scope Verdict
Acceptance Criteria
AC-1: Detect prior QA comments via phase markers on re-run
Verification Method: Unit Test
Test Scenario:
<!-- SEQUANT_PHASE: {"phase":"qa","status":"completed",...} -->lastQACommitSHAandlastQATimestampare extractedIntegration Points:
src/lib/workflow/phase-detection.ts— existingparsePhaseMarkers()/detectPhaseFromComments()gh issue viewAssumptions to Validate:
AC-2: Identify files changed since last QA commit
Verification Method: Integration Test
Test Scenario:
abc123, HEAD is nowdef456git diff abc123...HEAD --name-onlyis executedIntegration Points:
src/lib/workflow/qa-cache.ts—computeDiffHash()already computes diff vs mainAssumptions to Validate:
AC-3: Skip unchanged quality checks if diff hash matches
Verification Method: Unit Test
Test Scenario:
type-safetycheck withdiffHash: "abc123", current diff hash is still"abc123"type-safetycheck returns cache HIT, is skippedNote: This is already implemented for automated quality checks via
qa-cache.ts. The incremental work is:qa-runcache entry type that stores the overall QA context (commit SHA, AC statuses)AC-4: Always re-run CI status and build verification
Verification Method: Unit Test
Test Scenario:
Integration Points:
.claude/skills/qa/scripts/quality-checks.sh— scope/size already skip cacheAC-5: Always re-evaluate NOT_MET or PARTIALLY_MET AC items
Verification Method: Unit Test
Test Scenario:
met, AC-2=not_met, AC-3=metin statenot_met), AC-1 and AC-3 could be skipped if no relevant changesIntegration Points:
src/lib/workflow/state-manager.ts—getAcceptanceCriteria()reads prior AC statusesmetACs when diff is unchangedAC-6: Output clearly indicates skipped vs re-run checks
Verification Method: Manual Test + Integration Test
Test Scenario:
Implementation Plan
Phase 1: Extend Phase Marker with Commit SHA (Foundation)
PhaseMarkerSchemainsrc/lib/workflow/phase-detection.tsto include optionalcommitSHAfieldcommitSHA: HEADin the phase marker when posting QA resultsparseLastQAContext()helper that extracts the most recent QA phase marker's commit SHA and timestamp from issue commentsPhase 2: Extend QA Cache with Run Context
qa-runentry type toqa-cache.ts— a new cache entry that stores:lastQACommitSHA: HEAD at time of QAlastQADiffHash: diff hash at time of QAacStatuses: map of AC ID → status from last runtimestamp: when last QA completedscripts/qa/qa-cache-cli.ts:set-run-contextandget-run-contextPhase 3: Implement Skip Logic in SKILL.md
commitSHAfrom last QA markergit diff <lastQACommitSHA>...HEAD --name-onlyto get incremental changesmet: skip unless files changed since last QAnot_met: always re-evaluatepending/blocked: always re-evaluatePhase 4: Output Formatting
Parallel Groups
Steps 1-2 can be done in parallel (schema + cache are independent).
Steps 3-5 depend on 1-2.
Steps 6-7 depend on 3-5.
Step 8 can be done alongside 6-7.
Design Review
Where does this logic belong?
src/lib/workflow/phase-detection.ts(schema layer)src/lib/workflow/qa-cache.ts(cache layer, extends existing).claude/skills/qa/SKILL.md(prompt layer, where QA decisions are made).claude/skills/qa/SKILL.md(prompt layer)What's the simplest correct approach?
Store the commit SHA in the phase marker (already emitted) and prior AC statuses in the QA cache (already has infrastructure). The QA skill prompt then reads both, computes incremental diff, and decides what to skip. No new TypeScript modules needed — just extending existing ones.
Rejected alternatives:
What existing pattern does this follow?
Mirrors the existing quality check caching pattern exactly: compute hash → check cache → skip or re-run → report status. Extending it from "per-check" granularity to "per-QA-run" granularity.
What would a senior reviewer challenge?
not_metACs, always re-run CI/build, and--no-cacheforces full re-run.Feature Quality Planning
Completeness Check
Error Handling
Code Quality
Test Coverage Plan
Best Practices
Derived ACs
Open Questions
Should AC re-evaluation use file-level or diff-level granularity?
Should the "incremental summary" replace or supplement the existing QA output?
Should MET ACs be skippable even when files changed (if changes are unrelated)?
Recommended Workflow
Phases: spec → testgen → exec → qa
Quality Loop: enabled (auto-enabled due to scope warning)
Reasoning: 6 ACs with Unit Test + Integration Test verification methods warrant test stub generation. Quality loop enabled due to 3-directory spread and the risk of cache/prompt desync.
Label Review
Current: (none)
Recommended:
enhancement,cliReason: This is a QA skill enhancement touching CLI scripts and prompt files. No UI components involved.
Quality Loop: Auto-enabled due to scope warning (independent of labels).
→
gh issue edit 377 --add-label enhancement --add-label cliAssumptions Checklist
--no-cacheflag should clear QA run context too (not just quality check cache)Next: Confirm plan, then
/exec 377feat(#377): optimize QA skill re-runs by diffing against prior findings
admarble commentedon Mar 25, 2026
Exec Phase Complete — #377
AC Coverage
detectPriorQAFindings()inphase-detection.tsgetChangedFilesSince()+changed-sinceCLIALWAYS_RERUN_CHECKSconstant--no-cacheforces full re-runINCREMENTAL_MODE=falseKey Files Changed
src/lib/workflow/state-schema.ts— AddedcommitSHAtoPhaseMarkerSchemasrc/lib/workflow/qa-cache.ts— AddedQARunContext,ALWAYS_RERUN_CHECKS, run context methods, incremental diff methodssrc/lib/workflow/phase-detection.ts— AddeddetectPriorQAFindings()helperscripts/qa/qa-cache-cli.ts— Addedset-run-context,get-run-context,changed-sincecommands.claude/skills/qa/SKILL.md— Added Phase 0c, updated marker emission, added output templateskills/qa/SKILL.md,templates/skills/qa/SKILL.md— Synced copiesQuality
PR
#432
admarble commentedon Mar 25, 2026
QA Review for Issue #377
AC Coverage
detectPriorQAFindings()inphase-detection.tsextracts latest QA marker commitSHA, timestamp, statusgetChangedFilesSince()inqa-cache.ts+changed-sinceCLI commandALWAYS_RERUN_CHECKSconstant + SKILL.md skip table marks build/CI as never-skipCoverage: 8/8 AC items fully met
Quality Metrics
Verdict: READY_FOR_MERGE
All 8 AC items (6 original + 2 derived) are MET. Clean implementation extending existing patterns with comprehensive tests. Build passes. All SKILL.md copies synced. Recommend rebase onto main to drop stale #421 commit before merge.
admarble commentedon Mar 25, 2026
QA Review for Issue #377 (Re-run)
AC Coverage
detectPriorQAFindings()inphase-detection.tsextracts latest QA marker's commitSHA, timestamp, status. 7 unit tests cover: no markers, with/without commitSHA, multiple markers (returns latest), failed markers, empty input.getChangedFilesSince()inqa-cache.ts+changed-sinceCLI command. Verified working via smoke test (changed-since HEAD~1returns correct file list). 3 unit tests.ALWAYS_RERUN_CHECKSconstant contains"build". SKILL.md skip table explicitly marks build and CI status as "Never skip".not_met,partially_met,pending,blockedare always re-evaluated. Onlymet+NO_FILE_CHANGES=true= skip.git cat-file -t; falls through toINCREMENTAL_MODE=false. TypeScriptcomputeIncrementalDiffHash()andgetChangedFilesSince()return null for invalid SHA. Unit tested.--no-cacheforces full re-runINCREMENTAL_MODE=falsewhen--no-cacheis passed.clearAll()also clearsrunContext.Coverage: 8/8 AC items fully met
Original ACs: 6/6 met
Derived ACs: 2/2 met
Quality Plan Verification
Quality Plan found: Yes
Derived ACs: 2/2 addressed (AC-7, AC-8 from Error Handling)
Quality Plan Status: Complete
Incremental QA Summary
Last QA: 2026-03-25T08:15:00Z (commit: 76bfee2)
Changes since last QA: 0 files
Summary: 0 checks cached, 8 re-evaluated, 3 always-fresh
CI Status
build (20.x)build (22.x)typecheckvalidate-skillsvalidate-pluginPlugin Structure ValidationHooks ValidationCI Summary: 5 passed, 2 failed (pre-existing)
CI-related AC items: None
Quality Metrics
any)Test Coverage Analysis
src/lib/workflow/qa-cache.tssrc/lib/workflow/qa-cache.test.tssrc/lib/workflow/phase-detection.tssrc/lib/workflow/phase-detection.test.tssrc/lib/workflow/state-schema.tsscripts/qa/qa-cache-cli.ts.claude/skills/qa/SKILL.mdskills/qa/SKILL.mdtemplates/skills/qa/SKILL.mdCoverage: 4/4 changed source files have corresponding tests
Critical paths without tests: None
Code Review
Strengths:
QACacheSchema,PhaseMarkerSchema)QARunContextSchemauses Zod for runtime validation — consistent with codebaseALWAYS_RERUN_CHECKSas a named constant follows the existingCHECK_INVALIDATION_PATTERNSpatterncommitSHAis optional inPhaseMarkerSchema,runContextis optional inQACacheSchemaclearAll()correctly clearsrunContext— no stale state after cache clearIssues:
computeIncrementalDiffHash()andgetChangedFilesSince()useexecSyncwith string interpolation (${sinceCommit}). The input comes from local cache (user-controlled) and is validated withgit cat-file -tin SKILL.md before use, but the TypeScript methods themselves don't validate the SHA format. This follows the existing pattern in the file (lines 213, 295, 325 use hardcoded strings), so the new code is the first to accept dynamic input. Risk is minimal since this is a local dev tool, but a SHA format regex check would add defense-in-depth.Suggestions:
/^[a-f0-9]{4,40}$/) in the TypeScript methods as defense-in-depth. Not blocking.Test Quality Review
execSyncis mocked for git commands — appropriate boundaryAnti-Pattern Detection
Dependency Audit
N/A — No dependency changes
Code Patterns
No anti-patterns detected in changed files.
Execution Evidence
qa-cache-cli.ts helpqa-cache-cli.ts get-run-contextset-run-contextthenget-run-contextqa-cache-cli.ts changed-since HEAD~1Evidence status: Complete
Skill Command Verification
Skill files changed: 3 (
.claude/skills/qa/SKILL.md,skills/qa/SKILL.md,templates/skills/qa/SKILL.md).claude/skills/qa/SKILL.mdCommands Verified:
npx tsx scripts/qa/qa-cache-cli.ts get-run-context→ ✅ Works (exit 1 when empty, 0 when data exists)npx tsx scripts/qa/qa-cache-cli.ts changed-since <sha>→ ✅ Works (returns file list or "NO_CHANGES")npx tsx scripts/qa/qa-cache-cli.ts set-run-context→ ✅ Works (reads JSON from stdin)npx tsx scripts/qa/qa-cache-cli.ts hash→ ✅ Works (returns diff hash)Verification Status: Passed
Skill Change Review
QARunContextSchema(lastQACommitSHA, lastQADiffHash, acStatuses, timestamp)npx tsx,git,jq(for SKILL.md bash snippets) — all standard dev toolsSmoke Test
set-run-context+get-run-contextget-run-contextchanged-since HEAD~1changed-since(no SHA)Smoke Test Status: Complete
CHANGELOG Verification
Result: CHANGELOG requirements met
Self-Evaluation
getRunContext()could return unexpected data. Mitigated by Zod schema validation inQACacheSchemaand graceful fallback to full re-run in SKILL.md.Verdict: READY_FOR_MERGE
All 8 AC items (6 original + 2 derived) are MET. Implementation cleanly extends existing cache and phase-detection patterns. Comprehensive unit tests (163 new lines in qa-cache.test.ts, 127 in phase-detection.test.ts). All SKILL.md copies synced. Build passes. CI passes (2 failures are pre-existing on main). CLI commands verified via smoke tests.
One minor suggestion (non-blocking): Add SHA format validation in
computeIncrementalDiffHash()andgetChangedFilesSince()for defense-in-depth against command injection via corrupted cache.Documentation
Next Steps
QA performed on commit 76bfee2 | Build: ✅ | Tests: 104/104 ✅ | CI: 5/5 core checks pass
admarble commentedon Mar 25, 2026
<!-- SEQUANT_PHASE: {"phase":"qa","status":"completed","timestamp":"2026-03-25T08:19:01.000Z","commitSHA":"76bfee21e33793d8198b908077bb33e8d048f882"} -->
feat(#377): optimize QA skill re-runs by diffing against prior findin…
admarble commentedon Mar 25, 2026
Documentation Generated
File:
docs/features/qa-incremental-rerun.mdSections Included:
--no-cacheforce, cache inspection commandsset-run-context,get-run-context,changed-sinceNext Steps:
Ready to merge!
docs: generate feature docs for #377 and #378