Skip to content

Provide a set of default report templates#3

Merged
Xarthisius merged 4 commits intomainfrom
issue_2
Jan 28, 2026
Merged

Provide a set of default report templates#3
Xarthisius merged 4 commits intomainfrom
issue_2

Conversation

@Xarthisius
Copy link
Contributor

Provide a set of default templates as part of the package. They can be used by "name" instead of filepath.

How to test?

  1. Deploy this branch
  2. Confirm that tro-utils report --help displays:
    Options:
      -t, --template STRING_OR_PATH  Template file or one of the following:
                                     default  [required]
    
  3. Using an example TRO, run report with -t default -o new.html
  4. Download curl -LO https://raw.githubusercontent.com/craig-willis/trace-report/main/templates/tro.md.jinja2
  5. Using the same example TRO, run report with -t tro.md.jinja2 -o old.html
  6. Check that new.html is the same as old.html.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for default report templates that can be referenced by name instead of requiring a file path. Users can now use -t default instead of providing a template file path when generating TRO reports.

Changes:

  • Added a default Jinja2 template (default.jinja2) to the package for generating TRO reports
  • Implemented a custom Click parameter type to accept either template names or file paths
  • Fixed a bug where single-dict performances are converted to lists before iteration
  • Updated package configuration to include .jinja2 files in the distribution

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
tro_utils/tro_utils.py Fixed handling of single-dict performance objects by converting to list
tro_utils/default.jinja2 Added comprehensive default template for TRO report generation
tro_utils/cli.py Implemented template name resolution and custom parameter validation
pyproject.toml Configured package to include Jinja2 template files in distribution

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

| Artifact | SHA-256 | Status |
| -------- | -------- | ------ |
{%- for location in tro["arrangements"][arrangement]["artifacts"] %}
{%- if tro["arrangements"][arrangement]["artifacts"][location]["excluded"] != "None" %}
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comparing to the string 'None' instead of the Python None value. This condition will always be true for actual None values since None != 'None'. Change to: {%- if tro["arrangements"][arrangement]["artifacts"][location]["excluded"] is not none %}

Copilot uses AI. Check for mistakes.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Xarthisius I believe we actually want this to code to the word "None", not the Python value of None, right?

Copy link
Contributor Author

@Xarthisius Xarthisius Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now we don't even set excluded anywhere, so it's kinda moot. I think Craig's example had it manually added.

Copy link

@larsvilhuber larsvilhuber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine. Where's the template?

Copy link

@larsvilhuber larsvilhuber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found template. Fine to start with.

@larsvilhuber larsvilhuber removed the request for review from craig-willis January 27, 2026 18:25
@larsvilhuber
Copy link

@Xarthisius Might we create a separate repository tro-utils-templates that can then ALSO be referenced by name-only? Package just a small number of templates, all others can be augmented from the remote tro-utils-templates repo? (the packages templates would also be in the repo)

@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

❌ Patch coverage is 21.05263% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.21%. Comparing base (cb4a3b8) to head (cca2f65).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
tro_utils/cli.py 0.00% 14 Missing ⚠️
tro_utils/tro_utils.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #3      +/-   ##
==========================================
- Coverage   61.58%   59.21%   -2.37%     
==========================================
  Files           3        3              
  Lines         341      358      +17     
==========================================
+ Hits          210      212       +2     
- Misses        131      146      +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Xarthisius Xarthisius merged commit 4f293b5 into main Jan 28, 2026
6 of 8 checks passed
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.

3 participants

Comments