Campaign merge: distinct test_ids + per-test windowing (#507)#515
Merged
Conversation
Rewrite the dead CellpyCell.merge as the campaign-merge entry point (v2 themes V2-03/V2-07): fold different tests into one multi-test object with a distinct compact test_id per source stamped on raw (tester-assigned ids stay as provenance in meta_test_dependent.test_ID), per-test metadata records via the #506 Data.tests API (id remap mirrors cellpycore's merge_test_meta), globally renumbered cycles (v1; original numbering deferred to the native-schema path), offset data points, unshifted timelines, and no cumulative carry-forward. mode="continuation" keeps the classic fold, numerically identical to from_raw([f1, f2]) (untouched). New non-mutating merge_cells() helper and test_meta.cycle_ranges_per_test(). Composite keys end-to-end: raw test_id already survives into the core engine through the legacy bridge; campaign objects additionally re-stamp test_id onto the returned step table (gated on _extra_tests) so the subsequent summary uses per-test windowing (use_tid) - cumulative columns reset at test boundaries instead of running across unrelated tests. Pinned by a real-data regression test that doubles as the tripwire for future core bumps. Also fixes latent bugs in _append's merge_step_table branch (gate variable only set inside the merge_summary block, offset read from the wrong frame, NameError when recalc=False) and replaces the dead/shadowed test_merge pair with a continuation-equivalence test. Core merge_data/merge_test_meta could not be called directly at the legacy seam (native schema attribute names); semantics mirrored, gap reported in a follow-up cellpy-core issue. Closes #507. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Closes #507 — v2 Phases 1–2 (epic #402, themes V2-03/V2-07). Implements the
approved plan.
Campaign merge (V2-07)
CellpyCell.merge(previously dead code — wrong-arity caller, shadowed test) isrewritten:
Campaign semantics: distinct compact
test_idper source stamped on raw(overwrites tester-assigned ids — provenance stays in
meta_test_dependent.test_ID), per-test metadata records via #506'sData.tests(id remap verified equivalent to core'smerge_test_meta),globally renumbered cycles (v1 — the legacy summary format can't represent
duplicates;
renumber_cycles=FalseraisesNotImplementedError, deferred to#511), offset data points, unshifted timelines, no cumulative
carry-forward. Mixed
cycle_modes store fine (warning); compute raisesMixedCycleModesError(#506 guard). Plus non-mutatingmerge_cells()andtest_meta.cycle_ranges_per_test().Composite keys end-to-end (V2-03)
Raw
test_idalready survives into the core engine through the legacy bridgeand the step table groups on
(test_id, cycle, step). The bridge strips thecolumn on the way out, so campaign objects (gated on
_extra_tests) re-stamptest_idonto the returned steps — the subsequent summary then flipsuse_tid=True: joins on(test_id, cycle)and per-test windowing ofcumulative columns (they reset at test boundaries instead of running across
unrelated tests). Pinned by a real-data regression test that doubles as the
tripwire for future core bumps. Single-test and continuation objects are
untouched (safety pin asserts no
test_idcolumn appears).Rode along
_appendmerge_step_tablebugs (gate flag only set inside themerge_summaryblock; offset read fromt2.rawinstead oft2.steps;last_cycleNameError whenrecalc=False).test_mergepair with a continuation-equivalencetest (
merge(mode="continuation")≡from_raw([f1, f2])numerically).Core's
merge_datacouldn't be used at the legacy seam (reads native schemaattribute names; verified
AttributeError) — semantics mirrored; follow-upcore issue filed for bridge
test_idpreservation + legacy-schema support.Verification
test_merge_campaign.py: 12 passed (incl. real-data per-testcumulative-reset pin and save/reload)
uv run pytest -m essential: 99 passeduv run pytest: 627 passed, 62 skipped, 14 xfailed — goldensuntouched
🤖 Generated with Claude Code