Skip to content

Test that a selector outside the input block keeps its order - #1615

Open
Somberland wants to merge 1 commit into
frenck:mainfrom
Somberland:fix/selector-key-order
Open

Test that a selector outside the input block keeps its order#1615
Somberland wants to merge 1 commit into
frenck:mainfrom
Somberland:fix/selector-key-order

Conversation

@Somberland

@Somberland Somberland commented Sep 6, 2026

Copy link
Copy Markdown

Description

A guard test for the scoping decision in #1597: the settings of a selector are settled by walking the input block, not by looking for the key wherever it turns up. This adds the case that pins that down, a mapping named selector sitting in the data of an action, where the order is the author's and has to keep counting.

It passes on main as it stands. This is a regression test, not a fix.

Motivation and Context

I came at #1597 from the other end and late: I ran into the reordering on a blueprint of my own on 5.4.0, worked out where it came from, and had opened this PR as a fix before noticing the same fix was already merged and simply not in a release yet. Everything else I had is already covered by the tests that came with it. This one case was not, so that is all this is now.

How has this been tested?

Full suite on main with the test added: 1701 passing. Ruff clean, pylint 10.00/10.

Changing _compared to settle any selector key wherever it appears, rather than walking the input block, makes it fail. Which is the point of it.

Screenshots (if appropriate):

None.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 02535e1d-c8b0-43db-89e8-665ea0a87699

📥 Commits

Reviewing files that changed from the base of the PR and between 3343771 and f7b9f4f.

📒 Files selected for processing (1)
  • tests/ectoplasms/blueprint/test_update.py

Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The update comparison now recursively normalizes mapping keys inside blueprint selectors, including nested inputs. Selector key reordering no longer changes fingerprints or settings reports. Selector value changes and unrelated mapping reordering remain detectable. Tests and documentation cover the behavior.

Changes

Selector order normalization

Layer / File(s) Summary
Normalize selectors during comparison
custom_components/spook/ectoplasms/blueprint/update.py
Selector mappings are recursively settled while sequence order remains unchanged. Fingerprints, settings differences, and arrangement checks use the settled input data.
Validate selector comparison behavior
tests/ectoplasms/blueprint/test_update.py, documentation/integrations/blueprint.md
Tests cover reordered selector keys, changed selector values, and order-sensitive unrelated mappings. Documentation describes selector fingerprinting behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to f7b9f

The change adds regression coverage so selector configuration reordering inside blueprint inputs does not trigger false updates, while selector-like mappings elsewhere retain their authored order. No merge-blocking risk is evident.

Suggested reviewers: frenck

Poem

A rabbit sorts the selector keys,
While keeping lists in their old breeze.
Same values rest without alarm,
New settings still raise their charm.
“No false updates,” the rabbit sings.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 2 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The description clearly explains the regression test, its scope, motivation, and validation results. It directly matches the changeset and pull request objectives.
Title check ✅ Passed The title clearly identifies the primary change: testing that a selector outside the input block preserves its key order.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Sep 6, 2026
@Somberland Somberland changed the title Settle selector key order before fingerprinting a blueprint Test that a selector outside the input block keeps its order Sep 6, 2026
@Somberland
Somberland force-pushed the fix/selector-key-order branch from 3343771 to f7b9f4f Compare September 6, 2026 19:04
@sonarqubecloud

sonarqubecloud Bot commented Sep 6, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant