Skip to content

Refactor: Break reporting.py into rendering, artifact, naming, and diff services #145

@techmore

Description

@techmore

Title: Break reporting.py into rendering, artifact, naming, and diff services

Type: refactor
Severity: medium
Area: backend / reporting / report lifecycle

Description:
reporting.py has become a broad backend module that mixes XML parsing, asset extraction, diff generation, HTML/PDF rendering, persisted artifact metadata, customer naming normalization, saved-scan lookup, and task-oriented helper behavior. That concentration increases regression risk in a core subsystem that already affects history, reports, downloads, and exports.

Evidence:

  • /Users/techmore/projects/NmapUI/nmapui/reporting.py is roughly 1400+ lines
  • it contains multiple distinct responsibilities including:
    • report artifact path resolution
    • customer identity normalization
    • XML asset parsing and diff summarization
    • scan metadata persistence
    • HTML/PDF conversion helpers
    • saved-scan lookup and PDF regeneration paths

Proposed Fix:
Split reporting into smaller backend services with stable interfaces.

Implementation Notes:

  • likely extraction candidates:
    • report_artifacts.py
    • report_rendering.py
    • report_diffs.py
    • report_identity.py
  • keep a thin orchestration layer for workflows so task code does not import internals directly
  • add targeted module tests before moving logic to preserve current runtime behavior

Related Issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions