Skip to content

feat: Add call-site review check to QA skill for new functions #299

Closed

Description

@admarble

Problem

When a new function is added and tested in isolation, QA may miss issues at the call site — where and under what conditions the function is invoked. Issue #295 added rebaseBeforePR() with thorough unit tests, but the function was called for every issue in a chain loop when the AC specified "only the final branch." The unit tests for the function itself all passed; the bug was in the calling context.

How it was caught

The QA agent team identified the gap by reading the loop in runIssueWithLogging and noticing no chainMode guard existed. The initial QA pass (by the lead) missed it because the function-level review looked correct.

Root cause

QA currently reviews:

  • The new function's implementation (correctness, types, patterns)
  • The new function's tests (coverage, quality)

But does not systematically review:

  • Where the function is called
  • Under what conditions (loop iteration, mode flags, error state)
  • Whether the call-site conditions match the AC constraints

Proposed Solution

Add a call-site review prompt to the QA skill that triggers when new exported functions are added.

Detection

# Find new exported functions in the diff
git diff main...HEAD | grep -E '^\+export (async )?function \w+' | sed 's/+//'

QA prompt additions

When new exported functions are detected, the QA review should include:

  1. Call-site inventory: "Where is newFunction() called? List all call sites."
  2. Condition audit: "What conditions gate the call? Do they match the AC constraints?"
  3. Loop awareness: "Is it called inside a loop? Should it run for every iteration or only specific ones?"
  4. Mode sensitivity: "Does the function behave differently based on mode/flags? Are all modes handled at the call site?"

Output format

### Call-Site Review

| Function | Call Sites | Conditions | AC Match |
|----------|-----------|------------|----------|
| `rebaseBeforePR()` | `run.ts:2977` | `success && worktreePath && !noRebase` | ⚠️ Missing chain mode guard (AC-2 says "final branch only") |

Acceptance Criteria

  • AC-1: QA skill detects new exported functions in the diff
  • AC-2: For each new function, QA identifies all call sites in the codebase
  • AC-3: Call-site conditions are listed and compared against AC constraints
  • AC-4: Functions called inside loops are flagged for iteration-scope review
  • AC-5: Findings are included in QA output under "Call-Site Review" section

Context

