Skip to content

Pack sdk-nrf remote builds without platformio.ini or idedata - #2983

Merged
Jonathan Swoboda (swoboda1337) merged 3 commits into
esphome:mainfrom
swoboda1337:sdk-nrf-toolchain-artifacts
Oct 27, 2026
Merged

Jonathan Swoboda (swoboda1337) merged 3 commits into
esphome:mainfrom
swoboda1337:sdk-nrf-toolchain-artifacts

Conversation

@swoboda1337

@swoboda1337 Jonathan Swoboda (swoboda1337) commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

What does this implement/fix?

toolchain_artifacts() has entries for esp-idf and arduino only, so an sdk-nrf build (nRF52 built natively with west) falls back to the PlatformIO entry: idedata=True, platformio_ini=True. esphome never writes an idedata cache for sdk-nrf builds (esphome idedata refuses the toolchain), so packing an nRF52 remote build fails with idedata cache missing for <config>.yaml.

This adds sdk-nrf to the table with neither file required. A platformio.ini that is present is still packed, so this works with current esphome, which writes one for sdk-nrf builds, and with esphome/esphome#21704, which stops writing it. That PR should not merge until this one ships, because without this entry the receiver also raises platformio.ini missing, and the offloader's unpack step rejects a tarball without it.

Related issue or feature (if applicable):

  • N/A

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

Frontend coordination

  • No frontend change needed
  • Companion frontend PR: esphome/device-builder-frontend#

Checklist

  • The code change is tested and works locally.
  • Pre-commit hooks pass (ruff, codespell, yaml/json/python checks).
  • Tests have been added or updated under tests/ where applicable.
  • components.index.json / definitions/components/*.json have not been hand-edited (regenerate via script/sync_components.py if a sync is needed).
  • Architecture-level changes are reflected in docs/ARCHITECTURE.md and/or docs/API.md.

New tests: an sdk-nrf build packs without an idedata cache, with and without platformio.ini (tests/test_remote_build_artifacts_download.py), and round-trips through pack and unpack, also with and without platformio.ini (tests/test_remote_artifacts_materialise.py). Both fail on main; with platformio.ini present and no idedata, main raises idedata cache missing. Tested with unit tests only, not with a real remote build between two hosts.

esphome writes no idedata cache for sdk-nrf builds, so the toolchain table's PlatformIO fallback made every sdk-nrf remote build fail to pack.
@swoboda1337

Copy link
Copy Markdown
Member Author

ESPHome Bot (@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.

🟢 Approval recommended

The narrow policy change covers packing and materialisation, with focused regression tests and no unresolved issues identified.

No open issues 🎉

What changed in this PR

Fixes remote-build artifact handling for native nRF52 sdk-nrf builds by removing PlatformIO metadata requirements.

Changes:

  • Marks sdk-nrf as requiring neither an idedata cache nor platformio.ini.
  • Adds packing coverage with and without an optional platformio.ini.
  • Adds a pack-and-materialise round-trip test without either metadata file.
File Description
tests/​test_remote_build_artifacts_download.py Updates the fixture and tests sdk-nrf packing with optional PlatformIO configuration.
tests/​test_remote_artifacts_materialise.py Tests sdk-nrf artifact round-tripping without PlatformIO metadata.
esphome_device_builder/​constants.py Adds sdk-nrf artifact requirements to the shared toolchain table.

Review effort: Balanced

@codspeed

codspeed Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 28 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing swoboda1337:sdk-nrf-toolchain-artifacts (bf43b4e) with main (1adedf4)

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports. ↩

@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.76%. Comparing base (1adedf4) to head (bf43b4e).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2983   +/-   ##
=======================================
  Coverage   99.76%   99.76%           
=======================================
  Files         300      300           
  Lines       26430    26430           
=======================================
  Hits        26368    26368           
  Misses         62       62           
Flag Coverage Δ
py3.12 99.72% <ø> (-0.01%) ⬇️
py3.14 99.61% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
esphome_device_builder/constants.py 100.00% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@esphbot

ESPHome Bot (esphbot) commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Previous review — superseded by a newer review below.

@esphbot ESPHome Bot (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.

@swoboda1337

Copy link
Copy Markdown
Member Author

ESPHome Bot (@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.

🟢 Approval recommended

The narrow shared-policy change covers both artifact paths, with targeted regression tests and no identified blocking issues.

No open issues 🎉

Review effort: Balanced

@esphbot

Copy link
Copy Markdown
Contributor

PR Review — Pack sdk-nrf remote builds without platformio.ini or idedata

Both earlier suggestions are fixed. Merge-ready.

The fix is one row in _TOOLCHAIN_ARTIFACTS. The pack-side and unpack-side requirement checks both read that table, so it fixes both sides without a toolchain-specific branch in either path. A platformio.ini that is present is still packed. That keeps compatibility with current esphome, which writes one for sdk-nrf builds, and with esphome/esphome#21704, which stops writing it.

  • Earlier suggestion 1 (the fixture wrote the sdk-nrf idedata file and then deleted it) is fixed. _write_receiver_state now skips the write when toolchain != "sdk-nrf", so paths never holds a stale idedata_path (tests/test_remote_build_artifacts_download.py:715).
  • Earlier suggestion 2 (the round-trip test skipped the case with platformio.ini) is fixed. The materialise round-trip is now parametrized over with_platformio_ini, so it covers the configuration current esphome ships.
  • Note, not a finding: as the PR description says, esphome#21704 must not merge until this has shipped, because older offloaders still reject sdk-nrf tarballs that lack platformio.ini.

✅ Resolved since last review (1)

Previously-flagged issues verified fixed
  • tests/test_remote_build_artifacts_download.py:711 Fixture writes the idedata cache for sdk-nrf and then deletes it


Checklist

  • Change delivers what PR description claims
  • Pack and unpack sides consistent
  • Test fixtures clear and isolated
  • Edge cases covered by tests
  • No security regressions

Automated review by Kōan (Claude) HEAD=bf43b4e 17s

@esphbot ESPHome Bot (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.

@swoboda1337
Jonathan Swoboda (swoboda1337) merged commit 3265bc7 into esphome:main Oct 27, 2026
22 checks passed
@swoboda1337

Copy link
Copy Markdown
Member Author

Thanks

@github-actions github-actions Bot locked and limited conversation to collaborators Oct 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bugfix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants