Skip to content

feat(batch): typed LoadPolicy/CellSpec + resolve_specs (#699) - #728

Merged
jepegit merged 1 commit into
masterfrom
699-batch-v3-policy
Jul 26, 2026
Merged

feat(batch): typed LoadPolicy/CellSpec + resolve_specs (#699)#728
jepegit merged 1 commit into
masterfrom
699-batch-v3-policy

Conversation

@jepegit

@jepegit jepegit commented Jul 26, 2026

Copy link
Copy Markdown
Owner

A3 — batch v3: policy.py

Third arc of Epic A (batch v3, #696), on top of A2's package. Replaces the legacy update() kwargs tunnels (79 kwargs.pop/get, precedence documented only in a docstring) with typed options and one pure resolver. Additive — nothing removed.

cellpy/batch/policy.py

  • SourcePreferenceAUTO/CELLPY_ONLY/RAW_ONLY (replaces force_cellpy/force_raw).
  • LoadPolicy — batch-wide loading options (recalc, max_cycle, accept_errors, all_in_memory, skip_bad_cells, selector, loader_kwargs, per-field overrides).
  • CellSpec — fully resolved per-cell loading instructions.
  • resolve_specs() — the single precedence merge: journal columns < journal argument < policy overrides < per-cell, reproducing the legacy {**cell_spec_page, **kwargs, **cell_spec} (batch_experiments.py:361). parse_argument() coerces the "recalc=False;data_points=(1, 10000)" / dict forms exactly like _get_cell_spec_from_page.

Tests — tests/test_batch_v3_policy.py (9, all green)

Argument coercion (string/dict/null), three-layer precedence (property-style: journal→policy→per-cell each winning in turn), cell_typecycle_mode fallback, resolution over a real journal, LoadPolicy defaults.

Next: A4 (#700) — runner/result/store consuming these specs. Part of #696.

🤖 Generated with Claude Code

Third arc of Epic A (batch v3, #696). Replaces the legacy update() kwargs
tunnels (79 kwargs.pop/get; precedence smeared across ~200 lines) with:

- SourcePreference/LoadPolicy: typed batch-wide loading options
  (force_cellpy/force_raw/force_recalc -> fields).
- CellSpec: fully resolved per-cell loading instructions.
- resolve_specs(): the single, pure precedence merge
  journal columns < journal `argument` < policy overrides < per-cell,
  reproducing the legacy {**cell_spec_page, **kwargs, **cell_spec}
  (batch_experiments.py:361). parse_argument() coerces the string/dict
  argument form exactly like _get_cell_spec_from_page.

9 tests: argument coercion, three-layer precedence (property-style),
cell_type->cycle_mode fallback, resolution over a real journal.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jepegit jepegit added this to the v.2.1 milestone Jul 26, 2026
@jepegit jepegit added the cellpy2-stage4 cellpy 2.1 (Stage 4): batch/collectors redesign, utils waves 3-4, F6, shim removals label Jul 26, 2026
@cursor

cursor Bot commented Jul 26, 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 enabled auto-merge (squash) July 26, 2026 19:48
@jepegit
jepegit merged commit 06b147b into master Jul 26, 2026
6 checks passed
@jepegit
jepegit deleted the 699-batch-v3-policy branch July 26, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cellpy2-stage4 cellpy 2.1 (Stage 4): batch/collectors redesign, utils waves 3-4, F6, shim removals

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant