Skip to content

Fix comparisons of unchanged linked trait values - #988

Open
MbappeWU wants to merge 1 commit into
ipython:mainfrom
MbappeWU:fix/link-value-comparison
Open

MbappeWU wants to merge 1 commit into
ipython:mainfrom
MbappeWU:fix/link-value-comparison

Conversation

@MbappeWU

@MbappeWU MbappeWU commented Oct 4, 2026 •

Copy link
Copy Markdown

Fixes #756.

The post-propagation consistency checks compare a trait value with change.new even when they are still the same object. For values such as pandas DataFrames, inequality produces a non-scalar result and its truth conversion raises, interrupting normal link updates and later observers.

Add the protected _should_update comparison hook suggested in the issue. Its default accepts object identity and retains inequality for distinct values. Both consistency checks use the hook, so subclasses can customize comparison without replacing the propagation methods. Existing scalar equality and broken-link detection remain intact.

The regressions exercise both directions, observer continuation, equal-but-distinct replacements, custom comparison through actual propagation, and recovery of the updating flag. The guide documents that this is a consistency check after writing the other trait, rather than a condition that suppresses the write.

The upstream Tests run passes all 26 tasks, including Linux/Windows/macOS, PyPy and free-threaded Python, minimum and prerelease dependencies, typing/lint, docs, source-archive installation, the dry-run release check, and all five downstream projects.

Agent assistance: Codex 🤖🤖.

Agent assistance: Codex 🤖🤖.
@codecov

codecov Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.43750% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 93.27%. Comparing base (c4f1247) to head (34fc553).

Files with missing lines Patch % Lines
tests/test_traitlets.py 98.27% 0 Missing and 1 partial ⚠️
Components Coverage Δ
traitlets 85.70% <100.00%> (+0.06%) ⬆️
tests 99.06% <98.27%> (-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.

@MbappeWU
MbappeWU marked this pull request as ready for review October 4, 2026 20:32
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

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.

Notifying a trait with a DataFrame instance throws Value Error

1 participant