Skip to content

fix(review): remediate markdown formatting issues and unbalanced code blocks in review reports #250

Closed

Description

@dan-petty

Problem Description

Investigation of review.md reports generated in .data/reviews revealed several severe Markdown formatting bugs:

  1. Unbalanced Code Blocks in Fix Recommendations: In src/devops_cli/ai/review/pipeline.py, f.fix is unconditionally wrapped in triple backticks (\n{f.fix}\n). When f.fix already contains code fences or multiline markdown from LLM output, this results in unbalanced code fences (odd fence count) that swallow all subsequent sections (detailed findings, external dependencies, and network references tables) into an unclosed monospace block.
  2. Broken Pattern Themes & Dangling Brackets in Executive Summary: In src/devops_cli/ai/review/stages/reporting.py, _derive_finding_theme splits naively on [:\-\(], slicing inside scanner tags (e.g. [DRY-RUN], [GITLEAKS:simulated-secret], [B602]) or CLI flags (e.g. --allow-blocked-state), producing unclosed brackets (**[DRY**:) and unclosed backticks.
  3. Inline Backtick Collisions: Blindly wrapping rep.title in backticks when rep.title already contains inline code backticks results in broken nested backticks.
  4. Markdown Asterisk Collisions: Raw Python parameters (e.g. **kwargs) in findings collide with bold markdown syntax (****kwargs****).

Remediation Plan

  • Guard f.fix code block formatting: inspect existing code fences, balance code blocks, and use +1$ backticks or render clean fenced blocks without nesting.
  • Robustly derive finding themes by stripping scanner bracket prefixes cleanly rather than splitting across internal punctuation.
  • Ensure balanced backticks, brackets, and asterisks across all generated tables and markdown summaries.
  • Add comprehensive test coverage verifying Markdown balance (equal number of opening/closing fences, valid table column counts, and zero unclosed formatting markers) across all review markdown output.

Activity

  1. added this to the v0.2.20 milestone on Sep 18, 2026
  2. added
    type/bug
    scope/review
    priority/p1-high
    on Sep 18, 2026
  3. added a commit that references this issue on Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p1-highscope/reviewtype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions