Skip to content

fix(report): render from any directory and add badge styling#487

Merged
bdeitte merged 7 commits into
mainfrom
fix/vip-report-fixes
Jul 17, 2026
Merged

fix(report): render from any directory and add badge styling#487
bdeitte merged 7 commits into
mainfrom
fix/vip-report-fixes

Conversation

@bdeitte

@bdeitte bdeitte commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

Two related fixes to the Quarto report, found while running vip report.

1. vip report produced no report when run outside a source checkout

run_report shelled out to quarto render in ./report, but the Quarto
templates (index.qmd, details.qmd, _quarto.yml, styles.css) only exist
in a source checkout — they were not shipped in the wheel. Run from any other
directory (e.g. after uv tool install), ./report held only the
results.json that vip verify wrote, so quarto found no inputs, rendered
nothing, and exited 0 — the command silently produced no report.

  • Bundle the templates in the wheel (force-include → vip/_report), mirroring
    the existing scaffold pattern.
  • run_report copies the bundled templates into the working report/ dir
    (refreshing from the package, falling back to a repo checkout), then renders.
    It now errors loudly when the results file or templates are missing, or when
    quarto produces no output, and prints the output path. Also fixes the
    --open path (_output, not the stale _site).
  • Resolve troubleshooting.toml and .feature files from the installed
    vip_tests package (with repo fallback), so troubleshooting hints and BDD
    steps render when installed, not only from a checkout.

2. Product/category badges rendered as unstyled text

index.qmd / details.qmd render product badges (Connect, Workbench, Package
Manager, Security, Prerequisites) with .badge-* CSS classes, but those
classes were never defined in any stylesheet, so every badge showed as plain
text next to the test title.

  • Add report/styles.css with the .badge-* rules (Posit brand colors) and
    reference it from _quarto.yml so both report pages share one definition.

Verification

  • End-to-end: ran the fixed vip report --results <results.json> from a fresh
    temp directory (reproducing the installed-tool scenario). It produced
    report/_output/index.html with styled badges, the Failed (27) section, 7
    troubleshooting-hint blocks, and 34 feature-step procedures — hints and steps
    resolved from the installed package.
  • Built the wheel and confirmed vip/_report/{index.qmd,details.qmd,_quarto.yml,styles.css}
    are bundled.
  • Full selftest suite: 975 passed, 3 skipped. ruff check + ruff format clean.
  • CI renders via cd report && uv run quarto render from the checkout, where
    the repo-relative paths still resolve, so the example-report preview keeps
    working (and now gets styled badges).

Test plan

  • New selftests/test_cli_report.py covers template bundling/copy, the
    arbitrary-directory render path, the no-output error, and support-file
    resolution.

bdeitte added 2 commits July 16, 2026 15:03
The report's index.qmd and details.qmd render product/category badges
(Connect, Workbench, Package Manager, Security, Prerequisites) with the
.badge-* CSS classes from _PRODUCT_BADGE_CSS, but those classes were
never defined in any stylesheet. Every badge rendered as plain unstyled
text next to the test title.

Add report/styles.css with the .badge-* rules (Posit brand colors) and
reference it from _quarto.yml so both report pages share one definition.
vip report shelled out to 'quarto render' in ./report, but the Quarto
templates (index.qmd, details.qmd, _quarto.yml, styles.css) only exist in
a source checkout and were not shipped in the wheel. Run from any other
directory, quarto found no inputs, rendered nothing, and exited 0 -- so
the command silently produced no report.

- Bundle the report templates in the wheel (force-include -> vip/_report),
  mirroring the scaffold pattern.
- run_report now copies the bundled templates into the working report/ dir
  (refreshing from the package, falling back to the repo checkout), errors
  loudly when results or templates are missing or when quarto produces no
  output, and prints the output path. Also fixes the --open path
  (_output, not the stale _site).
- Resolve troubleshooting.toml and .feature files from the installed
  vip_tests package (with repo fallback) so hints and BDD steps render when
  installed, not only from a checkout.
- Add selftests covering template bundling/copy, the arbitrary-directory
  render path, the no-output error, and support-file resolution.
Copilot AI review requested due to automatic review settings July 16, 2026 20:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 fixes vip report so it reliably renders a Quarto HTML report when VIP is installed as a wheel and run from any working directory, and it centralizes CSS so product/category badges render with intended styling.

Changes:

  • Bundle Quarto report templates into the wheel and copy/refresh them into the working ./report/ directory before rendering.
  • Resolve troubleshooting.toml and .feature files from either a repo checkout layout or the installed vip_tests package.
  • Add shared badge styling in report/styles.css and wire it via _quarto.yml.

Reviewed changes

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

Show a summary per file
File Description
src/vip/reporting.py Adds helpers to locate troubleshooting data and feature files from checkout or installed vip_tests.
src/vip/cli.py Ensures templates exist (bundled or repo fallback), renders report from report/, validates output, and fixes --open pathing.
selftests/test_cli_report.py Adds selftests for template copying, arbitrary-directory rendering, and support-file resolution.
report/styles.css Defines .badge-* classes used by the Quarto templates.
report/index.qmd Uses the new resolution helpers for troubleshooting hints and feature parsing.
report/details.qmd Uses the new resolution helpers for troubleshooting hints and feature parsing.
report/_quarto.yml Adds shared CSS reference and confirms output dir is _output.
pyproject.toml Force-includes Quarto templates into the wheel under vip/_report/.

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

Comment thread src/vip/cli.py Outdated
Comment thread src/vip/cli.py Outdated
Comment thread src/vip/cli.py Outdated
Comment thread selftests/test_cli_report.py
@posit-vip-triage

Copy link
Copy Markdown
Contributor

Preview Screenshots

7 screenshots captured across the website preview. The report preview (/vip/pr-preview/pr-487/) returned 404 (not yet deployed by the preview workflow).

Website Preview — https://posit-dev.github.io/vip/pr-preview-site/pr-487/

Home
website home

Getting Started
website getting-started

Shiny App
website shiny-app

Test Inventory
website tests

Feature Matrix
website feature-matrix

Example Report (linked from website)
website report


Report Preview — https://posit-dev.github.io/vip/pr-preview/pr-487/

⚠️ The report preview returned 404 Page Not Found — the preview deployment may not have run yet for this PR.

report-home (404)


URL Status
/pr-preview-site/pr-487/ ✅ captured
/pr-preview-site/pr-487/getting-started/ ✅ captured
/pr-preview-site/pr-487/shiny-app/ ✅ captured
/pr-preview-site/pr-487/tests/ ✅ captured
/pr-preview-site/pr-487/feature-matrix/ ✅ captured
/pr-preview-site/pr-487/report/ ✅ captured
/pr-preview/pr-487/ ⚠️ 404 — not yet deployed

Warning

Firewall blocked 2 domains

The following domains were blocked by the firewall during workflow execution:

  • fonts.gstatic.com
  • mtalk.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "fonts.gstatic.com"
    - "mtalk.google.com"

See Network Configuration for more information.

Generated by Capture preview screenshots for PRs · 53 AIC · ⌖ 6.55 AIC · ⊞ 6.1K ·

Address PR review: _ensure_report_templates gated only on index.qmd, so a
partial template source could return True and render a degraded report (e.g.
missing badge styling). Verify all _REPORT_TEMPLATE_FILES are present, topping
up from the repo checkout when a bundled copy is incomplete. Also assert the
CLI --help exit code in the help selftest.
@posit-vip-triage

Copy link
Copy Markdown
Contributor

Preview Screenshots

7 screenshots captured across website and report previews.

🌐 Website Preview — https://posit-dev.github.io/vip/pr-preview-site/pr-487/

Home
website home

