Skip to content

Remove ElementHolder backward-compatible tool aliases (PR #430 review) - #455

Merged
gupichon merged 1 commit into
199-elementholder-api-refurbishmentfrom
elementholder-api-refurbishment-review
Sep 30, 2026
Merged

gupichon merged 1 commit into
199-elementholder-api-refurbishmentfrom
elementholder-api-refurbishment-review

Conversation

@gupichon

@gupichon gupichon commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Description

Addresses kparasch's two review comments on #430 (Elementholder api refurbishment):

  • ToolHolder's 7 default-tool properties (chromaticity, crm, tune, trm, orbit, orm, dispersion) went through self._peer.get_X_tuning(name), a parallel lookup path that does the exact same _TOOLS dict lookup as self.get(name), just with a slightly different error message. Simplified to use self.get(name) directly.
  • ElementHolder kept 7 backward-compatible aliases (design.tune, .chromaticity, .orbit, .dispersion, .trm, .crm, .orm) for design.tool.<name>. Per review feedback, removed them outright rather than keep both spellings this early in development, and enforced design.tool.<name> as the only way to reach a mode's default tuning/measurement tool.

Related Issue

Review follow-up on #430 (part of epic #199, ElementHolder API refurbishment).
Not a separate tracked issue.

Features/issues described there are:

  • bugfix/cleanup: removed redundant lookup indirection in ToolHolder and dropped duplicate top-level accessors on ElementHolder, per reviewer request, to keep a single way to reach each default tool.

Changes to existing functionality

  • ElementHolder.tune/.chromaticity/.orbit/.dispersion/.trm/.crm/.orm properties removed. Every caller must now use design.tool.<name>. This is a breaking change for any code still using the short form.
  • ToolHolder's 7 properties now call self.get(name) instead of self._peer.get_X_tuning(name). ElementHolder.get_X_tuning(name) (the named, non-default lookup methods) are unchanged and still part of the public API.

Testing

The following tests were updated (no new tests needed, this is a removal/simplification):

  • ~44 call sites across tests/tuning_tools/test_tuning_dispersion.py, test_tuning_orm.py, test_tuning_orbit_correction.py, test_tuning_tools.py, and tests/diagnostics/test_diagnostic_accessors.py migrated to .tool.<name>
  • tests/tuning_tools/test_tool_accessors.py migrated, and test_tool_typed_properties_alias_existing_defaults removed (it only asserted the now-gone alias equalled .tool.<name>, tautological once the alias is gone)
  • examples/use_cases/01-tune_correction.{py,ipynb}, 03-orbit_correction.{py,ipynb}, examples/other_examples/ORM_Tango_server/ORM.py and the use_cases/README.md table updated to the new accessor

Verify that your checklist complies with the project

  • New and existing unit tests pass locally
  • Tests were added to prove that all features/changes are effective (existing coverage updated to exercise the new accessor path; no new behavior to cover)
  • The code is commented where appropriate
  • Any existing features are not broken (unless there is an explicit change to an existing functionality). The alias removal is exactly that explicit, reviewer-requested change

@gupichon

Copy link
Copy Markdown
Member Author

@kparasch, could you take a look at this PR?

@kparasch kparasch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ipynb files are my nightmare!

I think it looks good

@gupichon
gupichon merged commit 314ca97 into 199-elementholder-api-refurbishment Sep 30, 2026
3 checks passed
@gupichon
gupichon deleted the elementholder-api-refurbishment-review branch September 30, 2026 11:53
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.

3 participants