Skip to content

Add a Markdown reporter for PR comments and CI summaries#91

Open
AnshBajpai05 wants to merge 1 commit into
KaykCaputo:masterfrom
AnshBajpai05:feat/markdown-reporter
Open

Add a Markdown reporter for PR comments and CI summaries#91
AnshBajpai05 wants to merge 1 commit into
KaykCaputo:masterfrom
AnshBajpai05:feat/markdown-reporter

Conversation

@AnshBajpai05

Copy link
Copy Markdown
Contributor

Third slice from #80, built on the comparison/reporter split (#90).

What it adds

--markdown report.md — a GitHub-flavored report you can drop straight into a PR comment or $GITHUB_STEP_SUMMARY:

oracletrace app.py --markdown report.md
oracletrace app.py --compare baseline.json --markdown report.md
oracletrace run -- pytest tests/ --markdown report.md

Contents:

  • summary line (total time, function count, timestamp)
  • when --compare is given: a comparison table with 🔴/🟢 per changed function, new/removed function lists, and a regression banner (🚨 count / ✅ none)
  • top functions by total time

Example (a real run against a shrunk baseline):

### Comparison vs. baseline

| Function | Baseline | Current | Change |
|---|---:|---:|---:|
| `s.py:slow` | 0.0012s | 0.0039s | 🔴 +238.4% |

> 🚨 **1 regression(s)** above 5.0% threshold

How it stays clean

The reporter is a pure consumer of ComparisonData from #90 — it re-implements none of the comparison logic. That's exactly what the split was for: render_markdown(data, comparison, top) reads statuses and renders; a future JUnit or other reporter is the same shape.

Function names are escaped (| and backtick) so a name can't break out of a table cell or inline code.

Wiring

--markdown is added to the base parser and to baseline save, mirroring --html. To let the Markdown report include the comparison, the compare step was split so the result is available at export time: _load_comparison() (load baseline + compare) → _export_results(data, args, comparison)_report_comparison() (print + regression gate). No behavior change for existing flags — the terminal comparison, exit-2 gate, and every other export are unchanged; comparison errors still return exit 1 with the same messages.

Tests

  • test_markdown_reporter.py — header/summary, top table sorting + --top limit, pipe-escaping, comparison table with icons, regression/no-regression banners, new/removed lists, file writing, self-contained (only the footer link).
  • test_cli.py--markdown writes a file end-to-end, and --compare --markdown includes the comparison section.

Full suite green locally (the one failure on my machine is the pre-existing test_symlinked_user_code, which needs Windows symlink privileges and passes on CI).

🤖 Generated with Claude Code

--markdown report.md writes a GitHub-flavored report: summary,
top-functions table, and — when --compare is given — a comparison
table with regression/improvement icons, new/removed lists and a
regression banner. Drops straight into a PR comment or
$GITHUB_STEP_SUMMARY.

The reporter is a pure consumer of the ComparisonData from KaykCaputo#90; it
reimplements no comparison logic. To make the comparison available
at export time, the compare step is split into _load_comparison /
_export_results / _report_comparison, with no change to existing
flags, output or exit codes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant