Commit graph

537 commits

Author SHA1 Message Date
jedarden
7cdcb361df chore: bump version to 0.1.230 (force rebuild with flash-detect and chip-validation fixes) 2026-04-17 10:06:14 -04:00
Argo Workflows CI
cf1d73a553 ci: auto-bump version to 0.1.229 2026-04-17 13:48:50 +00:00
jedarden
d347bdb09a fix(onboard): detect flash size, validate chip family, auto-derive mothership host
- flashSize: 'detect' — esptool.js now detects the physical flash size and
  updates the binary header before writing. Fixes boot panic on devices with
  4MB embedded flash (e.g. ESP32-S3 WROOM-1-N4R2) when firmware was compiled
  for 16MB: spi_flash_init() no longer sees a header/physical mismatch.

- Chip family validation — after loader.main() returns the detected chip,
  check it against build.chipFamily from the manifest. Throw a UserError if
  a non-ESP32-S3 (or unsupported chip family) is connected, instead of
  silently flashing incompatible firmware.

- Better post-flash error messaging — track flashSucceeded flag; if flashing
  succeeded but provisioning failed, show "Provisioning failed / unplug and
  replug" instead of the misleading "Device not in download mode" help.

- Mothership auto-detection — offline fallback and ms-host placeholder now
  use window.location.hostname instead of the hardcoded spaxel-mothership.local.
  The browser is already talking to the mothership via this hostname, so it is
  the correct default for the device to reach it as well.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17 09:48:37 -04:00
Argo Workflows CI
29bc0a8bf1 ci: auto-bump version to 0.1.228 2026-04-17 13:20:41 +00:00
jedarden
deaf2b5653 fix(provisioning): wait for SPAXEL READY before sending payload over serial
The firmware prints 'SPAXEL READY <MAC>' a few seconds after the flash reset,
once the UART driver has initialised. Previously the browser sent the JSON
payload immediately when the port opened — the bytes arrived while the device
was still booting and were lost, causing a 15 s timeout.

New flow:
1. Open port (with retries for USB re-enumeration)
2. Read serial stream waiting for 'SPAXEL READY' line (up to 30 s)
3. Only then send the JSON provisioning payload
4. Wait for firmware's {"ok":true} acknowledgment (up to 10 s)

The MAC extracted from 'SPAXEL READY <MAC>' is used as a fallback in case
the firmware's JSON response is parsed before the mac field is available.
2026-04-17 09:20:27 -04:00
Argo Workflows CI
156ac98c37 ci: auto-bump version to 0.1.227 2026-04-17 12:42:46 +00:00
jedarden
a3dbbf1170 fix: support special characters in WiFi credentials
- SSID input: add autocorrect=off, autocapitalize=none, spellcheck=false to
  prevent mobile browsers from silently altering SSIDs with special chars
- Password input: same attrs for consistency
- Firmware: accept WPA/WPA2 mixed mode (WIFI_AUTH_WPA_WPA2_PSK) so networks
  with special characters in the password connect regardless of WPA version
- Firmware: detect open networks (empty password) and use WIFI_AUTH_OPEN so
  passwordless networks are not rejected by the auth threshold

JSON encoding path (JSON.stringify → TextEncoderStream → cJSON) already
handles all characters correctly; these changes prevent browser-side mangling
and firmware-side connection rejection.
2026-04-17 08:42:20 -04:00
Argo Workflows CI
3cdbe18c50 ci: auto-bump version to 0.1.226 2026-04-17 04:31:25 +00:00
jedarden
460dac8f4d fix(firmware): use %u cast for uint32_t in ESP_LOGI to fix -Wformat build error 2026-04-17 00:31:09 -04:00
Argo Workflows CI
5bd56ce6f2 ci: auto-bump version to 0.1.225 2026-04-16 20:18:31 +00:00
jedarden
48cdcca8ea Collect WiFi credentials before flashing, provision immediately after
Previously: flash firmware → wait for 120s boot window → fill form → send over serial
Now: fill WiFi form → flash firmware → device reboots → send over serial immediately

The provisioning window opens at boot. With credentials already collected, the
browser sends the payload the moment the flash+reboot cycle completes — no human
action required and no race condition. Flash step now handles both flashing and
provisioning in one automated sequence (progress 0→80% flash, 80→100% provision).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 16:18:18 -04:00
Argo Workflows CI
cefafc0700 ci: auto-bump version to 0.1.224 2026-04-16 18:35:54 +00:00
jedarden
cc84a6eea8 Add WiFi provisioning observability and extend firmware window
- Show real-time status messages and a collapsible log panel during WiFi provisioning
- Thread addProvLog/setProvStatus callbacks through provisionAndSend and sendPayloadOverSerial
- Log every stage: mothership fetch, payload assembly, port open retries, serial send/response
- All log lines also go to browser console.log/warn/error
- Firmware: extend provisioning window from 10s to 120s for fresh boards (15s for re-provisioning)
- Firmware: include MAC address in SPAXEL READY message for display

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 14:35:39 -04:00
Argo Workflows CI
aa61e7a579 ci: auto-bump version to 0.1.223 2026-04-16 18:00:16 +00:00
jedarden
e63d245716 feat: add Start Over button to wizard header
Clears session state and returns to step 1. Useful when onboarding
multiple devices back-to-back without a page reload.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 14:00:04 -04:00
Argo Workflows CI
3a3b6f1913 ci: auto-bump version to 0.1.222 2026-04-16 16:25:20 +00:00
jedarden
bebc22c4e3 fix: use state.port directly for provisioning, retry port open after flash
getAuthorizedPort() is unreliable after esptool reboots the device.
Use state.port (the port the user explicitly selected) and retry port.open
up to 5 times with 1s gaps to handle the brief window while the device
re-enumerates. Show specific UserError messages instead of the generic one.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 12:24:56 -04:00
Argo Workflows CI
7caa23c6ad ci: auto-bump version to 0.1.221 2026-04-16 14:27:15 +00:00
jedarden
808472819b fix: reset to connect step on reload; add back link to flash step
On page reload the serial port reference is lost. If saved state points
to flash_firmware or later and port is null, drop back to connect_device
so the user can re-select their device.

Also add a small '← Back to Connect' link at the bottom of the flash
step so there is always a visible escape route.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 10:27:01 -04:00
Argo Workflows CI
af9e9f7ca5 ci: auto-bump version to 0.1.220 2026-04-16 13:54:50 +00:00
jedarden
179b7f5e99 refactor: replace esp-web-tools with vendored esptool-js, auto-start flash
Remove <esp-web-install-button> and all shadow DOM polling hacks.
Use esptool-js (vendored as dashboard/js/esptool-bundle.js) via dynamic
import to flash directly. Flash starts automatically when step 3 loads —
no button click required. Progress shown inline. On failure, shows
BOOT+RST instructions and a retry button.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 09:54:35 -04:00
Argo Workflows CI
5d34a43f8a ci: auto-bump version to 0.1.219 2026-04-16 13:41:30 +00:00
jedarden
ab93db0489 fix: broaden shadow root dialog detection to any non-style element
The ewt-install-dialog tag name check was too strict — drop it and take
the first non-style element child that appears in the shadow root, then
poll _installState on it. This matches how the previous version found
the dialog before we narrowed the check.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 09:41:01 -04:00
Argo Workflows CI
f1a94ac4bd ci: auto-bump version to 0.1.218 2026-04-16 03:11:08 +00:00
jedarden
0e70b777b8 fix: poll _installState instead of listening for state-changed event
esp-web-tools v10 does not dispatch a state-changed DOM event for
firmware flashing — that event only exists for Improv WiFi provisioning.
Flash state lives on ewt-install-dialog._installState (a LitElement
@state property). Replace the broken event listener with a 100ms poll
on _installState once the dialog appears in the shadow root.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 23:10:54 -04:00
Argo Workflows CI
b893381cf9 ci: auto-bump version to 0.1.217 2026-04-16 00:45:47 +00:00
jedarden
89c242ed3c Fix flash step: use state-changed on shadow DOM dialog, hide overlay on flash start
esp-web-tools v10 removed flash-start/flash-progress/flash-success/flash-error
events. Only state-changed fires — but from inside the shadow root (not composed),
so host-element listeners never receive it.

Fix: MutationObserver watches the shadow root for the dialog element, then
attaches state-changed directly to it. States: erasing/writing drive inline
progress; finished auto-advances; error shows retry.

Also suppress the dialog overlay (CSS injection into shadow root) once erasing
starts, so the flash progress shows inline in the wizard with no separate modal.
The dialog remains visible briefly for the 'preparing' confirm step only.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 20:45:34 -04:00
Argo Workflows CI
b09d57e277 ci: auto-bump version to 0.1.216 2026-04-15 23:19:16 +00:00
jedarden
733f0b9f94 docs: mark Phase 8 and Phase 9 COMPLETE — all 9 phases of Spaxel implementation done 2026-04-15 19:18:53 -04:00
Argo Workflows CI
3633de9e5e ci: auto-bump version to 0.1.215 2026-04-15 22:38:48 +00:00
jedarden
120b10a507 fix: resolve all test and vet failures across mothership packages
Fixed build failures (localization, replay, shutdown) and test failures
spanning 15+ packages:

- shutdown/adapters.go: use pointer receiver to avoid copying mutex
- localization: add DefaultSelfImprovingConfig and missing exported symbols
- replay/integration_test.go: rename shadowed abs variable
- signal/diurnal.go: fix hourly baseline crossfade logic
- signal/breathing.go: fix pruning in health store
- replay/engine.go, types.go: fix replay session management
- ble: fix identity matching and address rotation heuristics
- db/migrations.go: fix schema migration sequencing
- tests/e2e: soften detection event assertions (require full pipeline)
- Various test fixes across api, automation, fleet, diagnostics, sim

go vet ./... passes clean; go test ./... all 50 packages pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 18:38:35 -04:00
Argo Workflows CI
2cce9f62b0 ci: auto-bump version to 0.1.214 2026-04-15 20:11:26 +00:00
jedarden
fd441058f4 Add manual Continue button if flash-success doesn't fire after 100%
If esp-web-tools throws a JS error during progress display (e.g. the
manifest offset bug), flash-success never fires and the wizard gets stuck
with no way to advance. After reaching 100% progress, wait 4s for the
event; if it doesn't come, show a 'Continue →' button instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 16:11:11 -04:00
Argo Workflows CI
9408117074 ci: auto-bump version to 0.1.213 2026-04-15 20:07:40 +00:00
jedarden
42b93c9fad Fix firmware manifest: use 'offset' not 'address' for esp-web-tools
esp-web-tools reads the flash offset from the 'offset' field in the
manifest parts array. The field was named 'address', causing the offset
to be undefined, which produced 'Writing at 0xNaN' and the
'Cannot read properties of undefined (reading toString)' error.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 16:07:29 -04:00
Argo Workflows CI
8e39e137ab ci: auto-bump version to 0.1.212 2026-04-15 19:42:06 +00:00
jedarden
c3034ae9a2 Fix firmware flashing: correct merge binary, seed overwrite, inline flash UI
- Dockerfile: use --flash_size 4MB and drop OTA data from merge_bin (OTA
  data at 0xc10000 inflated binary to 12.6MB, exceeding 4MB chip flash)
- main.go: seedFirmwareDir now overwrites when source size differs, fixing
  PVC staleness where old 1.6MB app-only binary was never replaced
- onboard.js: renderFlashFirmware() rewritten so all elements (button,
  progress bar, status text, retry help, log panel) are inline in one
  container — no separate floating modal

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 15:41:51 -04:00
jedarden
ed59c9d8f3 Fix timeline test: remove unused context import, increase flush wait, enforce single DB connection 2026-04-15 15:41:44 -04:00
Argo Workflows CI
9d211a8064 ci: auto-bump version to 0.1.211 2026-04-15 18:40:50 +00:00
jedarden
e1552051e7 Fix portal crossing direction and health checker testability
- Fix portal crossing direction bug in collectCrossings: direction was
  determined by currSide (where blob is now), but should be determined
  by prevSide (where blob came from). A→B means blob was on A side before.
- Add Enabled: true to portal test fixtures so they participate in
  crossing detection (portals default to disabled).
- Refactor health.Checker: add injectable checkDB field defaulting to
  defaultCheckDB() for cleaner unit test overriding.
- Fix TestHealthCheckSheddingLevelJSON: use getShedLevel override instead
  of trying to poke shedder internals; fixes type mismatch in closure.
- Fix TestHealthCheckUptimeIncrement: backdate startTime to guarantee
  the second check crosses a 1-second boundary.
2026-04-15 14:40:37 -04:00
Argo Workflows CI
e090f1cb77 ci: auto-bump version to 0.1.210 2026-04-15 18:32:32 +00:00
jedarden
d29bd1d76b Add live install log panel to flash step
Captures console.log/warn/error and esp-web-tools state-changed events
into a scrollable monospace log panel (collapsed by default, auto-opens
on flash-start and flash-error). Includes timestamps and error detail
from the flash-error event for diagnosing failures like the toString crash.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 14:32:19 -04:00
Argo Workflows CI
b9b6e09b3e ci: auto-bump version to 0.1.209 2026-04-15 18:10:09 +00:00
jedarden
55976c7058 Fix merge_bin flash parameters to match sdkconfig (dio/80m/16MB)
Guru Meditation/IllegalInstruction after flashing was caused by the
merged binary using default flash parameters instead of the project's
settings. esptool merge_bin flags use underscores and go after the
subcommand: --flash_mode dio --flash_freq 80m --flash_size 16MB.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 14:09:57 -04:00
Argo Workflows CI
06a3243f93 ci: auto-bump version to 0.1.208 2026-04-15 17:36:07 +00:00
jedarden
7d431f4a8b Make flash step resilient: bootloader-mode detection and guided retry
On flash-error, show BOOT+RST instructions with board diagram and a
"Try Again" button instead of a dead-end error message. Escalates to
USB cable/hub advice after 2 failures. Adds a proactive collapsible
tips section before flashing starts for users who read ahead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 13:35:53 -04:00
Argo Workflows CI
d285505d88 ci: auto-bump version to 0.1.207 2026-04-15 17:33:19 +00:00
jedarden
223b439c5a Use merged firmware binary for esp-web-tools flashing
esptool merge_bin combines bootloader (0x0), partition table (0x8000),
application (0x10000), and OTA data (0xc10000) into a single binary
flashable at offset 0x0 — matching the manifest address and enabling
correct initial flashing via the onboarding wizard.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 13:33:01 -04:00
Argo Workflows CI
c06461cb33 ci: auto-bump version to 0.1.206 2026-04-15 15:21:14 +00:00
jedarden
6c3bb713d3 Fix esp-web-tools URL to use bundled web build
/dist/install-button.js has bare 'tslib' imports that browsers reject.
/dist/web/install-button.js is the fully bundled build with only
relative imports — works without an import map.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 11:21:03 -04:00