Skip to content

fix(report): deduplicate consecutive headings in scan report - #1337

Open
vardhans07 wants to merge 12 commits into
usestrix:mainfrom
vardhans07:fix/duplicate-report-headings-1332
Open

vardhans07 wants to merge 12 commits into
usestrix:mainfrom
vardhans07:fix/duplicate-report-headings-1332

Conversation

@vardhans07

@vardhans07 vardhans07 commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Closes #1332

Description

Resolves an issue where Markdown reports contain consecutive duplicate section headings (e.g., # Executive Summary).

Changes

  • Added deduplicate_markdown_headings helper in strix/report/writer.py.
  • Applied deduplication to final_scan_result before file writing in write_execution_report.
  • Added unit tests in tests/test_report_writer.py.

Load settings and determine chat completions tool usage based on API type.
Added a function to remove duplicate markdown headings from the report content before writing it to the file.

Fixes usestrix#1332
test(report): add tests for markdown heading deduplication
revert(factory): restore factory.py to match upstream
revert(factory): align indentation with upstream
revert(factory): align indentation with upstream
revert(factory): align indentation with upstream
revert(factory): align indentation with upstream
revert(factory): align indentation with upstream
@greptile-apps

greptile-apps Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 2/5

This PR is not safe to merge because the report module cannot load through its existing production import, and the renamed writer also fails whenever invoked.

Findings

  1. P1 Report writer rename breaks imports
  2. P1 Undefined timezone breaks reports
  3. P1 Deduplication corrupts fenced content
Fix with agent prompt
### Issue 1
strix/report/writer.py:160
Renaming `write_executive_report` without updating its production import and caller makes `strix.report.state` fail to import because the old symbol no longer exists. This prevents report state initialization and scan artifact generation. The existing writer test also still calls the removed name.

### Issue 2
strix/report/writer.py:165
`write_execution_report` references `timezone.utc`, but this module imports only `UTC` and `datetime`. Every call therefore raises `NameError` after opening the output file and writing its title, leaving a partial report instead of the completed artifact.

```suggestion
        f.write(f"**Generated:** {datetime.now(UTC).strftime('%Y-%m-%d %H:%M:%S UTC')}\n\n")
```

### Issue 3
strix/report/writer.py:147-151
The deduplicator treats heading-shaped lines inside fenced code blocks as document headings. Final report fields may contain fenced payload excerpts, so two identical `#`-prefixed lines in an excerpt will lose one line and corrupt the report evidence. The helper needs to preserve fenced content verbatim.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

This PR adds normalization of consecutive Markdown headings before writing the penetration-test report and adds focused unit coverage.

  • Introduces deduplicate_markdown_headings.
  • Renames the report writer and applies normalization to its input.
  • Adds direct helper and report-output tests.
  • The current rename and datetime reference break report generation, while block-agnostic normalization can alter fenced payload excerpts.

Reviews (1) · Last reviewed commit: "Update factory.py"

Comment thread strix/report/writer.py
Comment thread strix/report/writer.py Outdated
Comment thread strix/report/writer.py
fix(report): preserve fenced code blocks and use UTC in execution report
test(report): verify fenced code blocks are preserved during deduplication
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Duplicate headings in the report

1 participant