Skip to content

Offer released images only, newest first, and keep the panel moving (#170, #171, #172) - #174

Merged
eliasbakken merged 1 commit into
mainfrom
fix-170-172-image-list-and-screen
Sep 18, 2026
Merged

eliasbakken merged 1 commit into
mainfrom
fix-170-172-image-list-and-screen

Conversation

@eliasbakken

Copy link
Copy Markdown
Contributor

Fixes #170, #171, #172.

The picker (#171, #172)

It showed whatever order GitHub's payload arrived in, which put the newest image somewhere down the list instead of at the top, and it offered every release ever made - back to v0.1.0, which Reflash has never been tested against.

Both are now decided by one pure function in client/src/rebuildImages.js: releases at or above 1.0.2, drafts never, prereleases only when asked for, sorted newest first, each image listed once. Its own module because it is pure - payload in, list out - and that is the part worth testing. The de-duplication also settles the double fetch from created() and checkInternet() without having to work out which one wins.

"Show pre-releases" is a switch in the options panel, off by default: released images are what someone flashing a printer wants, and RCs are what the bench spends its days installing. The page keeps the releases payload it already fetched and the list is a computed over it, so flicking the switch re-filters what is in hand rather than asking GitHub again - a toggle should not spend a round trip, or a share of an unauthenticated rate limit, to answer a question about a list already on screen.

With today's releases and the switch off, the picker shows the four v1.0.2 variants.

The screen (#170)

The redraw lived inside refreshProgress, which runs from the HTTP poll and the USB STATUS command - both client-driven. A flash started from Recore-CI, from the control protocol, or simply with the browser closed therefore ran to completion behind a frozen panel.

The watchdog that already ticks every 500ms now samples while an operation is running, so the panel follows the board's own clock rather than the browser's. Idle costs nothing: an idle board has nothing new to say, and its screen is drawn by the events that change it.

The progress file the flashing scripts write became a var so the new tests can point it at their sandbox - the test helper is explicit that a test must not write real paths a running server might have open.

Tests

make test: Go, bats, and 154 vitest (11 new - the picker's ordering, floor, prerelease switch, de-duplication, junk payloads; and the screen sampling while busy but not when idle).

🤖 Generated with Claude Code

…170, #171, #172)

Three things from one pass over the picker and the screen.

The picker showed whatever order GitHub's payload happened to arrive in, which
put the newest image somewhere down the list rather than at the top (#171), and
it offered every release ever made - back to v0.1.0, which Reflash has never
been tested against and which is not recommended (#172).

Both are now decided in one pure function: releases at or above 1.0.2, drafts
never, prereleases only when asked for, sorted newest first, each image listed
once. Its own module because it is pure - payload in, list out - and that is
the part worth testing; the de-duplication also settles the double fetch from
created() and checkInternet() without having to chase which of them wins.

"Show pre-releases" is a switch in the options panel rather than a decision
taken here: released images are what someone flashing a printer wants by
default, and the RCs are what this bench spends its days installing. The page
keeps the releases payload it already fetched and the list is computed from it,
so flicking the switch re-filters what is in hand instead of asking GitHub
again - a toggle should not spend a round trip, or a share of an unauthenticated
rate limit, to answer a question about a list already on screen.

The screen (#170): the redraw lived inside refreshProgress, which runs from the
HTTP poll and the USB STATUS command - both client-driven. A flash started from
Recore-CI, from the control protocol, or simply with the browser closed ran to
completion behind a frozen panel. The watchdog that already ticks every 500ms
now samples while an operation is running, so the panel follows the board's own
clock and not the browser's. Idle costs nothing: an idle board has nothing new
to say, and its screen is drawn by the events that change it.

The progress file the scripts write became a var so the new tests can point it
at their sandbox; the helper is explicit that a test must not write real paths
a running server might have open.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@eliasbakken
eliasbakken merged commit 85d30df into main Sep 18, 2026
2 checks passed
@eliasbakken
eliasbakken deleted the fix-170-172-image-list-and-screen branch September 18, 2026 17:37
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.

Embedded screen not updating unless the web UI is open

1 participant