Skip to content

Stop pinning the board-parse benchmark to fixture entry counts - #3064

Merged
J. Nick Koston (bdraco) merged 1 commit into
mainfrom
bench-board-smoke-count-free
Nov 12, 2026
Merged

J. Nick Koston (bdraco) merged 1 commit into
mainfrom
bench-board-smoke-count-free

Conversation

@bdraco

Copy link
Copy Markdown
Member

What does this implement/fix?

The board-parse benchmark's smoke check now compares the loaded pins and featured components against the fixture manifest's own entries instead of hard-coded counts, so the nightly device sync stops breaking CodSpeed whenever upstream edits the fixture board.

# before
assert len([_load_pin(p, board_id) for p in _smoke.get("pins", [])]) == 4

# after
assert raw_pins
assert [_load_pin(p, board_id).gpio for p in raw_pins] == [p["gpio"] for p in raw_pins]

Related issue or feature (if applicable):

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.

@bdraco

Copy link
Copy Markdown
Member Author

ESPHome Bot (@esphbot) review

Copilot AI balanced review requested due to automatic review settings November 12, 2026 15:28
@github-actions github-actions Bot added the bugfix Bug fix label Nov 12, 2026

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

There are no active review issues for this test-only update to fixture-relative board-parsing benchmark checks.

No open issues 🎉

What changed in this PR

This test-only change makes the board-parsing benchmark tolerate upstream fixture updates, addressing the CodSpeed failure in catalog-sync PR #3051.

Changes:

  • Replaces fixed entry counts with comparisons against the manifest’s pin GPIOs and featured-component IDs.
  • Retains nonempty checks and keeps smoke assertions outside the timed benchmark.
  • Updates the comment to explain the fixture-relative checks.
File Description
tests/​benchmarks/​test_startup.py Makes board-loader smoke checks independent of synced fixture entry counts.

Review effort: Balanced

@codspeed

codspeed Bot commented Nov 12, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 1 benchmark is dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 28 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing bench-board-smoke-count-free (2e7a6e9) with main (b2a5d76)2

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. ↩

  2. No successful run was found on main (50e9e22) during the generation of this report, so b2a5d76 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@codecov

codecov Bot commented Nov 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.77%. Comparing base (b2a5d76) to head (2e7a6e9).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3064   +/-   ##
=======================================
  Coverage   99.77%   99.77%           
=======================================
  Files         300      300           
  Lines       26564    26564           
=======================================
  Hits        26503    26503           
  Misses         61       61           
Flag Coverage Δ
py3.12 99.73% <ø> (ø)
py3.14 99.62% <ø> (ø)

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

🚀 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

Copy link
Copy Markdown
Contributor

PR Review — Stop pinning the board-parse benchmark to fixture entry counts

Merge-ready: a small test-only fix that removes the fixture-count brittleness and keeps the smoke check strict.

What this does well:

  • The new assertions compare against the manifest's own entries, so the benchmark stops breaking every time the nightly esphome-devices sync changes the fixture board.
  • The check is now stronger than the old count check. Each loaded pin's gpio and each featured component's id must match its source entry, in order. I confirmed in esphome_device_builder/definitions/__init__.py:175 and :252 that _load_pin and _load_featured_component copy these fields straight through.
  • The assert raw_pins and assert raw_featured checks keep the original purpose. Turning the loaders into no-ops still fails the test, and an empty fixture can't make the check pass trivially.
  • Indexing with _smoke["pins"] instead of .get(..., []) means a fixture that loses these keys fails with a clear KeyError rather than skipping the check.
  • The assertions stay outside @benchmark, so the timed per-iteration cost doesn't change.
  • The updated comment explains why counts aren't pinned, in one sentence.

No issues found.



Checklist

  • Smoke check still detects no-op loaders
  • Assertions kept outside the timed benchmark body
  • Diff matches PR description (test-only, fixture-relative checks)
  • No unsafe deserialization (FastestSafeLoader is a safe loader; noqa S506 justified)

Automated review by Kōan (Claude) HEAD=2e7a6e9 14s

@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.

@bdraco
J. Nick Koston (bdraco) merged commit c994e7d into main Nov 12, 2026
29 checks passed
@bdraco
J. Nick Koston (bdraco) deleted the bench-board-smoke-count-free branch November 12, 2026 16:56
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 14, 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.

3 participants