Files
pictureFrame-webApp/tests/Functional
football2801 f30a6a8f87
CI / test (push) Has been cancelled
fix(devices): bootstrap-bypass when device sends no X-Current-Image-Id
A freshly-claimed device (BOOT-button reset → buyer logs in / registers
→ linkToUser sets noon-daily wakeTimes default) was polling every 15s
per the firmware's FIRST_IMAGE_POLL bootstrap, but the server's
schedule-gating refused to run advance() because we weren't at noon
yet. Result: panel sat dark from claim until the next wakeTime fired,
which could be hours away.

Add a third bypass case in DeviceImageController::image: when the
device sends no X-Current-Image-Id header (i.e. its NVS img_id is
still -1, meaning it has never successfully painted an image),
treat the poll as a bootstrap and advance() regardless of schedule.
Once the panel paints, the next poll carries X-Current-Image-Id and
schedule-gating resumes.

Compatible with all the existing bypass logic:
  - Locked image still wins.
  - Cold-boot resync (X-Boot-Reason: cold) still bypasses.
  - The just-provisioned + stale-binding 204 returns BEFORE this
    branch, so a stranger device still can't pull the seller's image.

Test: bootstrap_poll_advances_even_when_schedule_says_not_due — sets
wakeTimes such that schedule says not-due, then polls without the
X-Current-Image-Id header and verifies a new history row was written.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 19:01:56 -04:00
..