Sparse fixes - #1164
Conversation
Pyright Type CompletenessView the full Project (full
Other symbols referenced but not exported by
Symbols without documentation:
Patch (exported symbols added or changed by this PR): no exported symbol type-completeness changes detected. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1164 +/- ##
==========================================
+ Coverage 90.94% 91.27% +0.32%
==========================================
Files 91 91
Lines 5325 5422 +97
Branches 675 691 +16
==========================================
+ Hits 4843 4949 +106
+ Misses 344 339 -5
+ Partials 138 134 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5cb7d16. Configure here.
henrydingliu
left a comment
There was a problem hiding this comment.
passes sparse tests here

Summary of Changes
Remove blockage for #1157.
Related GitHub Issue(s)
#1155
Additional Context for Reviewers
Trying to fix this revealed some bugs, mainly in-place assignment to
Triangle.valueswith a sparse backend, which I explicitly forbid (earlier, would have just failed with a cryptic error message). The other was assignment to a Triangle column, which had a bug.uv run pytest) and documentation changes (uv run jb build docs --builder=custom --custom-builder=doctest)Note
Medium Risk
Changes core Triangle value storage and column assignment on the sparse path, which many estimators rely on; risk is mitigated by expanded tests and clearer failure modes for unsupported in-place mutation.
Overview
Fixes sparse backend behavior around column assignment, numpy interoperability, and mutating
values, unblocking related work on sparse triangles (#1155 / #1157).Sparse column assignment (
Triangle[...] = value): Replacing an existing column no longer rebuilds viadrop(key); it filters the target column out of the current COO coordinates and merges new data. Assignments can use a Triangle or a raw COO array, aligned with the numpy path. Misaligned new-column concatenation also catchesAssertionError.In-place
valueswrites on sparse are explicitly rejected:COO.__setitem__raises a clearTypeErrordirecting users to the numpy backend (instead of obscure failures).__array__on sparse triangles returns a dense array sonp.asarray(triangle)behaves predictably.CI adds workflow concurrency so duplicate pytest runs on the same branch/ref cancel in-progress jobs.
Tests are updated to run on both backends where relevant and to expect or skip in-place
valuesmutation on sparse.Reviewed by Cursor Bugbot for commit 254ca05. Bugbot is set up for automated code reviews on this repo. Configure here.