Skip to content

Add browser smoke harness#2

Merged
mschwar merged 3 commits into
mainfrom
feat/plots-dashboard
May 19, 2026
Merged

Add browser smoke harness#2
mschwar merged 3 commits into
mainfrom
feat/plots-dashboard

Conversation

@mschwar
Copy link
Copy Markdown
Owner

@mschwar mschwar commented May 19, 2026

Goal:

  • Add a browser smoke harness for the homepage, dashboard, and one representative plot.
  • Keep the repo's validate workflow green by installing pytest with the rest of the documented dependencies.

What changed:

  • Added scripts/browser_smoke.py with text/HTML/JSON receipt output.
  • Added tests/test_browser_smoke.py.
  • Required the harness from scripts/validate_repo.py.
  • Updated CURRENT_STATE.md and the agentic-overhaul notes.
  • Added pytest to requirements.txt so local setup and GitHub Actions install the same test dependency.

Verification:

  • . .venv/bin/activate && python -m pytest tests -q
  • . .venv/bin/activate && python scripts/validate_repo.py --check
  • . .venv/bin/activate && python scripts/browser_smoke.py --html /tmp/plots-browser-smoke/index.html --json /tmp/plots-browser-smoke/report.json
  • Browser screenshots captured for homepage, dashboard, and AI Compute Timeline at desktop and mobile widths:
    • /home/matt/plots-home-desktop.png
    • /home/matt/plots-home-mobile.png
    • /home/matt/plots-dashboard-desktop.png
    • /home/matt/plots-dashboard-mobile.png
    • /home/matt/plots-ai-compute-desktop.png
    • /home/matt/plots-ai-compute-mobile.png

Risk / notes:

  • The harness is a stdlib preflight, not full browser automation.
  • Dashboard still loads D3 from a CDN, so offline browser QA remains the next separate concern.

Next loop command:
/qa and test feature in the web browser. take screen shots to make sure everything looks right. Update docs. Commit, push, and merge.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new browser smoke harness in scripts/browser_smoke.py to validate the homepage, dashboard, and representative plot pages using standard library components. It also updates documentation and repository validation scripts to reflect this addition. Review feedback highlights a potential crash when using relative paths with as_uri(), suggests dynamically generating smoke targets from the manifest to improve resilience, and recommends decoupling HTML report tests from the repository's build state through mocking.

Comment thread scripts/browser_smoke.py
Comment on lines +163 to +165
args = parser.parse_args(argv)

results = run_smoke_checks(args.root)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The --root argument should be resolved to an absolute path before use. The Path.as_uri() method (called via run_smoke_checks -> evaluate_target -> _relative_url) raises a ValueError if the path is not absolute. If a user provides a relative path via the CLI (e.g., --root .), the script will crash.

Suggested change
args = parser.parse_args(argv)
results = run_smoke_checks(args.root)
args = parser.parse_args(argv)
args.root = args.root.resolve()
results = run_smoke_checks(args.root)

Comment thread scripts/browser_smoke.py
Comment on lines +26 to +57
SMOKE_TARGETS = [
{
"name": "homepage",
"title": "Plots homepage",
"path": "index.html",
"checks": [
'data-page="home"',
"plots_manifest.json",
"published entries",
],
},
{
"name": "dashboard",
"title": "Unified Dashboard",
"path": "dashboard/index.html",
"checks": [
"dashboard.css",
"dashboard.js",
"dashboard-container",
],
},
{
"name": "representative-plot",
"title": "AI Compute Timeline",
"path": "ai-compute-timeline/index.html",
"checks": [
"output/ai_compute_timeline_interactive.html",
"output/ai_compute_timeline_highres.png",
"output/ai_compute_timeline.svg",
],
},
]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The smoke targets and their associated content checks are currently hardcoded. Since the repository is manifest-driven, consider dynamically generating the targets (especially the representative-plot) by querying the manifest via manifest_utils.plot_entries. This would make the harness more resilient to directory renames or plot deletions in the future.

Comment on lines +46 to +56
def test_render_html_report_mentions_targets(self, repo_root: Path):
browser_smoke = _load_browser_smoke()

results = browser_smoke.run_smoke_checks(repo_root)
html = browser_smoke.render_html_report(results, repo_root)

assert "Browser smoke receipt" in html
assert "homepage" in html
assert "dashboard/index.html" in html
assert "ai-compute-timeline/index.html" in html
assert "PASS" in html
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This test is an integration test that depends on the repository being in a 'built' state. If the build hasn't been run, the test will fail on the assert "PASS" in html line. To make the test suite more robust, consider splitting this into a unit test that uses mock result data to verify the HTML rendering logic, while keeping the integration check separate.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7edb551618

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/browser_smoke.py


def _relative_url(root: Path, rel_path: str) -> str:
return (root / rel_path).as_uri()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Resolve root path before converting to file URI

Using Path.as_uri() on (root / rel_path) crashes when --root is passed as a relative path (for example --root .), because relative paths cannot be expressed as file URIs. In that scenario the script raises ValueError before any smoke checks run, so the CLI option documented as a repository-root override is unusable unless callers manually pass an absolute path.

Useful? React with 👍 / 👎.

@mschwar mschwar merged commit b6cdec0 into main May 19, 2026
3 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.

1 participant