Prismatic Quality Intelligence

Prismatic Quality Intelligence

190 files DevOps

Overview

Prismatic Quality Intelligence is a self-evolving, self-healing quality management system with deep Three-Layer Neural Learning (3NL) integration. Operating as the platform's immune system for code health, it autonomously monitors, predicts, evolves, and remediates quality violations across the entire Prismatic Platform's 90-application umbrella. The module enforces the platform's target of a perfect 100/100 quality score -- a standard that has been achieved and maintained through disciplined automation, genetic algorithm evolution of quality rules, and multi-level self-healing capabilities.

Quality Intelligence operates at the intersection of static analysis, pattern recognition, and autonomous evolution. Every commit, every compilation, and every test run feeds data into the quality scoring engine, which computes a composite score from 13 independent domain assessments. When quality dips below configured thresholds, the Quality Floor Guardian triggers automatic remediation cycles. When quality holds steady, the evolution scanner proactively identifies improvement opportunities that would further strengthen the codebase. The system has eliminated over 905 Quality Debt Points (QDP) through automated CASCADE patterns including Type Mismatch, Dead Code, Empty Check, Timer Replacement, and Nuclear Cache remediation.

The system embodies the platform's NO MERCY doctrine: zero tolerance for incomplete implementations, untested code, or deferred quality debt. Every Quality Debt Point is tracked individually and targeted for elimination through automated healing cycles, with the genetic algorithm continuously evolving rule fitness to improve detection accuracy over generations.

Architecture

The system follows a layered architecture combining 3NL intelligence with evolutionary computing and automated healing pipelines.

+------------------------------------------------------------------+
|                  QUALITY INTELLIGENCE SYSTEM                      |
+------------------------------------------------------------------+
|  +----------------------------------------------------------+    |
|  |                    3NL INTELLIGENCE CORE                  |    |
|  |  +------------+   +-----------+   +---------------+      |    |
|  |  | L1: LOGIC  |   | L2: NEURAL|   | L3: LINGUISTIC|      |    |
|  |  | Prolog KB  |   | Pattern   |   | NLP Analysis  |      |    |
|  |  | Inference  |   | Recogn.   |   | Commit Msgs   |      |    |
|  |  +-----+------+   +-----+-----+   +-------+-------+      |    |
|  |        +---------------+-----------------+               |    |
|  |                        v                                 |    |
|  |              +-------------------+                       |    |
|  |              |   FUSION ENGINE   |                       |    |
|  |              | Weighted/Consensus/Attention/Cascade      |    |
|  |              +-------------------+                       |    |
|  +----------------------------------------------------------+    |
|                                                                   |
|  +----------------+  +----------------+  +------------------+    |
|  | SELF-EVOLUTION |  | SELF-HEALING   |  | GITLAB SYNC      |    |
|  | Genetic Algos  |  | Auto-fix       |  | Issue Creation   |    |
|  | Rule Mutation  |  | Rollback       |  | MR Integration   |    |
|  | Fitness Eval   |  | Security Patch |  | Quality Dash     |    |
|  +----------------+  +----------------+  +------------------+    |
+------------------------------------------------------------------+

The architecture comprises four major subsystems: the 3NL Intelligence Core provides multi-layer quality analysis fusing logic, neural, and linguistic signals; the Evolution Engine uses genetic algorithms to optimize quality rule populations; the Healing Engine performs multi-level automated remediation with rollback; and the GitLab Sync module maintains real-time integration with issue tracking and merge request workflows.

Key Modules

ModulePurposeLines
PrismaticQualityIntelligenceMain orchestrator GenServer coordinating all subsystemsCore
PrismaticQualityIntelligence.ApplicationOTP Application with supervision treeBoot
PrismaticQualityIntelligence.ThreeNLCore3NL Intelligence Core with fusion engineAnalysis
PrismaticQualityIntelligence.L1LogicProlog-based rule inference and constraint checkingL1
PrismaticQualityIntelligence.L2NeuralPattern recognition and anomaly detectionL2
PrismaticQualityIntelligence.L3LinguisticNLP analysis of commit messages and PRsL3
PrismaticQualityIntelligence.EvolutionEngineGenetic algorithm engine for quality rule optimizationEvolution
PrismaticQualityIntelligence.HealingEngineMulti-level self-healing with rollback capabilityHealing
PrismaticQualityIntelligence.GitLabSyncReal-time GitLab issue and MR synchronizationIntegration
PrismaticQualityIntelligence.PredictiveAnalyzerQuality degradation prediction before it occursPrediction
PrismaticQualityIntelligence.PatternRecognizerAnti-pattern detection across the codebaseDetection
PrismaticQualityIntelligence.TrendAnalyzerQuality trend analysis across sessions and generationsTrends
PrismaticQualityIntelligence.IssueManagerAutomated GitLab issue lifecycle managementIssues
PrismaticQualityIntelligence.MRMonitorMerge request quality gate enforcementMR Gates

Configuration

config :prismatic_quality_intelligence,
  # Evolution settings
  evolution_interval: :timer.hours(1),
  population_size: 100,
  mutation_rate: 0.15,
  crossover_rate: 0.70,
  elite_size: 10,

  # Healing settings
  healing_interval: :timer.minutes(15),
  max_fixes_per_cycle: 50,
  rollback_enabled: true,

  # GitLab settings
  gitlab_sync_interval: :timer.minutes(5),
  auto_create_issues: true,
  auto_close_issues: true,

  # 3NL settings
  fusion_strategy: :weighted,
  l1_weight: 0.30,
  l2_weight: 0.40,
  l3_weight: 0.30

Environment variables: GITLAB_TOKEN, GITLAB_PROJECT_ID, GITLAB_BASE_URL.

API Reference

# Run 3NL quality analysis across files, commits, and metrics
{:ok, analysis} = PrismaticQualityIntelligence.analyze(%{
  files: ["lib/my_app.ex"],
  commits: [%{sha: "abc123", message: "Fix bug"}],
  metrics: %{quality_score: 95, violation_count: 0}
})

# Check platform-wide quality score across 13 domains
{:ok, score} = PrismaticQualityIntelligence.score()
# => %{total: 100, domains: %{dialyzer: 100, credo: 100, compilation: 100, ...}}

# Run evolution cycle with configurable generations
{:ok, result} = PrismaticQualityIntelligence.evolve(generations: 10)
# => %{improvement: 2.3, generation: 42}

# Multi-level self-healing (reactive, predictive, preventive, autonomous)
{:ok, result} = PrismaticQualityIntelligence.heal([], level: :autonomous)

# Predict quality degradation before it manifests
{:ok, prediction} = PrismaticQualityIntelligence.predict_degradation(%{
  recent_commits: 15, avg_change_size: 120
})

# Synchronize quality state with GitLab
{:ok, result} = PrismaticQualityIntelligence.sync_gitlab()

# Per-application quality breakdown
{:ok, apps} = PrismaticQualityIntelligence.per_app_scores()
# => [%{app: :prismatic_kernel, score: 100}, ...]

Testing

The application uses ExCoveralls for test coverage with comprehensive testing across all subsystems.

# Run all tests
mix test apps/prismatic_quality_intelligence/test

# Run with coverage reporting
mix test apps/prismatic_quality_intelligence/test --cover

# Run quality checks (format + credo + dialyzer)
cd apps/prismatic_quality_intelligence && mix quality

# CI-mode quality pipeline
cd apps/prismatic_quality_intelligence && mix quality.ci
Test CategoryCoverageWhat It Verifies
3NL AnalysisL1/L2/L3 layersFusion strategy correctness, layer independence
Evolution EngineGenetic operatorsSelection, crossover, mutation, elite preservation
Healing EngineAll 4 levelsFix application, rollback correctness, safety
GitLab SyncAPI integrationIssue creation, MR comments, label management
Predictive AnalyzerTrend detectionDegradation prediction accuracy

Integration Points

NABLA Compliance

Quality Intelligence operates under full NABLA Infinity epistemic compliance. Every quality score maintains provenance traceability -- scores are derived from specific tool outputs (Dialyzer, Credo, compilation) with timestamps and version metadata. The Signal Plurality axiom is satisfied because quality assessment draws from 13 independent analysis domains, preventing single-source bias. Contradiction Preservation is maintained when domain scores conflict (e.g., high Credo score but low Dialyzer score) by preserving both signals rather than averaging them away. The Unknown Valid axiom is respected by the predictive analyzer, which explicitly reports uncertainty ranges rather than manufacturing false confidence about future quality trajectories.

Performance

OperationExpected DurationImpact
Full 13-domain quality scan50-300msBlocking pre-commit
3NL analysis (single file)10-50msPer-commit analysis
Evolution cycle (10 generations)1-5sBackground evolution
Healing cycle (reactive)5-30sAutomated remediation
GitLab sync100-500msNon-blocking background
Predictive analysis20-100msTrend computation

Quality scoring is optimized for pre-commit gate integration with sub-300ms execution. Evolution and healing cycles run as background processes managed by the OTP supervision tree, with configurable intervals to prevent resource contention during peak development activity.


Connect & Contribute

Created by Tomáš Korcak (korczis) | Open Source under GHL