Skip to content

[PHASE 2] Enhance Reviewer File Analysis (High-Risk Categories) #604

Closed

Description

@ashleyshaw

Problem

Reviewer only detects src/ and code files. Misses high-risk changes like configuration, workflows, security files, and database migrations.

Acceptance Criteria

  • Categorizes files by risk level: critical, high, medium, low
  • Identifies high-risk categories:
    • Configuration: .github/, package*.json, composer.json, .env*, config/, \.github/
    • Workflows: .github/workflows/*
    • Security: SECURITY.md, LICENSE, security-related code
    • Database: migrations, schema files
    • Lock files: package-lock.json, composer.lock (with major version indicators)
  • Summary reports: "X critical, Y high-risk, Z medium-risk, W low-risk files"
  • Reviewer comment includes breakdown by category
  • Tests verify categorization logic

Implementation Plan

1. Add File Categorizer

function categorizeFile(filename) {
  // Returns: { category, riskLevel }
  // category: 'configuration'|'workflow'|'security'|'database'|'source'|'test'|'docs'|'other'
  // riskLevel: 'critical'|'high'|'medium'|'low'
}

2. Define Risk Categories

CRITICAL Risk:

  • .github/workflows/*.yml (CI/CD changes)
  • Files containing secrets/API keys

HIGH Risk:

  • package.json, yarn.lock, pnpm-lock.yaml
  • composer.json, composer.lock
  • .env* files
  • Database migrations, schema files
  • GitHub Actions config (.github/settings.yml, etc.)

MEDIUM Risk:

  • src/**/*.js|ts|php|py (source code)
  • __tests__/**, test/** (tests)
  • docs/** (documentation)

LOW Risk:

  • Examples, samples, configs
  • Comments, formatting
  • Non-code changes

3. Update Reviewer Summary

Change from:

**Files changed:** ${files.length}

To:

**Files changed:** ${files.length}
- 🔴 Critical: ${critical.length}
- 🟠 High: ${high.length}
- 🟡 Medium: ${medium.length}
- 🟢 Low: ${low.length}

4. Add Tests

  • Test categorization for each risk level
  • Test edge cases (hidden files, symlinks)
  • Test summary generation

Test Cases

const files = [
  { filename: '.github/workflows/test.yml', expectedRisk: 'critical' },
  { filename: 'package.json', expectedRisk: 'high' },
  { filename: 'src/index.js', expectedRisk: 'medium' },
  { filename: 'README.md', expectedRisk: 'low' },
];

Effort Estimate

Small (1-2 hours)

Priority

🟡 MEDIUM - Improves analysis quality

Dependencies

Related Issues

  • Related: Issue 2.4 (blocker detection)
  • Reference: ai/improvement-plan-planner-reviewer.md (Issue 2.2)

References

  • scripts/agents/reviewer.agent.js (lines 64-65)
  • ai/audit-planner-reviewer-agents.md (Section 2.2)

Activity

  1. linear-code commented on May 31, 2026

    @linear-code
  2. ashleyshaw commented on May 31, 2026

    @ashleyshaw
    MemberAuthor

    ✅ Completed - Merged in PR #641 (Phase 3 Polish: Complete Agent Implementation and Polish)

    Reviewer file analysis has been enhanced with:

    • Pagination support for file list retrieval to handle PRs with many files
    • Proper identification of changed files and their risk levels
    • CI status integration and checks

    Generated by Claude Code

  3. added a commit that references this issue on Jun 1, 2026
  4. self-assigned this
    on Sep 8, 2026
  5. github-actions commented on Sep 8, 2026

    @github-actions
    Contributor

    ⚠️ Bare Labels Detected

    This issue has labels that are not in the canonical taxonomy:

    • migrate:type:review
    • migrate:type:feature
    • migrate:type:audit

    Valid Canonical Labels

    Please use labels with a prefix from the canonical taxonomy:

    • Type: type:bug, type:feature, type:task, type:documentation, etc.
    • Status: status:needs-triage, status:in-progress, status:done, etc.
    • Priority: priority:critical, priority:high, priority:normal, priority:low
    • Area: area:ci, area:docs, area:labels, area:security, etc.
    • Meta: meta:needs-changelog, meta:duplicate, meta:blocked, etc.

    For the complete list, see .github/labels.yml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions