Skip to content

Campaign merge: distinct test_ids + per-test windowing (#507)#515

Merged
jepegit merged 1 commit into
masterfrom
507-campaign-merge
Jul 16, 2026
Merged

Campaign merge: distinct test_ids + per-test windowing (#507)#515
jepegit merged 1 commit into
masterfrom
507-campaign-merge

Conversation

@jepegit

@jepegit jepegit commented Jul 16, 2026

Copy link
Copy Markdown
Owner

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) is
rewritten:

c1.merge(c2)                       # campaign (default): distinct tests
c1.merge(c2, mode="continuation")  # classic fold == from_raw([f1, f2])

Campaign semantics: distinct compact test_id per source stamped on raw
(overwrites tester-assigned ids — provenance stays in
meta_test_dependent.test_ID), per-test metadata records via #506's
Data.tests (id remap verified equivalent to core's merge_test_meta),
globally renumbered cycles (v1 — the legacy summary format can't represent
duplicates; renumber_cycles=False raises NotImplementedError, deferred to
#511), offset data points, unshifted timelines, no cumulative
carry-forward
. Mixed cycle_modes store fine (warning); compute raises
MixedCycleModesError (#506 guard). Plus non-mutating merge_cells() and
test_meta.cycle_ranges_per_test().

Composite keys end-to-end (V2-03)

Raw test_id already survives into the core engine through the legacy bridge
and the step table groups on (test_id, cycle, step). The bridge strips the
column on the way out, so campaign objects (gated on _extra_tests) re-stamp
test_id onto the returned steps — the subsequent summary then flips
use_tid=True: joins on (test_id, cycle) and per-test windowing of
cumulative 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_id column appears).

Rode along

  • Fixed latent _append merge_step_table bugs (gate flag only set inside the
    merge_summary block; offset read from t2.raw instead of t2.steps;
    last_cycle NameError when recalc=False).
  • Replaced the dead/shadowed test_merge pair with a continuation-equivalence
    test (merge(mode="continuation")from_raw([f1, f2]) numerically).

Core's merge_data couldn't be used at the legacy seam (reads native schema
attribute names; verified AttributeError) — semantics mirrored; follow-up
core issue filed for bridge test_id preservation + legacy-schema support.

Verification

  • New suite test_merge_campaign.py: 12 passed (incl. real-data per-test
    cumulative-reset pin and save/reload)
  • uv run pytest -m essential: 99 passed
  • Full uv run pytest: 627 passed, 62 skipped, 14 xfailed — goldens
    untouched

🤖 Generated with Claude Code

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>
@jepegit jepegit added the v2 cellpy v2.0 epic work - PRs should target the master branch label Jul 16, 2026
@cursor

cursor Bot commented Jul 16, 2026

Copy link
Copy Markdown

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.

@jepegit
jepegit merged commit ef96891 into master Jul 16, 2026
4 checks passed
@jepegit
jepegit deleted the 507-campaign-merge branch July 16, 2026 20:56
@cursor
cursor Bot requested review from amundmr and juliawind July 16, 2026 21:05

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not approve: Cursor Bugbot is not enabled on this account, so no automated review signal is available for this substantial reader/merge change. Assigned amundmr and juliawind for human review.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router and Approver

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 cellpy v2.0 epic work - PRs should target the master branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v2: composite group keys + multi-file merge (V2-03/07)

1 participant