Activity

  1. added
    enhancement
    qa
    on Feb 19, 2026
  2. added a commit that references this issue on Feb 20, 2026
  3. admarble commented on Feb 20, 2026

    @admarble
    ContributorAuthor

    Implementation Progress Update

    AC Coverage

    AC Description Status Evidence
    AC-1 QA skill detects new exported functions in the diff ✅ Implemented Detection script in SKILL.md Section 2f
    AC-2 For each new function, QA identifies all call sites ✅ Implemented Call-site inventory loop using grep
    AC-3 Call-site conditions listed and compared against AC constraints ✅ Implemented Condition audit table + AC comparison guidance
    AC-4 Functions called inside loops flagged for iteration-scope review ✅ Implemented Loop detection with -B 5 context grep
    AC-5 Findings included in QA output under "Call-Site Review" section ✅ Implemented Output template + verification checklist updated

    Files Changed

    • .claude/skills/qa/SKILL.md - Added Section 2f: Call-Site Review (114 lines)
    • .claude/skills/qa/references/call-site-review.md - New reference doc (211 lines)

    Quality Checks

    Check Status
    npm run build ✅ Passed
    npm run lint ✅ Passed
    npm test ✅ 1333/1334 passed (1 unrelated timeout)

    PR Created

    PR #311: #311

    Implementation Highlights

    1. Detection: Uses git diff main...HEAD | grep -E '^\+export (async )?function \w+' to find new exported functions
    2. Call-site inventory: For each function, finds all non-test call sites with grep -rn
    3. Condition audit: Documents guards at each call site and compares against AC constraints
    4. Loop awareness: Uses -B 5 context to detect if call is inside a loop
    5. Verdict integration: Missing guards → AC_NOT_MET, unused exports → AC_MET_BUT_NOT_A_PLUS

    Reference Documentation

    Created call-site-review.md with:

    Next Steps

    1. QA review via /qa 299
    2. Merge after approval

  4. admarble commented on Feb 20, 2026

    @admarble
    ContributorAuthor

    QA Review for Issue #299

    AC Coverage

    AC Source Description Status Notes
    AC-1 Original QA skill detects new exported functions in the diff MET Detection script implemented in SKILL.md:824-833 using grep -E '^\+export (async )?function \w+'
    AC-2 Original For each new function, QA identifies all call sites in the codebase MET Call-site inventory loop in SKILL.md:838-848 using grep -rn with exclude patterns for tests
    AC-3 Original Call-site conditions are listed and compared against AC constraints MET Condition audit in SKILL.md:852-871 with AC constraint comparison table
    AC-4 Original Functions called inside loops are flagged for iteration-scope review MET Loop detection in SKILL.md:875-895 using -B 5 context grep for loop keywords
    AC-5 Original Findings included in QA output under "Call-Site Review" section MET Output template updated in SKILL.md:1655-1673 and verification checklist at line 1477

    Coverage: 5/5 AC items fully met
    Original ACs: 5/5 met


    CI Status

    Check State Conclusion Impact
    build (18.x) COMPLETED SUCCESS ✅ MET
    build (20.x) COMPLETED SUCCESS ✅ MET
    build (22.x) COMPLETED SUCCESS ✅ MET
    validate-skills COMPLETED SUCCESS ✅ MET
    typecheck COMPLETED SUCCESS ✅ MET
    validate-plugin COMPLETED SUCCESS ✅ MET

    CI Summary: 6 passed, 0 pending, 0 failed


    Quality Metrics

    Metric Value Status
    Type issues (any) 0 OK
    Deleted tests 0 OK
    Files changed 2 OK
    Lines added +325 -
    Lines deleted -0 -

    Code Review

    Strengths:

    • Clear, well-structured implementation following existing skill patterns
    • Comprehensive detection script for new exported functions
    • Detailed condition audit table with AC constraint comparison
    • Loop awareness with specific iteration-scope review guidance
    • Real example from Issue fix: Rebase worktrees onto main before PR to prevent lockfile drift #295 (rebaseBeforePR) included for context
    • Output format template properly integrated into both main skill and references
    • Verification checklist updated to include Call-Site Review

    Issues: None identified


    Skill Command Verification

    Skill files changed: 2

    File Commands Found Verification Status
    .claude/skills/qa/SKILL.md 5 ✅ Passed
    .claude/skills/qa/references/call-site-review.md 3 ✅ Passed

    Commands Verified:

    • git diff main...HEAD | grep -E ... → ✅ Works correctly
    • grep -rn "functionName(" --include="*.ts" → ✅ Works correctly
    • grep -rn "functionName(" -B 5 | grep -E "(for|while|...)" → ✅ Works correctly

    Verification Status: Passed


    Self-Evaluation

    • Verified working: Yes - Executed all bash commands and verified they work correctly
    • Test efficacy: N/A - Skill documentation changes
    • Likely failure mode: grep pattern not matching unusual export syntax (re-exports, arrow functions)
    • Verdict confidence: High - Implementation matches all AC requirements exactly

    Verdict: READY_FOR_MERGE

    All 5 acceptance criteria are fully met. The implementation:

    1. Detects new exported functions with robust grep pattern (AC-1)
    2. Inventories call sites with exclude patterns for test files (AC-2)
    3. Documents conditions with AC constraint comparison (AC-3)
    4. Flags loop iterations with context-aware detection (AC-4)
    5. Updates output template and verification checklist (AC-5)

    All CI checks pass. Commands verified to work correctly. Clean implementation following existing skill patterns.

    Next Steps

    1. Merge PR feat(#299): add call-site review check to QA skill for new functions #311

  5. added
    ready-for-review
    on Feb 20, 2026
  6. admarble commented on Feb 22, 2026

    @admarble
    ContributorAuthor

    Merged via feat(#299). Call-site review check added to QA skill.

  7. added 3 commits that reference this issue on Feb 22, 2026
  8. admarble commented on Feb 22, 2026

    @admarble
    ContributorAuthor

    Documentation Review Complete

    This issue contains documentation-only changes. No additional documentation generation required.

    Files Modified:

    • .claude/skills/qa/SKILL.md — Added section 2f: Call-Site Review
    • .claude/skills/qa/references/call-site-review.md — New reference doc with methodology and examples

    Status:

    ✅ Documentation changes are ready for review and merge.


    Ready to merge!

  9. added a commit that references this issue on Mar 4, 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

    enhancementqaready-for-review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions