Skip to content

Show the flash engines' step lines in the web.esphome.io install dialogs - #1818

Merged
bdraco merged 7 commits into
mainfrom
web-install-details-log
Sep 25, 2026
Merged

bdraco merged 7 commits into
mainfrom
web-install-details-log

Conversation

@bdraco

@bdraco bdraco commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

What does this implement/fix?

The install dialogs on web.esphome.io now carry the same collapsible "Show details" log the Device Builder's install dialog has: every flash engine's step lines, so a failed flash shows the step it died in rather than one error line.

  • The dashboard's log toggle, download and ansi-log panel moved out of the install dialog's renderer into a shared <esphome-install-details-log> element that both the dashboard and the site use. The site slots it under the shared progress card (into the process-terminal card's status-extra, as the dashboard does) and its download saves esphome-web-install.txt; the dashboard keeps driving the expanded state (it opens the log on failure) and its own flushed download through the element's expanded-changed and cancelable download-log events.
  • The ESP flow already collected esptool's lines in the flow controller but never showed them; the shared progress card now passes them through, so the adoptable and upload dialogs get the log for free.
  • The nRF52 dialog feeds the 1200 baud touch's lines and the DFU engine's onLog into it; the Pico dialog does the same for the touch and the PICOBOOT engine. Both clear the log when the dialog closes.

No new copy: the toggle and download reuse the dashboard's firmware.show_details, firmware.hide_details and dashboard.logs_download strings.

Related issue or feature (if applicable):

Screenshots

Same visual as the Device Builder's install log, under the site's progress card.

Types of changes

  • Bugfix (non-breaking change which fixes an issue) — bugfix
  • New feature (non-breaking change which adds functionality) — new-feature
  • Enhancement to an existing feature — enhancement
  • Breaking change (fix or feature that would cause existing functionality to not work as expected) — breaking-change
  • Refactor (no behaviour change) — refactor
  • Documentation only — docs
  • Maintenance / chore — maintenance
  • CI / workflow change — ci
  • Dependencies bump — dependencies

Checklist

  • The code change is tested and works locally.
  • Screenshots (or a recording) are included for any UI feature or change.
  • pnpm run lint passes.
  • pnpm run test passes.
  • Tests have been added to verify that the new code works (where applicable).

@bdraco bdraco added the enhancement Improvement to an existing feature label Sep 25, 2026
@bdraco

bdraco commented Sep 25, 2026

Copy link
Copy Markdown
Member Author

@esphbot review

@bdraco
bdraco marked this pull request as ready for review September 25, 2026 22:30
Copilot AI lite review requested due to automatic review settings September 25, 2026 22:30
@bdraco

bdraco commented Sep 25, 2026

Copy link
Copy Markdown
Member Author

Cleanup pass: the log is now one shared <esphome-install-details-log> under src/components/, used by the dashboard's install dialog (its renderer and styles lost their copy; it drives expanded and takes over the download through the element's events so its flush-before-download stays) and by the site's progress card. The nRF test file is named after the element and uses the shared mount; the empty-lines guard lives only at the render sites.

@esphbot review

@esphbot

esphbot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Previous review — superseded by a newer review below.

@esphbot esphbot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

No blocking issues found — ready to merge.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Add the shared icon dependency and clear nRF log lines when retrying.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds shared collapsible flash-step logs to dashboard and web.esphome.io install dialogs.

Changes:

  • Extracts reusable log rendering and download controls.
  • Wires ESP, nRF52, and Pico flash logs into progress cards.
  • Adds component and dialog tests.
File Description
test/​web/​install-pico-dialog.test.ts Tests Pico log streaming.
test/​web/​install-nrf-dialog.test.ts Tests nRF logging and reset behavior.
test/​components/​install-details-log.test.ts Tests shared log behavior.
test/​components/​firmware-install-dialog-log-batching.test.ts Tests dashboard download batching.
src/​web/​install/​install-progress.ts Slots logs into web progress cards.
src/​web/​install/​esphome-web-install-pico-dialog.ts Captures Pico touch and flash logs.
src/​web/​install/​esphome-web-install-nrf-dialog.ts Captures nRF touch and DFU logs.
src/​components/​install-details-log.ts Provides the shared collapsible log component.
src/​components/​firmware-install-dialog/​styles.ts Updates log layout styling.
src/​components/​firmware-install-dialog/​renderers.ts Integrates the shared dashboard log.
src/​components/​firmware-install-dialog.ts Registers the shared log component.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/components/install-details-log.ts
Copilot AI review requested due to automatic review settings September 25, 2026 22:34
@esphbot

esphbot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Previous review — superseded by a newer review below.

@esphbot esphbot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

No blocking issues found — ready to merge.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Address the missing accessibility state, direct icon import, and nRF retry log clearing.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 3 Medium severity

Open (3)

Comment thread src/components/install-details-log.ts Outdated
Comment thread src/web/install/esphome-web-install-nrf-dialog.ts
Copilot AI review requested due to automatic review settings September 25, 2026 22:39
@bdraco

bdraco commented Sep 25, 2026

Copy link
Copy Markdown
Member Author

Addressed the two open suggestions and the Copilot thread:

  • Each run starts with a fresh log: the nRF dialog clears it at Install, the Pico dialog at Reset Device and at an Install that does not follow the reset step (so touch, wait and flash stay one log). Tests cover a retry without closing the dialog and the reset-then-install continuity.
  • The site opens the log on failure like the dashboard: the progress card passes expanded for the error state, and the element keeps the user's own toggle afterwards. New install-progress test.
  • The details-log element imports the icon component it renders.

@esphbot review

@esphbot

esphbot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Previous review — superseded by a newer review below.

@esphbot esphbot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

No blocking issues found — ready to merge.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Two moderate issues remain regarding expansion state persistence and accessibility.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
Resolved since last review (2)

Copilot AI review requested due to automatic review settings September 25, 2026 22:43
@bdraco

bdraco commented Sep 25, 2026

Copy link
Copy Markdown
Member Author

Added aria-expanded (string form) and aria-controls on the details toggle, with the element test covering both states.

@esphbot review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Preserve the site log’s expanded state across progress updates.

Review effort: Lite
Findings: None

Resolved since last review (1)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Parent rerenders reset the site log's expanded state

src/​web/​install/​install-progress.ts:80

The site callers do not own the log's expanded state, but this binding overwrites the child on every parent render. After a user opens "Show details" while flashing, the next progress/log update rerenders the card and sets expanded back to false (and a success transition also closes it), so the site log cannot stay open during the operation. Keep the expanded value in the site dialog/flow state and update it from expanded-changed, while still forcing it open on error.

@bdraco

bdraco commented Sep 25, 2026

Copy link
Copy Markdown
Member Author

On Copilot's latest overview note (the site's .expanded binding resetting a log the user opened): it does not. Lit commits a property binding only when its value differs from the last committed one, and while the flash runs that value stays false, so the child's own expanded (set by the toggle) is left alone across progress and log re-renders; the success transition binds false again and is likewise skipped. Only the error transition (true) is ever committed, which is the intended open-on-failure. Pinned in test/web/install-progress.test.ts ("keeps a log the user opened open across progress re-renders"), so nothing to move into the dialogs' state.

@esphbot review

Copilot AI review requested due to automatic review settings September 25, 2026 22:51
@esphbot

esphbot commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

PR Review — Show the flash engines' step lines in the web.esphome.io install dialogs

Ready to merge. The last open suggestion is fixed and I found no new issues.

What's resolved and working:

  • Accessibility of the toggle: the Show details button now sets aria-expanded with a string value, so it renders on both states. It also sets aria-controls="log" while the panel is open. The #log id is in the same shadow root as the button, so the reference works. The element test checks both states.
  • One shared element: <esphome-install-details-log> removes the duplicated markup and CSS from the dashboard renderer and styles. The dashboard still flushes its log before downloading: it cancels the download-log event, and the batching test checks that.
  • ESP flow: InstallFlowController.logLines already existed and is cleared on each run. The progress card now passes those lines through, so the adoptable and upload dialogs show the log with no extra wiring.
  • Per-run log reset: the nRF dialog clears the log at Install. The Pico dialog clears it at Reset and at an Install that doesn't follow the reset, so a reset followed by an install stays one log. Tests cover both, including a retry without closing the dialog.
  • Open on failure (site): .expanded=${card.state === "error"} only takes effect when the value changes. A log the user opened stays open across progress re-renders, as the author explained in their reply and test/web/install-progress.test.ts checks.

No remaining findings.


✅ Resolved since last review (1)

Previously-flagged issues verified fixed
  • src/components/install-details-log.ts:61 The Show details toggle doesn't tell screen readers whether it is open


Checklist

  • No hardcoded secrets
  • Log state resets at the start of each install attempt
  • PR description goals delivered
  • Accessibility of the toggle control (aria-expanded/aria-controls)
  • Localization reuses existing keys, no orphans
  • Tests cover new behavior
  • File size within the 500-600 line cap

Automated review by Kōan (Claude) HEAD=09d204a 18s

@esphbot esphbot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

No blocking issues found — ready to merge.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Address the missing test mocks and prevent failure-state rerenders from reopening a user-collapsed log.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)

Comment thread src/web/install/install-progress.ts
Copilot AI review requested due to automatic review settings September 25, 2026 22:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Progress updates reset the user-controlled details-log expansion, causing the log to close during flashing.

Review effort: Lite
Findings: None

Resolved since last review (1)

@bdraco
bdraco merged commit 5838c4c into main Sep 25, 2026
13 checks passed
@bdraco
bdraco deleted the web-install-details-log branch September 25, 2026 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improvement to an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show the flash engines' step lines in the web.esphome.io install dialogs

3 participants