Skip to content

Add multi-iteration AI quality assurance pipeline for news article generation#1170

Merged
pethers merged 50 commits intomainfrom
copilot/implement-ai-quality-assurance-pipeline
Mar 16, 2026
Merged

Add multi-iteration AI quality assurance pipeline for news article generation#1170
pethers merged 50 commits intomainfrom
copilot/implement-ai-quality-assurance-pipeline

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 13, 2026

  • Review latest PR thread feedback (3956094582) and map each comment to minimal code changes
  • Inspect current implementation in scripts/validate-quality-scores.cjs
  • Reproduce baseline with targeted existing checks before edits
  • Fix strict MULTIDIM_THRESHOLD parsing (reject partial numeric values)
  • Fix critical computation to use runtime validator threshold consistently
  • Run targeted tests and type-check
  • Run final code review and CodeQL scan
  • Reply on PR comment with commit hash and screenshot note (no UI changes)
Original prompt

This section details on the original issue you should resolve

<issue_title>Multi-Iteration AI Quality Assurance Pipeline for News Article Generation</issue_title>
<issue_description>## 📋 Issue Type
Feature / Quality Assurance

🎯 Objective

Implement a multi-iteration AI quality assurance pipeline that validates every generated news article through structured quality checks, ensures completeness of stakeholder perspectives, verifies analytical depth, and enforces factual consistency with source documents. Currently, articles are generated in a single pass and validated only for HTML structure — there is no quality review of the analytical content itself. This must be enhanced with iterative AI review loops that improve article quality before publication.

📊 Current State

  • Single-pass generation: All generators produce final HTML in one execution — no review/refinement
  • Validation is structural only: scripts/validate-news-generation.sh checks HTML structure, semantic markup, file existence, article count — NOT analytical quality
  • validateArticleQuality() in scripts/generate-news-enhanced/helpers.ts: Checks content length and basic structure — not analytical depth
  • QUALITY_THRESHOLD in config.ts: Single numeric threshold for pass/fail — no dimensional quality assessment
  • No factual verification: Generated text not checked against source documents for accuracy
  • No stakeholder completeness check: No validation that all relevant perspectives are represented
  • No editorial consistency check: Each article may have different depth, tone, and analytical approach
  • Post-generation fixes needed: Known issues with untranslated "Why it matters" text, template mismatches, BreadcrumbList truncation (from stored memories)

🚀 Desired State

  • Multi-iteration quality pipeline:

    1. Iteration 1 — Generation: AI generates initial article with analysis
    2. Iteration 2 — Quality Review: AI reviews article against quality criteria:
      • Factual consistency: Do claims match source documents?
      • Stakeholder completeness: Are all relevant perspectives represented?
      • Analytical depth: Is the analysis substantive or superficial?
      • Balance: Are multiple viewpoints fairly represented?
      • Evidence: Are assertions backed by document references?
    3. Iteration 3 — Enhancement: AI addresses identified gaps and enhances weak sections
    4. Final — Validation: Structural + content quality checks before output
  • Quality scoring dimensions:

    Dimension Weight Description
    Factual Accuracy 25% Claims match source documents
    Stakeholder Coverage 20% All relevant perspectives represented
    Analytical Depth 20% Substance beyond surface-level description
    Editorial Consistency 15% Consistent tone, style, structure
    Evidence Quality 10% Assertions backed by references
    Language Quality 10% Grammar, clarity, readability
  • Quality gates: Articles scoring below threshold get additional AI iteration before publishing

  • Quality metadata: Each article's quality scores tracked in news/metadata/ for monitoring trends

  • Automated issue creation: If quality consistently drops, auto-create GitHub issues

🔧 Implementation Approach

Step 1: Create Quality Assessment Module

// New: scripts/ai-analysis/quality-assessor.ts
interface QualityAssessment {
  overallScore: number;  // 0-100
  dimensions: {
    factualAccuracy: DimensionScore;
    stakeholderCoverage: DimensionScore;
    analyticalDepth: DimensionScore;
    editorialConsistency: DimensionScore;
    evidenceQuality: DimensionScore;
    languageQuality: DimensionScore;
  };
  issues: QualityIssue[];
  suggestions: string[];
  passesThreshold: boolean;
}

interface DimensionScore {
  score: number;  // 0-100
  evidence: string[];
  improvements: string[];
}

interface QualityIssue {
  severity: 'critical' | 'major' | 'minor';
  dimension: string;
  description: string;
  suggestedFix: string;
}

Step 2: Integrate Quality Loop in Generator Pipeline

// In each generator function:
async function generateWithQualityLoop(docs, topic, lang): Promise<GenerationResult> {
  // Iteration 1: Generate
  let content = await aiAnalyze(docs, topic, lang);
  
  // Iteration 2: Quality review
  const assessment = await qualityAssessor.assess(content, docs, lang);
  
  if (!assessment.passesThreshold) {
    // Iteration 3: Enhancement based on feedback
    content = await aiEnhance(content, assessment.issues, assessment.suggestions);
    
    // Re-assess
    const finalAssessment = await qualityAssessor.assess(content, docs, lang);
    // Track quality improvement
  }
  
  // Final: Generate HTML with quality metadata
  return generateArticleHTML({ ...data, qualityScore: assessment.overallScore });
}

Step 3: Quality Metadata Tracking

  • Store per-article quality scores in ...

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

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

Labels

agentic-workflow Agentic workflow changes ci-cd CI/CD pipeline changes documentation Documentation updates news News articles and content generation refactor Code refactoring schema Data schema changes size-xl Extra large change (> 1000 lines) testing Test coverage workflow GitHub Actions workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi-Iteration AI Quality Assurance Pipeline for News Article Generation

4 participants