Keep _modified when collapsing a plan for a re-plan - #886
Conversation
The flag says a member is a trim of its source rather than the whole of it, and _load_member reads it as exactly that: a member without it loads its source untrimmed. collapse_working_df dropped the column one line before the re-plan read it, and _build_members assumes no source was modified when it is absent -- so a 500-sample slice of a 2000-sample file came back marked "load whole", and the loader duly read all 2000. chunk(time=2).chunk(time=3) reported 4500 samples from a 2000-sample patch and now gives 1500, byte-identical to chunking once; chunk(distance=100).chunk(distance=None) raised CoordMergeError and now rebuilds the patch; and the selection in #871 keeps its 201 samples rather than growing to 252 with 51 duplicated. The np.zeros fallback stays -- build_chunk_plan also runs on plain relations which never carried the column. It was only wrong for a frame which had one and lost it.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe change preserves ChangesPlanned catalog trim state
Suggested labels: Mergeability Score: ⚪ Minimal · up to The change preserves trim metadata during re-planning and adds focused regression coverage; no actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #886 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 177 177
Lines 20797 21077 +280
==========================================
+ Hits 20797 21077 +280
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:
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
Description
Fixes #871.
_modifiedon a plan member says the member is a trim of its source rather than the whole of it, andPlanResolver._load_memberreads it as exactly that: a member without it loads its source with no trim at all.collapse_working_dfdropped the column one line before the re-plan read it, and_build_membersfalls back to "no source was modified" when it is absent. Every collapsed row was a trim, so the fallback asserted the opposite of the truth, theunchangedtest below it was then satisfied trivially — a member's range always equals its own range — and a 500-sample slice of a 2000-sample file came back marked "load whole".Keeping the column is the whole fix.
The
else np.zeros(...)fallback in_build_membersstays:build_chunk_planis also called on plain relations which never had the column. It was only wrong for a frame which had one and lost it.What changes
chunk(time=2).chunk(time=3): 4500 samples → 1500, which is whatchunk(time=3)gives directly (two full 3-second chunks; the trailing 2 s is partial and dropped by default). The two paths now yield byte-identical data.chunk(distance=100).chunk(distance=None): raisedCoordMergeError— three members each reloading the full 300-channel patch, handed to an assembler asked to vary them alongdistance— and now rebuilds the original patch exactly.No existing test needed updating.
Note for #883
#883 (phase 3c of the inventory work) met this from the other side: channel-level
selectbuilds a plan whose pieces deliberately do not cover their source, so collapsing one loaded back the channels it had removed. It guards against that with alossyflag which refuses to collapse such a plan.With this fix applied and that guard disabled,
select(coupling="trench").chunk(distance=None)already loads the correct channels — so the guard is belt-and-braces rather than the fix. It is worth keeping either way ("a plan which dropped data must not be re-derived from the data it dropped" holds however the bookkeeping is spelled), and the two do not conflict: a lossy plan simply never reaches the collapse this corrects.Changelog
chunk(...).chunk(...)and a re-chunked selection over-included and duplicated samples (Re-chunking a selected chunked spool ignores the select, duplicating samples #871).Checklist
I have:
docs/contributing/general_guidelines.qmd).I have (if applicable):
Summary by CodeRabbit
Bug Fixes
Tests