Skip to content

benchmarks(errors): add Reflex - #226

Merged
JuroOravec merged 8 commits into
mainfrom
benchmarks/errors-fw-reflex
Oct 21, 2026
Merged

JuroOravec merged 8 commits into
mainfrom
benchmarks/errors-fw-reflex

Conversation

@JuroOravec

Copy link
Copy Markdown
Member

Adds Reflex 0.9.10 to the error-prevention benchmark (#158, plan PR 7), the last framework from the performance benchmark, and publishes a combined run of all twelve frameworks. Stacked on #225; merge that first.

The app

  • The layout reflex init writes:

    • Components are plain typed Python functions; state uses rx.Field[...] and @rx.event.
    • Python packages are locked in uv.lock, and the browser packages in the reflex.lock/ folder that Reflex expects a project to commit.
  • Tools:

    • pyright (the editor);
    • ruff and reflex compile --dry (the check);
    • reflex run for the runtime check.

    No stricter setting qualifies; the notes say why.

  • Cost: reflex compile takes 0.4 s per case, and the browser check uses the dev server, so no production build is needed. Only 16 of the 53 ported cases needed the browser check, because the runner skips it once a static check reports an error.

Runner changes

  • A second reserved port for Reflex's backend, so parallel cases can't collide.
  • A python-traceback reader for reflex compile failures. It points at the last line of the app's own code.
  • Server output ends when the runner stops the server. Reflex prints an error line on every stop. Before the stop, the runner waits until the log stops growing, and every server runs with unbuffered Python output, so real errors are still recorded. No other framework's cell or evidence changed.
  • Image-load state in the page comparison. A broken image now counts as a visible change.
  • A run's inputs are named by a git tree id as well as the commit: the tree of cases, catalogue.toml, frameworks and runner. A rebase changes the commit hash but not this id, so a published run can still be checked against any branch. The README shows how.

Results

Reflex reports 37 of its 53 ported mistakes before the app runs, the most of any Python framework here.

  • Typed components: most input, slot and handler mistakes are pyright errors, because components are typed Python functions.
  • reflex compile: catches attribute typos on state objects, unknown event triggers and loops over non-lists.
  • Prevented:
    • m18: the request payload is built from the handler's parameter names.
    • m32: a numeric string is converted to a number.
    • m41: a Path is sent as text.
  • Missed, among others:
    • m12: a server-only secret held in Reflex state gets compiled into the page.
    • m45: a link to a missing route shows Reflex's own 404 page with no error.

Combined run

run --no-cache: 744 cases, about 37 minutes, every clean app passed. No cell, and no line of evidence, changed for the other eleven frameworks against #225's published run.

Framework Before the app runs Runtime Missed
Next.js (TypeScript) 44 of 56 4 8
Reflex 37 of 53 4 12
Nuxt (TypeScript) 39 of 57 4 14
Citry 29 of 60 11 20
ReactPy 23 of 55 11 21
FastHTML 20 of 48 10 18
django-unicorn 12 of 54 13 29
Tetra 9 of 56 16 31
Rusty + HTMX + Alpine 6 of 49 17 26
Django + HTMX + Alpine 6 of 51 15 30
django-components + HTMX + Alpine 6 of 53 20 27
Jinja + HTMX + Alpine 5 of 50 26 19

🤖 Generated with Claude Code

@JuroOravec
JuroOravec changed the base branch from main to benchmarks/errors-fw-tetra October 21, 2026 08:43
@JuroOravec
JuroOravec added this pull request to stack #219 October 21, 2026 09:13
Base automatically changed from benchmarks/errors-fw-tetra to main October 21, 2026 09:15
JuroOravec and others added 7 commits October 21, 2026 11:15
…re its cost

Phase 1 of PR 7 (Reflex). This adds the clean Reflex 0.9.10.post2 app,
its framework.toml (pyright, ruff, and `reflex compile --dry` as a check
stage; `reflex run` as the development server) and three measurement
cases: m08 (caught by reflex compile), m44 (runtime error) and m16
(silently wrong). The other 46 Reflex cases follow in phase 2, so
`citry-errors validate` lists them as missing until then.

Runner changes the app needs:
- a `{backend_port}` placeholder, a second reserved port, for a
  development server that runs its backend apart from the page;
- a `python-traceback` reader that points a failing Python command's
  finding at the traceback's last frame inside the app;
- the server-output record ends at the stop signal, because Reflex
  reports its killed frontend process as an error at every stop. The
  log file keeps everything.

Changing the runner changes every stored result's key, so the next run
reruns every framework.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…changes

Adds a Reflex case for each of the 49 mistakes: 40 ported, 6 not
applicable and 3 prevented (m18, m32 and m41). In a run with nothing
stored, 31 are static errors (28 in the editor, 3 from ruff or
`reflex compile`), 2 runtime errors and 7 missed, and only 9 cases
needed the browser check; the 49 cases took about 85 seconds with
`--jobs 5`. Reflex joins the report's order and its "Other Python
libraries" group, after ReactPy as in the performance report, and the
README, design doc and plan describe it. Nothing is published yet.

Review fixes:
- m32 is prevented: Reflex converts an event's text argument to the
  type the handler declares, which the catalogue counts as prevented.
- m05, m22 and m29 gain `indirect` notes for findings Python points at
  a call's first line or the end of the file; m14, m18, m41 and m12
  give more exact reasons.
- The server-output record now ends once the log has stopped growing,
  and every command runs with PYTHONUNBUFFERED=1, so a Python server's
  printed output is recorded while the page is checked. The design doc
  names the line that needs the cut (granian's intermittent
  `Unexpected exit from worker-1`) and what it cannot see.
- The python-traceback parser takes the exception from the unindented
  line after the last frame, accepts a bare exception name, and skips
  frames in generated dot-folders.
- The port-in-use check matches Reflex's message.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ison

The page record now holds, for every <img>, whether it loaded
(`complete && naturalWidth > 0`). Before it records the page, the
snapshot script waits up to two seconds for images still loading, so a
slow image is not read as broken. A misspelled image path that a
development server answers with a page and status 200, as Reflex's
does, breaks the image without any error, and only this value shows
it: Reflex's m48 moves from "never" to "silently wrong" (still missed).
No cell of the ten published frameworks is expected to change, because
their m48 cells are errors, which come first.

The README and design doc describe the new value and its error modes:
an image still loading, and a lazy image the browser never requests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…a rebase

A run now records, next to its commit, the git tree id of the
benchmark's inputs (cases/, catalogue.toml, frameworks/ and runner/)
and whether they had uncommitted changes. The published results/
folder is left out, because it changes after the run that wrote it.
GitHub rebases a stack of pull requests when it merges them, so the
commit a published run names can vanish from the branch; any commit
whose inputs give the same tree id has the same cases and tools.
matrix.md, report.html and results.json print the tree id, and the
README gives the two git commands that work it out for a commit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Reflex page gets the `Projects: 3` line, counted with Reflex's
`length()` on the project list var, and `id="board"` on the board
wrapper, and a case for each of m51 to m63. m51 does not apply:
Reflex gives every item `rx.foreach` renders its position as a key
when the page gives none, which is how Reflex's docs write the loop.
m60 and m63 carry `indirect` notes, because pyright and
`reflex compile` report them where the event is passed or at the
first line of the call.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…3 cases

- The Reflex card is keyed by its project's title, as the reference
  page asks of a list the browser updates in place, so m51 is a ported
  case that removes the key (Reflex then keys each card by position).
- The m60 handler prints the reason it takes, as the other ports do.
- The tree id reads the inputs with `git ls-tree --full-tree`, so the
  README's command gives the same id from any folder, records nothing
  when git fails or an input is missing, and the reports flag
  uncommitted changes to the inputs rather than to the whole folder.
- The development server is stopped even when its log cannot be read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Run 20261021T075938Z covers twelve frameworks and 744 cases from commit
caee448, benchmark inputs tree 9277cffd0 (this commit has the same
inputs), with nothing stored (about 37 minutes, --jobs 5). No cell of
the other eleven frameworks changed from #225's published run, and no
cell's evidence changed either: the image-load record, the server
output that now ends at the stop signal, and PYTHONUNBUFFERED for every
command moved nothing. Reflex: 37 static errors, 4 runtime errors,
12 missed, 6 not applicable, 3 prevented; 16 of its 53 ported cases
needed the browser check.

The docs page's "Catching errors" section and its data file, the
README, the design doc and the plan now include Reflex, after a prose
and claims review.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@JuroOravec
JuroOravec force-pushed the benchmarks/errors-fw-reflex branch from a16bd06 to 7957361 Compare October 21, 2026 09:15
GitHub rebased this branch when #225 merged. The run used caee448; its
inputs tree is unchanged and matches dd8e202 on this branch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@JuroOravec
JuroOravec merged commit 1cb6eeb into main Oct 21, 2026
3 of 4 checks passed
JuroOravec added a commit that referenced this pull request Oct 21, 2026
main matches the merged #226, which this branch already contains, so the
files are unchanged.
@JuroOravec
JuroOravec deleted the benchmarks/errors-fw-reflex branch October 21, 2026 10:56
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