Skip to content

🤖🤖 Preserve observer definition order - #1001

Open
LittleChenLiya wants to merge 1 commit into
ipython:mainfrom
LittleChenLiya:fix/observer-definition-order
Open

LittleChenLiya wants to merge 1 commit into
ipython:mainfrom
LittleChenLiya:fix/observer-definition-order

Conversation

@LittleChenLiya

Copy link
Copy Markdown

Class-defined @observe handlers were registered alphabetically because descriptor discovery used sorted member inspection. This made callbacks for the same trait run in method-name order rather than declaration order.

Register descriptors declared on the class in class-body order while retaining the existing handling for inherited descriptors. Add a regression test using deliberately non-alphabetical observer names.

Refs #874

Validation:

  • New regression failed before the fix and passes afterward.
  • tests/test_traitlets.py: 401 passed.
  • Ruff lint and formatting checks passed.

🤖🤖

Register class-defined descriptors in declaration order so @observe
handlers for the same trait run in the order they are defined.

Refs ipython#874
@codecov

codecov Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.22%. Comparing base (a576f24) to head (91a79af).

Components Coverage Δ
traitlets 85.64% <100.00%> (+<0.01%) ⬆️
tests 99.07% <100.00%> (+<0.01%) ⬆️

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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