Getting Started
website getting-started

Tests
website tests

Feature Matrix
website feature-matrix

Report
website report


📊 Report Preview — https://posit-dev.github.io/vip/pr-preview/pr-487/

Note: full-page screenshots timed out (font loading) for the report; viewport screenshots were captured instead.

Summary (index)
report home

Details
report details


URLs captured:

  • https://posit-dev.github.io/vip/pr-preview-site/pr-487/ (home)
  • https://posit-dev.github.io/vip/pr-preview-site/pr-487/getting-started/
  • https://posit-dev.github.io/vip/pr-preview-site/pr-487/tests/
  • https://posit-dev.github.io/vip/pr-preview-site/pr-487/feature-matrix/
  • https://posit-dev.github.io/vip/pr-preview-site/pr-487/report/
  • https://posit-dev.github.io/vip/pr-preview/pr-487/ (report summary)
  • https://posit-dev.github.io/vip/pr-preview/pr-487/details.html

Failures: The /vip/pr-preview-site/pr-487/shiny-app/ link was found but not separately screenshotted (it was present in the nav). Report full-page screenshots fell back to viewport due to font-loading timeout.

Warning

Firewall blocked 2 domains

The following domains were blocked by the firewall during workflow execution:

  • fonts.gstatic.com
  • mtalk.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "fonts.gstatic.com"
    - "mtalk.google.com"

See Network Configuration for more information.

Generated by Capture preview screenshots for PRs · 67.7 AIC · ⌖ 6.52 AIC · ⊞ 6.1K ·

bdeitte added 2 commits July 17, 2026 12:11
Review follow-ups on the vip report fixes:

- The bundled-template refresh now skips files whose content is already
  identical and prints a stderr notice listing any existing files it did
  overwrite, so local template customizations never disappear silently.
- A missing quarto binary now produces a clear install-Quarto error
  instead of an uncaught FileNotFoundError traceback.
- The importlib.resources.as_file guard catches OSError (not just
  FileNotFoundError) so zip-imported packages on Python < 3.12 fall back
  to the repo checkout instead of crashing.
- New selftest pins the pyproject force-include block to
  cli._REPORT_TEMPLATE_FILES so the two lists cannot drift.
@bdeitte
bdeitte merged commit d038eb9 into main Jul 17, 2026
35 checks passed
@bdeitte
bdeitte deleted the fix/vip-report-fixes branch July 17, 2026 18:10
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-07-17 18:10 UTC

@posit-vip-triage

Copy link
Copy Markdown
Contributor

Preview Screenshots

4 screenshots captured | PR #487


⚠️ Preview Content Not Available

The PR preview URLs are returning 404:

  • Website preview: https://posit-dev.github.io/vip/pr-preview-site/pr-487/ — 404
  • Report preview: https://posit-dev.github.io/vip/pr-preview/pr-487/ — 404

Root cause: The Website Preview workflow ran twice for this PR. The first run (29602156603) successfully built and deployed the preview. A subsequent run (29602839812) executed the cleanup job instead of the build job, removing the deployed content (only .nojekyll remains on the gh-pages branch).


Website Preview — 404

Website preview 404

Report Preview — 404

Report preview 404


Main Site (for reference)

Main website (https://posit-dev.github.io/vip/):

Main website home

Main example report (https://posit-dev.github.io/vip/example-report/):

Main example report


URLs captured: 4 total (2 preview 404s, 2 main site pages for reference)
Failed to render: Website preview and report preview (404 — content cleaned up by a subsequent workflow run)

Warning

Firewall blocked 2 domains

The following domains were blocked by the firewall during workflow execution:

  • fonts.gstatic.com
  • mtalk.google.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "fonts.gstatic.com"
    - "mtalk.google.com"

See Network Configuration for more information.

Generated by Capture preview screenshots for PRs · 134 AIC · ⌖ 6.18 AIC · ⊞ 6.1K ·

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