Offer released images only, newest first, and keep the panel moving (#170, #171, #172) - #174
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 fromcreated()andcheckInternet()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 USBSTATUScommand - 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