{
  "batch": "Design Coherence — Mechanical Concern Signals",
  "batch_index": 4,
  "assessments": {
    "design_coherence": 66.0
  },
  "dimension_notes": {
    "design_coherence": {
      "evidence": [
        "Parallel implementations of the same scorecard pipeline exist in `cmd/devour_scorecard.py` and `cmd/scorecard_generator.py` with near-identical function layouts (`ScorecardData`, `score_color`, `draw_left_panel`, `draw_right_panel`, `generate_scorecard`, `main`) and only minor line-level differences.",
        "Three variants of enhanced generator (`cmd/devour_enhanced.py`, `cmd/devour_enhanced_fixed.py`, `cmd/devour_enhanced_v2.py`) repeat almost the full rendering stack (`draw_header_section`, `draw_enhanced_left_panel`, `draw_enhanced_right_panel`, `draw_trends_section`, `load_enhanced_devour_data`), creating branch-by-copy evolution.",
        "Scraper adapters across providers (`internal/scraper/external/astrodocs.go`, `internal/scraper/external/cloudflaredocs.go`, `internal/scraper/external/reactdocs.go`) duplicate fetch/hash/change-detection and document assembly patterns with provider-specific data glued inline, indicating repeated structural pattern without shared orchestration abstraction.",
        "Within `cmd/devour_lighthouse.py`, `load_font` is defined twice (once near top and again later), showing local design drift and utility ownership ambiguity."
      ],
      "impact_scope": "codebase",
      "fix_scope": "architectural_change",
      "confidence": "high"
    }
  },
  "findings": [
    {
      "dimension": "design_coherence",
      "identifier": "scorecard_variant_sprawl",
      "summary": "Scorecard generation is maintained as multiple copy-variants instead of one composable pipeline.",
      "related_files": [
        "cmd/devour_scorecard.py",
        "cmd/scorecard_generator.py",
        "cmd/devour_enhanced.py",
        "cmd/devour_enhanced_fixed.py",
        "cmd/devour_enhanced_v2.py"
      ],
      "evidence": [
        "Both `cmd/devour_scorecard.py` and `cmd/scorecard_generator.py` declare the same major functions and data model in the same order with only minor stylistic deltas.",
        "Enhanced variants repeat the same section render functions and data loading flow, then diverge by ad-hoc edits, increasing change fan-out for any layout or scoring rule update."
      ],
      "suggestion": "Extract a shared rendering core module (palette/fonts/layout primitives + data normalization), keep one canonical CLI entrypoint, and convert variant behavior into explicit theme/feature flags rather than duplicated files.",
      "confidence": "high",
      "impact_scope": "codebase",
      "fix_scope": "architectural_change"
    },
    {
      "dimension": "design_coherence",
      "identifier": "external_scraper_template_duplication",
      "summary": "Provider scrapers repeat the same orchestration flow with per-provider copy/paste adapters.",
      "related_files": [
        "internal/scraper/external/astrodocs.go",
        "internal/scraper/external/cloudflaredocs.go",
        "internal/scraper/external/reactdocs.go",
        "internal/scraper/external/godocs.go",
        "internal/scraper/external/vuedocs.go"
      ],
      "evidence": [
        "Each scraper reimplements nearly identical `Scrape`, `DetectChanges`, `fetchPage`, and `generateHash` scaffolding, then inlines provider-specific conversion methods.",
        "The repeated constructor/client/parser wiring pattern appears across multiple files, indicating systemic pattern duplication rather than isolated differences."
      ],
      "suggestion": "Introduce a shared `DocAdapter` contract and a generic `HTTPDocScraper` that owns fetch/hash/change-detect; keep provider files focused on mapping parsed domain objects to `Document`.",
      "confidence": "high",
      "impact_scope": "subsystem",
      "fix_scope": "architectural_change"
    },
    {
      "dimension": "design_coherence",
      "identifier": "utility_ownership_drift_in_lighthouse_script",
      "summary": "Duplicate utility definition in one file shows mixed responsibility boundaries.",
      "related_files": [
        "cmd/devour_lighthouse.py",
        "cmd/devour_enhanced.py"
      ],
      "evidence": [
        "`cmd/devour_lighthouse.py` defines `load_font` twice with effectively the same fallback behavior, creating hidden override risk and unclear source of truth.",
        "Comparable font utility exists in other renderer scripts, reinforcing that shared utility concerns are spread instead of centralized."
      ],
      "suggestion": "Remove the duplicate in `cmd/devour_lighthouse.py` and move font-loading helpers into a shared module imported by all renderer scripts.",
      "confidence": "high",
      "impact_scope": "module",
      "fix_scope": "multi_file_refactor"
    }
  ]
}