Skip to content

Fix Python collection reference comparisons - #218

Merged
leileizhang (lei9444) merged 3 commits into
mainfrom
lei9444-fix-collection-comparison
Oct 10, 2026
Merged

leileizhang (lei9444) merged 3 commits into
mainfrom
lei9444-fix-collection-comparison

Conversation

@lei9444

Copy link
Copy Markdown
Contributor

Python collection protocols compared projection objects rather than native reference identity: a JsonValue appended to JsonArray could not be found or removed through its class/raw view, and Object-valued maps could compare unequal to themselves.

Use one collection-only comparison helper backed by guarded canonical COM identity for sequence containment/search/count/removal, mapping equality, and value/item-view membership, including object_value_view(). Preserve ordinary Python value equality, ranged/first-match behavior, explicit native errors, raw Object conversion policy, and lifetime/thread checks. Concrete generated collection declarations describe these comparisons without widening read types or nullability.

Regression coverage exercises real generated mutable/read-only JSON and Object maps, class/interface/raw aliases, nulls, duplicates, boxed versus converted values, equal-content but distinct native identities, and released/non-agile/agile references. Global wrapper equality/hashing, ABI and collection-producer support, and bulk/default helpers remain unchanged.

Compare native collection references by guarded canonical COM identity across projected and raw views, preserving ordinary Python value equality and native error propagation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ed3ecfbc-fdc5-473b-aa81-2a6721f7b7b6
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Mixed-language test coverage

Workflow status: ✅ Passed

Layer Lines Functions Branches/regions
Rust, including native .pyd/.node 87.1% 82.66% 86.82% regions
Python aggregate 70.61% n/a 36.93% branches
Python runtime 98.2% n/a 94.57% branches
Generated Python WinRT projections 68.89% n/a 30.47% branches
Generated Python WinRT implementations 71.97% n/a 46.3% branches
JavaScript aggregate 18.5% 24.91% 56.05% branches
JavaScript runtime 44.27% 45.76% 78.99% branches
Generated WinRT projections 17.36% 19.38% 52.59% branches
Generated WinRT implementations 45.99% 59.19% 60.97% branches
Generated Classic COM projections 11.52% 23.97% 53.4% branches

View workflow run and download full HTML/LCOV/XML reports

leileizhang (lei9444) and others added 2 commits October 9, 2026 23:01
Keep all mapping entries during canonical key normalization and require one-to-one matches, preventing distinct Python alias keys from collapsing into a falsely equal mapping. Cover both operand directions, mutable/read-only native maps, and same/different alias values.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ed3ecfbc-fdc5-473b-aa81-2a6721f7b7b6
Keep the Uri dependency golden aligned with the concrete sequence containment declaration, including WwwFormUrlDecoder's class, protocol, and embedded read-only view.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ed3ecfbc-fdc5-473b-aa81-2a6721f7b7b6
@lei9444
leileizhang (lei9444) merged commit 8c5dc38 into main Oct 10, 2026
33 checks passed
@lei9444
leileizhang (lei9444) deleted the lei9444-fix-collection-comparison branch October 10, 2026 01:49
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.

2 participants