Files
proffesor-for-testing__agen…/docs/planning/phase4-implementation-roadmap.md
Dragan Spiridonov 6dbc1c377b fix: critical memory/learning system fixes for v1.9.4 (#89)
* SwarmMemoryManager Refactoring Plan

* fix: add missing directories to npm package (v1.9.3)

Added templates/, .claude/helpers/, and docs/reference/ to package.json
files array. These were missing from the npm distribution, causing
`aqe init` to fail with "Template file not found" errors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* checkpoint improvements

* fix: critical memory/learning system fixes for v1.9.4

## Critical Fixes
- Vector embeddings now stored correctly (was storing NULL)
- SQL parameter style fixed for agentdb's SqlJsDatabase wrapper
- HNSW index schema mismatch resolved with pattern_id column
- Hooks now save to correct database (.agentic-qe/agentdb.db)

## New Features
- Added 5 SwarmMemoryManager methods for learning data retrieval:
  - getBestAction() - Q-learning best action selection
  - getRecentLearningExperiences() - Recent experience retrieval
  - getLearningExperiencesByTaskType() - Task-filtered experiences
  - getHighRewardExperiences() - Successful experience extraction
  - getLearningStats() - Aggregate learning statistics
- Added comprehensive integration test for memory/learning loop
- Added RuVector pattern store integration (experimental)

## Technical Details
- Vector embeddings: 384 dimensions × 4 bytes = 1,536 bytes per pattern
- All 12 integration tests pass
- HNSW index: 150x faster vector search enabled

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: move ARM64-only ruvector packages to optionalDependencies

Fixes CI failures caused by platform-specific dependencies:
- @ruvector/node-linux-arm64-gnu (ARM64 only)
- ruvector-core-linux-arm64-gnu (ARM64 only)

These packages caused npm ci to fail on x64 CI runners with:
"EBADPLATFORM - wanted linux/arm64, current linux/x64"

Solution: Move ARM64 packages to optionalDependencies and add
x64 variants for cross-platform compatibility.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* chore: regenerate package-lock.json with x64 ruvector packages

Updates lockfile to include optional x64 platform packages for
CI compatibility:
- @ruvector/node-linux-x64-gnu@0.1.17
- ruvector-core-linux-x64-gnu@0.1.15

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-30 20:52:44 +01:00

21 KiB

Phase 4 Implementation Roadmap

Issue: #69 Planning Document: phase4-cicd-quality-gates.md Target Version: v2.0.0 Estimated Duration: 10 weeks

Executive Summary

Phase 4 introduces comprehensive CI/CD quality gates and powerful CLI visualization/reporting tools to the Agentic QE Fleet. This phase transforms the fleet from a testing automation system into a complete quality assurance platform with enforced quality standards and actionable insights.

Key Deliverables

1. Quality Gates System

  • Coverage Gates: Line, branch, and function coverage enforcement
  • Performance Gates: Response time, memory, CPU, and bundle size limits
  • Security Gates: Vulnerability detection and remediation enforcement
  • Quality Gates: Code complexity, maintainability, and technical debt tracking

2. CLI Tools

  • aqe gate: Comprehensive quality gate management (15+ subcommands)
  • aqe report: Multi-format report generation with scheduling
  • aqe visualize: Interactive web dashboard with real-time updates

3. GitHub Actions Workflows

  • quality-gates.yml: Automated gate checks on every PR
  • performance-regression.yml: Baseline comparison and trend analysis
  • security-scanning.yml: Vulnerability scanning with auto-issue creation

4. MCP Tool Enhancements

  • 9 new quality gate MCP tools
  • 6 new visualization MCP tools
  • 3 new reporting MCP tools

5. Visualization Dashboard

  • Real-time fleet status monitoring
  • Coverage heatmaps and trend charts
  • Performance metrics visualization
  • Security vulnerability dashboard
  • Interactive drill-down capabilities

Implementation Schedule

Week 1-2: Foundation

Focus: Infrastructure and schemas

Tasks:

  1. Define quality gate schema and validation
  2. Create CLI command framework structure
  3. Define MCP tool specifications
  4. Set up memory integration patterns
  5. Create configuration templates

Deliverables:

  • Gate definition schema
  • CLI command structure
  • MCP tool specifications
  • Memory integration design

Week 3-4: Core Implementation

Focus: Gate logic and reporting engine

Tasks:

  1. Implement coverage gate logic
  2. Implement performance gate logic
  3. Implement security gate logic
  4. Implement quality gate logic
  5. Build report generation engine
  6. Create report templates (HTML, Markdown, JSON)

Deliverables:

  • Working quality gates
  • Report generation system
  • Template library

Week 5-6: GitHub Actions Integration

Focus: CI/CD workflows

Tasks:

  1. Create quality-gates.yml workflow
  2. Create performance-regression.yml workflow
  3. Create security-scanning.yml workflow
  4. Implement PR comment integration
  5. Set up artifact management
  6. Add notification system

Deliverables:

  • 3 production-ready GitHub Actions workflows
  • PR integration
  • Artifact storage system

Week 7-8: Visualization Dashboard

Focus: Interactive web UI

Tasks:

  1. Build Express.js visualization server
  2. Create React dashboard application
  3. Implement WebSocket real-time updates
  4. Build visualization components
  5. Add export capabilities
  6. Implement caching layer

Deliverables:

  • Web dashboard application
  • Real-time monitoring
  • Export functionality

Week 9-10: Testing and Documentation

Focus: Quality assurance and guides

Tasks:

  1. Write unit tests for all components
  2. Create integration tests
  3. Write E2E workflow tests
  4. Create comprehensive documentation
  5. Write configuration guides
  6. Create example setups

Deliverables:

  • Complete test coverage
  • User documentation
  • Integration guides
  • Example configurations

Technical Architecture

Quality Gate System

┌─────────────────────────────────────────┐
│         Quality Gate Engine             │
├─────────────────────────────────────────┤
│  ┌──────────┐  ┌──────────┐            │
│  │ Coverage │  │ Performance│           │
│  │   Gate   │  │    Gate    │           │
│  └────┬─────┘  └─────┬──────┘           │
│       │              │                  │
│  ┌────┴─────┐  ┌─────┴──────┐          │
│  │ Security │  │  Quality   │          │
│  │   Gate   │  │    Gate    │          │
│  └────┬─────┘  └─────┬──────┘          │
│       │              │                  │
│  ┌────┴──────────────┴──────┐          │
│  │   Gate Result Aggregator │          │
│  └────────────┬──────────────┘          │
└───────────────┼─────────────────────────┘
                │
        ┌───────┴────────┐
        │  Memory Store  │
        │   (AgentDB)    │
        └────────────────┘

CLI Architecture

┌─────────────────────────────────────────┐
│           CLI Layer                     │
├─────────────────────────────────────────┤
│  aqe gate  │  aqe report  │ aqe visualize│
└─────┬──────┴──────┬───────┴──────┬──────┘
      │             │              │
┌─────┴──────┐ ┌────┴──────┐ ┌─────┴────────┐
│ Gate       │ │ Report    │ │ Visualization│
│ Manager    │ │ Generator │ │   Server     │
└─────┬──────┘ └────┬──────┘ └─────┬────────┘
      │             │              │
┌─────┴─────────────┴──────────────┴──────┐
│          MCP Tools Layer                │
└────────────────┬────────────────────────┘
                 │
        ┌────────┴─────────┐
        │   AgentDB +      │
        │   Memory System  │
        └──────────────────┘

Dashboard Architecture

┌─────────────────────────────────────────┐
│         React Dashboard                 │
├─────────────────────────────────────────┤
│  Coverage  │  Performance │  Security   │
│  Heatmap   │   Charts     │  Dashboard  │
└─────┬──────┴──────┬───────┴──────┬──────┘
      │             │              │
      └─────────────┴──────────────┘
                    │
           ┌────────┴─────────┐
           │  WebSocket       │
           │  Connection      │
           └────────┬─────────┘
                    │
           ┌────────┴─────────┐
           │  Express.js      │
           │  Server          │
           └────────┬─────────┘
                    │
           ┌────────┴─────────┐
           │  Data Aggregation│
           │  APIs            │
           └────────┬─────────┘
                    │
           ┌────────┴─────────┐
           │  AgentDB Query   │
           │  Engine          │
           └──────────────────┘

File Structure

src/
├── cli/
│   ├── commands/
│   │   ├── gate/
│   │   │   ├── check.ts
│   │   │   ├── define.ts
│   │   │   ├── threshold.ts
│   │   │   ├── list.ts
│   │   │   └── index.ts
│   │   ├── report/
│   │   │   ├── generate.ts
│   │   │   ├── export.ts
│   │   │   ├── compare.ts
│   │   │   └── index.ts
│   │   └── visualize/
│   │       ├── start.ts
│   │       ├── export.ts
│   │       └── index.ts
│   └── index.ts
├── core/
│   ├── quality-gates/
│   │   ├── CoverageGate.ts
│   │   ├── PerformanceGate.ts
│   │   ├── SecurityGate.ts
│   │   ├── QualityGate.ts
│   │   ├── GateEngine.ts
│   │   └── types.ts
│   ├── reporting/
│   │   ├── ReportGenerator.ts
│   │   ├── templates/
│   │   │   ├── html/
│   │   │   ├── markdown/
│   │   │   └── json/
│   │   └── types.ts
│   └── visualization/
│       ├── server.ts
│       ├── dashboard/
│       │   ├── components/
│       │   ├── App.tsx
│       │   └── index.tsx
│       └── types.ts
├── mcp/
│   └── handlers/
│       ├── quality-gates/
│       │   ├── gate-check.ts
│       │   ├── gate-define.ts
│       │   └── gate-threshold.ts
│       ├── visualization/
│       │   ├── visualize-coverage.ts
│       │   ├── visualize-performance.ts
│       │   └── visualize-trends.ts
│       └── reporting/
│           ├── report-generate.ts
│           ├── report-export.ts
│           └── report-compare.ts
└── types/
    ├── quality-gates.ts
    ├── reports.ts
    └── visualization.ts

.github/
└── workflows/
    ├── quality-gates.yml
    ├── performance-regression.yml
    └── security-scanning.yml

config/
└── quality-gates/
    ├── default-gates.json
    ├── coverage-gate.json
    ├── performance-gate.json
    ├── security-gate.json
    └── quality-gate.json

docs/
├── planning/
│   ├── phase4-cicd-quality-gates.md
│   └── phase4-implementation-roadmap.md (this file)
└── guides/
    ├── quality-gates-guide.md
    ├── cli-reference.md
    ├── visualization-guide.md
    └── cicd-integration-guide.md

tests/
├── unit/
│   ├── quality-gates/
│   ├── reporting/
│   └── visualization/
├── integration/
│   ├── phase4/
│   │   ├── quality-gates-integration.test.ts
│   │   ├── cli-integration.test.ts
│   │   └── workflow-integration.test.ts
└── e2e/
    └── phase4/
        └── quality-gate-workflow.test.ts

Configuration Examples

Basic Quality Gate Configuration

{
  "gates": {
    "coverage": {
      "enabled": true,
      "thresholds": {
        "line": 80,
        "branch": 75,
        "function": 85
      }
    },
    "performance": {
      "enabled": true,
      "thresholds": {
        "p95ResponseTime": 500,
        "p99ResponseTime": 1000
      }
    },
    "security": {
      "enabled": true,
      "thresholds": {
        "critical": 0,
        "high": 0,
        "medium": 5
      }
    },
    "quality": {
      "enabled": true,
      "thresholds": {
        "complexity": 10,
        "maintainability": 65
      }
    }
  }
}

Advanced Gate Configuration

{
  "gates": {
    "coverage": {
      "enabled": true,
      "thresholds": {
        "line": 80,
        "branch": 75,
        "function": 85
      },
      "incremental": {
        "enabled": true,
        "thresholds": {
          "line": 90,
          "branch": 85,
          "function": 95
        }
      },
      "exclude": [
        "**/test/**",
        "**/*.spec.ts",
        "**/migrations/**"
      ],
      "fileLevel": {
        "enabled": true,
        "thresholds": {
          "line": 70
        }
      }
    },
    "performance": {
      "enabled": true,
      "thresholds": {
        "p50ResponseTime": 200,
        "p95ResponseTime": 500,
        "p99ResponseTime": 1000,
        "memoryUsage": 512,
        "cpuUtilization": 70,
        "bundleSize": 250
      },
      "regression": {
        "enabled": true,
        "threshold": 10,
        "baseline": "main"
      },
      "budgets": {
        "enabled": true,
        "endpoints": {
          "/api/users": { "p95": 300 },
          "/api/products": { "p95": 400 }
        }
      }
    },
    "security": {
      "enabled": true,
      "thresholds": {
        "critical": 0,
        "high": 0,
        "medium": 5,
        "low": 20
      },
      "ageLimit": {
        "enabled": true,
        "days": 90,
        "severity": "medium"
      },
      "owaspTop10": {
        "enabled": true,
        "enforce": true
      },
      "secretDetection": {
        "enabled": true,
        "patterns": ["api-key", "password", "token"]
      }
    },
    "quality": {
      "enabled": true,
      "thresholds": {
        "complexity": 10,
        "maintainability": 65,
        "duplication": 5,
        "technicalDebt": 20
      },
      "linting": {
        "enabled": true,
        "maxErrors": 0,
        "maxWarnings": 10
      },
      "typeScript": {
        "enabled": true,
        "strict": true,
        "maxErrors": 0
      }
    }
  },
  "actions": {
    "onFailure": {
      "blockMerge": true,
      "createIssue": true,
      "notifyTeam": true,
      "email": ["dev-team@example.com"]
    },
    "onWarning": {
      "blockMerge": false,
      "createIssue": false,
      "notifyTeam": true
    }
  }
}

CLI Usage Examples

Quality Gate Management

# Check all quality gates
aqe gate check

# Check specific gate
aqe gate check coverage

# Define custom gate
cat > production-gate.json <<EOF
{
  "name": "production-ready",
  "gates": ["coverage", "performance", "security", "quality"],
  "thresholds": {
    "coverage.line": 90,
    "security.critical": 0,
    "performance.p95": 300
  }
}
EOF
aqe gate define --config production-gate.json

# Set gate thresholds
aqe gate threshold coverage --line 85 --branch 80 --function 90
aqe gate threshold performance --p95 400 --p99 800
aqe gate threshold security --critical 0 --high 0 --medium 3

# List all gates
aqe gate list

# Show gate details
aqe gate show production-ready

# Test gate without failing
aqe gate test production-ready --dry-run

# CI/CD usage
aqe gate check --fail-on-warning --json > gate-results.json

Report Generation

# Generate comprehensive report
aqe report

# Generate specific report
aqe report --type coverage
aqe report --type performance
aqe report --type security

# Different formats
aqe report --format html --output report.html
aqe report --format markdown --output report.md
aqe report --format json --output report.json

# Time-based reports
aqe report --daily
aqe report --weekly
aqe report --monthly
aqe report --range "2025-11-01:2025-11-29"

# Comparison reports
aqe report compare --baseline main --current feature-branch
aqe report compare --baseline v1.0.0 --current v1.1.0

# Scheduled reports
aqe report --schedule daily --email team@example.com
aqe report --schedule weekly --day monday --time "09:00"

Visualization Dashboard

# Start dashboard on default port (3000)
aqe visualize

# Start on custom port
aqe visualize --port 8080

# Focus on specific area
aqe visualize --focus coverage
aqe visualize --focus performance

# Export static visualization
aqe visualize --export dashboard.html

# With custom time range
aqe visualize --from "2025-11-01" --to "2025-11-29"

# Background mode
aqe visualize --daemon

# Stop dashboard
aqe visualize --stop

Testing Strategy

Unit Tests

  • Quality gate logic
  • Report generation
  • Threshold validation
  • Memory integration
  • CLI command parsing

Integration Tests

  • Gate check workflows
  • Report generation pipelines
  • MCP tool interactions
  • Memory storage/retrieval
  • Dashboard API endpoints

E2E Tests

  • Complete GitHub Actions workflows
  • CLI command sequences
  • Dashboard user interactions
  • Report scheduling
  • Multi-gate scenarios

Performance Tests

  • Dashboard load times
  • Report generation speed
  • Gate check efficiency
  • Memory usage
  • Concurrent request handling

Success Criteria

Functional Requirements

  • ✅ All 5 quality gates implemented and working
  • ✅ CLI commands fully functional
  • ✅ GitHub Actions workflows deployed
  • ✅ Dashboard operational with real-time updates
  • ✅ Reports generate in all formats

Performance Requirements

  • ✅ Gate checks complete in <5 minutes
  • ✅ Dashboard loads in <2 seconds
  • ✅ Reports generate in <10 seconds
  • ✅ WebSocket latency <100ms
  • ✅ Memory usage <512MB per visualization server

Quality Requirements

  • ✅ Test coverage >80%
  • ✅ Zero critical bugs
  • ✅ Complete documentation
  • ✅ All examples working
  • ✅ Backwards compatible with existing CLI

User Experience Requirements

  • ✅ Clear, actionable error messages
  • ✅ Interactive help system
  • ✅ Intuitive dashboard navigation
  • ✅ Fast feedback loops
  • ✅ Mobile-responsive dashboard

Dependencies and Blockers

External Dependencies

  • Chart.js or D3.js for visualizations (to be installed)
  • PDF generation library (to be selected)
  • Email service integration (optional)

Internal Dependencies

  • AgentDB must be stable and performant
  • Memory system must support query patterns
  • Existing CLI infrastructure

Potential Blockers

  • Dashboard performance with large datasets (mitigation: pagination, caching)
  • CI/CD pipeline integration complexity (mitigation: thorough testing)
  • Configuration complexity (mitigation: sensible defaults, wizard)

Risk Management

High Priority Risks

  1. Performance degradation in CI/CD

    • Impact: High
    • Probability: Medium
    • Mitigation: Parallel execution, caching, incremental checks
  2. Dashboard scalability issues

    • Impact: Medium
    • Probability: Medium
    • Mitigation: Server-side rendering, data pagination, WebSocket optimization
  3. Configuration complexity

    • Impact: Medium
    • Probability: High
    • Mitigation: Sensible defaults, interactive wizard, validation

Medium Priority Risks

  1. Integration with diverse CI/CD platforms

    • Impact: Medium
    • Probability: Low
    • Mitigation: Plugin architecture, adapter pattern
  2. Report generation performance

    • Impact: Low
    • Probability: Medium
    • Mitigation: Template caching, incremental generation

Documentation Deliverables

User Guides

  • Quality Gates Configuration Guide
  • CLI Command Reference
  • Visualization Dashboard User Guide
  • CI/CD Integration Guide
  • Report Customization Guide

Developer Guides

  • Quality Gate Development Guide
  • MCP Tool Development Guide
  • Dashboard Extension Guide
  • Testing Guide

Examples

  • Example gate configurations
  • Example GitHub Actions workflows
  • Example report templates
  • Example dashboard customizations

Post-Implementation

Monitoring

  • Track gate check execution times
  • Monitor dashboard usage metrics
  • Track report generation frequency
  • Monitor quality improvements

Feedback Collection

  • User surveys
  • Issue tracking
  • Performance metrics
  • Adoption metrics

Continuous Improvement

  • Quarterly performance reviews
  • Feature enhancement based on feedback
  • Integration with new tools
  • Documentation updates

Conclusion

Phase 4 represents a significant evolution of the Agentic QE Fleet, transforming it from a testing tool into a comprehensive quality assurance platform. The implementation will be done in a structured, incremental manner to ensure quality and minimize risk.

Next Steps:

  1. ✅ Planning document approved
  2. ⏳ Create GitHub issues for each week's tasks
  3. ⏳ Set up development branch
  4. ⏳ Begin Week 1 implementation

Target Launch: End of Week 10 Beta Release: End of Week 8 Internal Testing: Week 9 Production Release: v2.0.0