Skip to content

fix(exec): Add pre-PR lint validation to catch CI failures early #250

Closed

Description

@admarble

Summary

Add npm run lint validation before PR creation in /exec to catch lint errors that would fail CI.

Problem

Issue #239 failed 3 quality loop iterations because lint errors weren't caught until CI ran:

✓ exec (16m 33s)
✗ qa: QA verdict: AC_NOT_MET  # CI failed due to lint
✗ loop: Claude Code process exited with code 1
[repeats 3x]

Root cause: Two unused imports caused eslint --max-warnings 0 to fail:

  • src/lib/scope/index.ts:31 - unused re-export
  • src/lib/workflow/state-schema.ts:22 - unused type import

These could have been caught locally before pushing the PR.

Proposed Solution

Add lint check to /exec pre-PR validation:

### Pre-PR Quality Gates (REQUIRED)

Before creating PR, run ALL checks:

1. `npm run build` - TypeScript compilation
2. `npm run lint` - ESLint validation  # <-- ADD
3. `npm test` - Run relevant tests

If any check fails, fix before creating PR.

Acceptance Criteria

  • AC-1: /exec SKILL.md includes npm run lint in pre-PR checks
  • AC-2: Lint check runs after build, before tests
  • AC-3: If lint fails, /exec fixes issues before PR creation
  • AC-4: Works with projects that don't have lint script (graceful skip)

Impact

Metric Before After
Lint failures caught At CI (post-PR) Locally (pre-PR)
Loop iterations wasted 3 0
Time to fix ~30 min (3 loops) ~1 min

Implementation

Single change to .claude/skills/exec/SKILL.md - add lint to pre-PR checklist.

Related


Identified from #239 post-mortem

Activity

  1. added
    enhancement
    on Feb 3, 2026
  2. admarble commented on Feb 4, 2026

    @admarble
    ContributorAuthor

    📋 Spec Review Complete

    Acceptance Criteria Checklist

    AC Description Verification Status
    AC-1 /exec SKILL.md includes npm run lint in pre-PR checks Manual: Read Section 3 ⏳ Pending
    AC-2 Lint check runs after build, before tests Manual: Verify ordering ⏳ Pending
    AC-3 If lint fails, /exec fixes issues before PR creation Manual: Read failure handling ⏳ Pending
    AC-4 Works with projects without lint script (graceful skip) Manual: Verify skip logic ⏳ Pending

    Derived ACs

    AC Description Priority
    AC-5 Update allowed-tools YAML to include npm run lint High
    AC-6 Add lint results to progress summary format Medium

    Implementation Plan

    Phase 1: Update allowed-tools (line 15-18)

    • Add Bash(npm run lint:*) to YAML block

    Phase 2: Update Section 3 - Checks-first Mindset (lines 792-799)

    • Add npm run lint to checks list with graceful skip

    Phase 3: Add Section 3d - Lint Check (new section, after line 922)

    • Mirror Section 3c pattern
    • Include graceful skip logic for projects without lint script
    • Document fix-before-PR behavior

    Phase 4: Update Implementation Loop (line 930)

    • Add lint to post-change check sequence

    Phase 5: Update Output Verification (line 1346)

    • Add lint results to required output checklist

    Files to Modify

    File Changes
    .claude/skills/exec/SKILL.md 5 locations: allowed-tools, Section 3, new Section 3d, Implementation Loop, Output Verification

    Open Questions

    1. Should lint auto-fix? → No - report only, let developer review
    2. Lint ordering? → After build, before tests (per AC-2)

    Non-Goals (Suggested)

    • Add lint auto-fix (--fix flag)
    • Add other checks (prettier, typecheck)
    • Modify CI lint configuration

    Recommended Workflow

    spec ✅ → exec → qa
    

    Quality Loop: enabled (scope warning due to title)


    Ready for implementation via /exec 250

  3. added
    planned
    documentation
    on Feb 4, 2026
  4. added a commit that references this issue on Feb 4, 2026
    9248ef0
  5. admarble commented on Feb 4, 2026

    @admarble
    ContributorAuthor

    🚀 Implementation Complete

    AC Coverage Summary

    AC Description Status Evidence
    AC-1 SKILL.md includes npm run lint in pre-PR checks ✅ Implemented Section 3 "Pre-PR Quality Gates"
    AC-2 Lint runs after build, before tests ✅ Implemented Order: 1. build, 2. lint, 3. test
    AC-3 If lint fails, fix before PR creation ✅ Implemented Section 3d "If lint fails" instructions
    AC-4 Graceful skip for projects without lint ✅ Implemented Section 3d "Graceful Skip Logic" table
    AC-5 (Derived) Update allowed-tools YAML ✅ Implemented Line 18: Bash(npm run lint:*)
    AC-6 (Derived) Add lint results to progress summary ✅ Implemented Section 3d + Output Verification

    Files Changed

    File Changes
    .claude/skills/exec/SKILL.md +105/-5 lines

    Quality Checks

    Check Status
    npm run build ✅ Passed
    npm run lint ✅ Passed (0 errors, 0 warnings)
    npm test ✅ Passed (1159 tests)

    Test Coverage Analysis

    Changed File Tier Has Tests?
    .claude/skills/exec/SKILL.md Optional - (docs only)

    Coverage: N/A - documentation-only change

    Quality Plan Alignment

    N/A - No quality plan in issue (spec was for documentation change)

    PR Status

    ✅ Created: #253

    Key Implementation Details

    1. Pre-PR Quality Gates - Added explicit ordering: build → lint → test
    2. New Section 3d - Comprehensive lint check guidance with:
      • Graceful skip logic for projects without lint script
      • Common lint error fixes (unused imports, variables)
      • Auto-fix considerations (safe vs. cautious vs. avoid)
      • Progress summary format for lint results
    3. Implementation Loop - Updated to include lint after build
    4. Output Verification - Updated checklist to require lint results

    Ready for /qa review

  6. admarble commented on Feb 4, 2026

    @admarble
    ContributorAuthor

    🔍 QA Review Complete

    Verdict: ✅ READY_FOR_MERGE

    All acceptance criteria verified and met:

    AC Description Status
    AC-1 SKILL.md includes npm run lint in pre-PR checks ✅ MET
    AC-2 Lint runs after build, before tests ✅ MET
    AC-3 If lint fails, fix before PR creation ✅ MET
    AC-4 Graceful skip for projects without lint ✅ MET
    AC-5 Update allowed-tools YAML ✅ MET
    AC-6 Add lint results to progress summary ✅ MET

    Quality Checks

    Check Status
    CI (6 checks) ✅ All passing
    Type safety ✅ 0 issues
    Deleted tests ✅ 0
    Security scan ✅ PASS
    Skill commands verified ✅ All work

    Code Review Summary

    Strengths:

    • Well-structured Section 3d follows existing patterns
    • Comprehensive graceful skip logic (4 scenarios)
    • Clear fix-before-PR guidance
    • Progress summary templates included

    Issues: None

    Next Steps

    1. Merge PR fix(#250): Add pre-PR lint validation to catch CI failures early #253
    2. Close this issue

    QA via /qa 250

  7. added
    ready-for-review
    on Feb 4, 2026
  8. admarble commented on Feb 4, 2026

    @admarble
    ContributorAuthor

    🔍 QA Review Complete (Final)

    Verdict: ✅ READY_FOR_MERGE

    All acceptance criteria verified and met:

    AC Description Status Evidence
    AC-1 SKILL.md includes npm run lint in pre-PR checks ✅ MET Lines 805-806
    AC-2 Lint runs after build, before tests ✅ MET Order: 1. build, 2. lint, 3. test
    AC-3 If lint fails, fix before PR creation ✅ MET Section 3d lines 983-993
    AC-4 Graceful skip for projects without lint ✅ MET Lines 960-969 (4 scenarios)
    AC-5 Update allowed-tools YAML ✅ MET Line 18: Bash(npm run lint:*)
    AC-6 Add lint results to progress summary ✅ MET Lines 1002-1020

    Quality Checks

    Check Status
    CI (6 checks) ✅ All passing
    Type safety ✅ 0 any issues
    Deleted tests ✅ 0
    npm run build ✅ Passed
    npm run lint ✅ Passed
    npm test ✅ 1159 tests passed
    Skill commands verified ✅ All work

    Code Review Summary

    Strengths:

    • Well-structured Section 3d follows existing patterns (mirrors 3c Shell Script Checks)
    • Comprehensive graceful skip logic (4 scenarios: pass, fail, no script, timeout)
    • Clear fix-before-PR guidance with common error fixes
    • Thoughtful auto-fix safety tiers (safe, caution, avoid)
    • Progress summary templates included

    Issues: None

    Self-Evaluation

    • Verified working: Yes - executed all npm commands, verified grep patterns
    • Test efficacy: N/A - documentation change
    • Verdict confidence: High

    QA via /qa 250 - ready to merge

  9. added a commit that references this issue on Feb 4, 2026
    f11d55b
  10. admarble commented on Feb 4, 2026

    @admarble
    ContributorAuthor

    🧪 Smoke Test Results

    Post-merge verification of the lint integration:

    Pre-PR Quality Gates

    Step Command Result
    1. Build npm run build ✅ Passed
    2. Lint npm run lint ✅ Passed (0 errors, 0 warnings)
    3. Test npm test ✅ Passed (1178 tests)

    Graceful Skip Logic (AC-4)

    Scenario Result
    Lint script detection ✅ npm run --list | grep lint works
    No lint script ✅ Correctly outputs "No lint script in package.json - skipping"
    Lint timeout ⏭️ Not tested (defensive edge case)

    Lint Error Detection

    Created temp file with unused import in src/:

    import { StateManager } from './lib/workflow/state-manager.js';
    export const testValue = 'hello';

    Result:

    src/__test-lint-error.ts
      1:10  warning  'StateManager' is defined but never used
    
    ✖ 1 problem (0 errors, 1 warning)
    ESLint found too many warnings (maximum: 0).
    

    ✅ Lint correctly caught unused import and failed with --max-warnings 0

    Smoke Test Verdict: ✅ PASSED

    The /exec lint integration works as designed:

    • Detects lint script presence
    • Runs in correct order (build → lint → test)
    • Catches lint errors before they reach CI
    • Gracefully skips when no lint script exists

    Smoke test via /qa 250

  11. added a commit that references this issue on Feb 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

    documentationenhancementplannedready-for-review

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions