Skip to content

Machine: install the Digitone II page's build over USB MIDI (piece 3) - #1819

Draft
prodbysmolec wants to merge 18 commits into
repeat98:base/digitone-ii-nextfrom
prodbysmolec:machine/digitone-ii-usb-flash
Draft

prodbysmolec wants to merge 18 commits into
repeat98:base/digitone-ii-nextfrom
prodbysmolec:machine/digitone-ii-usb-flash

Conversation

@prodbysmolec

@prodbysmolec prodbysmolec commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator
  • What was wrong or hard: Piece 3 of the Digitone II goal: the page builds the Digitone II base, but installing it still needed Elektron Transfer. The OS upgrade sender (Improvement: send an Elektron OS upgrade over USB MIDI from the site's engine #1762, merged) had run on a unit only from a host script, never from the browser.

  • What this changes: UsbUpgradePanel under a verified build, for the machines in USB_UPGRADE_MACHINES.

    • It is offered only once the owner turns it on: USB_UPGRADE_ENABLED in protocol.ts, off for every machine, apart from downloads (DIGI_DOWNLOADS_ENABLED). So nothing changes on the page until then.

    • Once on, it asks for the same risk and recovery ticks as a download. useUsbUpgrade then:

      • asks for Web MIDI with SysEx;
      • finds the unit by name;
      • sends the build with os-upgrade.ts and shows its progress;
      • ends telling the person to press YES (or NO) at UPGRADE OS NOW? on the unit.

      Nothing presses anything on the unit.

    • A run belongs to its build: choosing another build or leaving the page cancels it, a pending MIDI permission included, and only one run goes at a time on the page.

    • The goal row, a verification record and a changelog entry. The fitBuilt fix found on the unit now comes through Fix: fit a Digitone II build by the device name the kit gives #1822 on the base branch.

  • How I checked it: browser tests against simulated Web MIDI ports that answer as the stock OS:

    • complete, unit missing, refused, MIDI not allowed;
    • the send disabled until both ticks;
    • cancellation: another build, leaving the page, a new panel while the old prompt is open, a change mid-transfer, and A → B → A;
    • the install off by default.

    npm run check passes against base/digitone-ii-next.

  • Tested on a unit: base 7a60d82e built on the page alone (2.0a) from my Digitone II's stock 1.12 and sent from the page in Chromium over USB, 19 November: upload complete in 6.5 s, YES on the unit, and it booted normally without the marker (record). That was before useUsbUpgrade was rewritten for cancellation. Still to run on this head: one send answered with YES and one with NO, with the image's SHA-256 in the record. Then this PR goes ready.

Edge cases

Case Why this change makes it a risk How run Result
Build, then send over USB from the page the whole page path the local site on the unit (19 November, before the cancellation rewrite) pass: YES, booted without the marker; to run again on this head
A build over the update limit refused near the end the first two sends pass: the page said the unit stays on its OS
NO at UPGRADE OS NOW? from the page the unit must stay on its OS not run still open: NO was not tried, neither from the page nor with #1762's sender (both records say so). The page has nothing to report after the upload; NO is the unit's own choice
The install while it is not turned on a beta user could install a build not approved useUsbUpgrade.test.ts pass: usbUpgradeEnabled is false for every machine until USB_UPGRADE_ENABLED says otherwise
A build with modules none existed then not run not run: Voice Spread (#2003) is still a draft
Another build chosen, or the page left, while the MIDI permission is pending the old image could be sent after permission jsdom test UsbUpgradePanel.test.ts with the real panel pass: zero sends of the old build, the listener given back, the new build sends only itself
A → B → A while the permission is pending the cancelled run's state came back with Send disabled the same test pass: A idle, Send enabled, only A sent
The build changes during a transfer the old image must not go on the same test, a unit answering slowly pass: no message after the change; on a unit: not run
  • What the guides lacked or got wrong, and where I fixed it: the goal page's flashing row said the page did not install yet. It now says how it does, and that the install is off until the owner turns it on.

🤖 Generated with Claude Code

prodbysmolec and others added 5 commits November 19, 2026 22:55
UsbUpgradePanel sends the verified build with os-upgrade.ts over Web MIDI after the same risk and recovery ticks as a
download; the unit asks UPGRADE OS NOW? and only YES there installs it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The kit's build result names its device ("Digitone II"), so fitBuilt passed the site's build through unpacked: the
unit then refused it at about 98 %, seen on a unit from the page. It now looks the limit up by name too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gitguardian

gitguardian Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@repeat98

Copy link
Copy Markdown
Owner

The USB upload can start after the user has left the build page. If the browser's MIDI permission prompt is still open when the panel unmounts or the selected build changes, runUsbUpgrade resumes with the old image as soon as permission is granted. The running flag belongs to the old component, so a newly mounted panel can start another send.

Please tie the pending permission request and transfer to the selected build, release the MIDI listener on cancellation, and check that the build is still current before sending. A browser test that changes builds while permission is pending should see zero sends for the old build. The routing conflicts and usage decision are tracked on #1812.

prodbysmolec and others added 6 commits November 22, 2026 19:32
The panel's send waited for the browser's MIDI permission and then sent the old image even after the person had
left the page or chosen another build, and the running flag lived in the old panel. Now each send carries an
AbortSignal tied to the build's SHA-256: choosing another build or unmounting aborts it, a permission granted after
that sends nothing, a transfer under way stops before its next message and gives the MIDI listener back, and a send
is refused unless its build is the one shown. One run at a time on the page: a newer panel's send waits for the old
run to end. A jsdom test changes builds and unmounts while permission is pending and sees zero sends for the old
build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tate in an effect

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@prodbysmolec

Copy link
Copy Markdown
Collaborator Author

Thanks, fixed in 2d960b1 (and a lint follow-up):

  • A run belongs to its build. useUsbUpgrade(name, build) takes the build's SHA-256, and each send carries an AbortSignal tied to it. Choosing another build or unmounting the panel aborts the run. A MIDI permission granted afterwards sends nothing and reports nothing. A transfer already under way sends no further message (the line refuses send and ends a pending wait), and the input's listener is given back in every case. send(syx, build) is refused unless that build is the one on the page.
  • The running flag no longer lives only in the old component. The page has one run at a time: a newer panel's send shows "Looking for the Digitone II…" and starts once the old run has ended (its stale permission answer cancels it). The shown state belongs to its build, so another build shows idle without an effect calling setState.
  • Browser test (src/components/UsbUpgradePanel.test.ts, jsdom, real panel and clicks): change builds while the permission is pending → zero sends for the old build, the listener released, then the new build sends only itself. Unmount while pending → zero sends, and a panel mounted later can send. A new panel pressing while the old prompt is open → the old answer sends nothing, the new one sends its own build. Change builds mid-transfer → no message after the change, fewer than the whole upload.

Merged the updated #1812 and #1762 (this branch builds on both), base/digitone-ii-next and main; pr:ready Ready. GitGuardian: the same false positive from main. The routing conflicts and the usage decision went with #1812.

@repeat98

Copy link
Copy Markdown
Owner

The cancellation tests pass, and changing builds stops sends for the previous image. I found one more case in the panel. I started a send for A, chose B while MIDI permission was pending, let the cancelled request finish and selected A again. Zero messages went out, but A showed “Looking for the Digitone II” with Send disabled. The hook still holds A’s cancelled connecting state. Could you reset the cancelled run’s displayed state and cover A → B → A without starting a send for B?

One evidence detail to reconcile while you’re here. This PR’s edge-case table says NO was checked with #1762. Both verification records say NO wasn’t tried. Please link the run if it happened, or update that row to say it’s still open.

@prodbysmolec

Copy link
Copy Markdown
Collaborator Author

Both done in e386ec5, after merging main and base/digitone-ii-next:

  • A → B → A. The panel's state now remembers the run that reported it, and a cancelled run's state is shown as idle. When its run ends cancelled, the state is cleared too. So A no longer shows "Looking for the Digitone II" with Send disabled. Two browser tests (UsbUpgradePanel.test.ts, real panel and clicks):

    • A sent with the permission pending, B chosen, the cancelled request finishes, back to A: A is idle, nothing was sent, the browser was asked only once (no send for B), and pressing Send for A sends only A (UPGRADE OS NOW?).
    • The same, but back to A while the old prompt is still open: A is idle, and the old answer sends nothing.

    Against the old hook both fail.

  • NO row. You're right, NO was never tried. The edge-case row now says it is still open, from the page and with Improvement: send an Elektron OS upgrade over USB MIDI from the site's engine #1762's sender alike.

npm run check -- --base <base/digitone-ii-next> passed; the board check against the base is clean.

@repeat98

Copy link
Copy Markdown
Owner

Thanks. A → B → A now comes back idle, and the NO row matches both records.

Before this goes into base/digitone-ii-next:

  1. Digitone II downloads are still off (DIGI_DOWNLOADS_ENABLED), but the panel appears under every verified build. That lets a beta user install a build that hasn't been approved for download, while the note right next to it says "Downloads open after review … Nothing was uploaded." Please put UsbUpgradePanel behind the same approval as downloads, or behind its own flag in protocol.ts that defaults to off, so turning installs on stays my decision.
  2. The unit record is from 19 November, before useUsbUpgrade was rewritten for cancellation. Please send from this head's page build on the unit and add the image's SHA-256 to the record: one send answered with YES, and one with NO, since the panel now tells people NO keeps their OS.
  3. The description is out of date. Machine: build on the Digitone II base from the site (binding, catalog, builder) #1812 and Improvement: send an Elektron OS upgrade over USB MIDI from the site's engine #1762 have both merged, the fitBuilt fix now arrives through Fix: fit a Digitone II build by the device name the kit gives #1822 on the base branch, and pr:ready no longer waits on Machine: build on the Digitone II base from the site (binding, catalog, builder) #1812. Please refresh it.

After that, mark it ready.

prodbysmolec and others added 3 commits November 25, 2026 12:21
…_UPGRADE_ENABLED, off), apart from downloads

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@prodbysmolec

Copy link
Copy Markdown
Collaborator Author

Points 1 and 3 are done in 1e2510f (then merged base/digitone-ii-next and main). Point 2 needs the unit, which isn't on USB today. I'll run it and add the record, then mark it ready.

  1. The install is off until you turn it on. USB_UPGRADE_ENABLED in protocol.ts is off for every machine. usbUpgradeEnabled() needs both that and USB_UPGRADE_MACHINES, so the panel no longer appears under a verified build, and it stays separate from DIGI_DOWNLOADS_ENABLED. Test: false for every machine, including hasOwnProperty as a name. The goal row and the changelog entry say it waits for you.
  2. On the unit, still to do: a send from this head's page build answered with YES and one with NO, with the image's SHA-256 in the record. I'll turn the flag on locally only for that run.
  3. The description is refreshed: Machine: build on the Digitone II base from the site (binding, catalog, builder) #1812 and Improvement: send an Elektron OS upgrade over USB MIDI from the site's engine #1762 merged, the fitBuilt fix through Fix: fit a Digitone II build by the device name the kit gives #1822, no pr:ready wait, and the edge cases, including the off switch and A → B → A.

@karigardarsson

Copy link
Copy Markdown
Contributor

Hey @prodbysmolec! Jannik suggested I look into porting your DN2 USB link and runtime loader to the DT2. Have you started anything on the DT2 side yet? Just want to make sure we're not stepping on each other's toes.

@repeat98

Copy link
Copy Markdown
Owner

Hey @karigardarsson - no he hasn't you can go ahead! :)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

3 participants