Skip to content

Move to a react dashboard#54

Merged
Zac-HD merged 7 commits intoZac-HD:masterfrom
Liam-DeVoe:dashboard-react
Feb 18, 2025
Merged

Move to a react dashboard#54
Zac-HD merged 7 commits intoZac-HD:masterfrom
Liam-DeVoe:dashboard-react

Conversation

@Liam-DeVoe
Copy link
Copy Markdown
Collaborator

@Liam-DeVoe Liam-DeVoe commented Feb 14, 2025

Closes #7, #17. Most of the react code was written by claude, and touched up by me.

  • The stack is trio + starlette + hypercorn + react + scss
  • For building/distributing:
    • I've moved entirely to pyproject.toml for building, with a custom build hook, and am requiring the developer have npm installed in their host system to build.
    • For distribution, I'm building the .html in dist/* as part of the build step and am uploading that as part of the compiled .whl. It should just work ™️ when installed normally (untested).
  • I'm following BEM for structuring scss rules. I've used this style guide before and have enjoyed it, but am not opposed to an alternative. (to be clear, this is not a running dependency or anything, just a style guide).

TODO:

  • check patches/pycrunch recordings, I've probably broken these
  • feature parity with old dashboard: per-test covering examples somewhere, since new cov on test overview page
  • unify overview / test coverage graph styling
  • coverage details on hover in graph

This dashboard is still missing some stuff compared to the existing one, but it is runnable 😄

image

@Zac-HD
Copy link
Copy Markdown
Owner

Zac-HD commented Feb 14, 2025

eh, I think I'm OK with taking out pycrunch if it's annoying to update; it's a really nice concept but is early-alpha stability and there's no nice way to support it with distributed fuzzing (since the recordings are often hundreds of megabytes)

I'm also increasingly keen on the reconstructed-as-if-one-run view (cf #45 (comment)), but that's definitely a future PR.

@Liam-DeVoe Liam-DeVoe force-pushed the dashboard-react branch 6 times, most recently from 1471378 to cdec17c Compare February 15, 2025 23:54
@Liam-DeVoe
Copy link
Copy Markdown
Collaborator Author

pycrunch/pytrace should be doable to update. I'll do that, and then we should ship this, since it also fixes compatibility with newer hypothesis versions (hopefully the last of those now that namings have settled down).

Copy link
Copy Markdown
Owner

@Zac-HD Zac-HD left a comment

Choose a reason for hiding this comment

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

I've spun this up locally, and it looks great! I'll leave some more notes with followups below, but my inclination now is to merge this and take smaller incremental PRs to continue improving 😁

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

thoughts for later

  • we could test that this interface stays in sync with the Python definition
  • actually, since we're writing to a database, if it ever changes (likely!) we'd better be prepared to read older and perhaps newer versions...

previous_data = None
while True:
await poll_database()
# TODO use hypothesis db listening
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Soon! (not in this PR though, it's already Large)

Comment on lines +136 to +140
middleware = [
# allow pytrace to request pycrunch recordings for the web interface
Middleware(
CORSMiddleware,
allow_origins=["https://app.pytrace.com"],
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Noting for the future: some users will want to self-host this; so we'll eventually need a corresponding config option. (I don't think we can ship it, since the webapp is not open source)

@Zac-HD Zac-HD merged commit e79aab5 into Zac-HD:master Feb 18, 2025
13 checks passed
@Zac-HD
Copy link
Copy Markdown
Owner

Zac-HD commented Feb 18, 2025

Random notes from playing around with this:

  • obviously we'll want to use the ✨new pubsub db feature✨
  • zoomable / selectable graphs are pretty important
  • it'd be cool if clicking on a line on the graph took you to that test's page
  • the patches page says "waiting"; something like "no failing examples yet, so no patches either" might be clearer
  • in the minimal failing examples, I noticed that for tests using st.data() the interactive draws weren't printed
    • and as a more general principle, I think we should discard textually-identical entries in the list, since they're ~useless to the end user
  • I'd love to get a live/interactive demo on the website, and iirc we chatted about doing this by having the frontend consume data from either the python backend or a static json blob (with timing metadata?). They say you can solve (or at least move) almost any problem by adding another layer of abstraction...
  • maybe we should be running ts tooling in CI? e.g. prettier for formatting? Plus updating pinned deps. IDK, not an ecosystem I'm familiar with.

@Liam-DeVoe Liam-DeVoe deleted the dashboard-react branch February 18, 2025 21:33
@Liam-DeVoe
Copy link
Copy Markdown
Collaborator Author

lots of good stuff in that list, will work through it 👍. Brief notes:

  • +1 for prettier, just wanted to leave tooling for a higher scrutiny review
  • clicking on a graph line should already work (but hover tooltip ux needs work)

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.

Explore other dashboard tech options

2 participants