Skip to content

Name groups: library labels, legend captions, manifest + journal persistence (#187) - #191

Merged
jepegit merged 7 commits into
mainfrom
cursor/187-group-names-713a
Oct 4, 2026
Merged

jepegit merged 7 commits into
mainfrom
cursor/187-group-names-713a

Conversation

@jepegit

@jepegit jepegit commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Closes #187.

Stacked PR — based on cursor/184-defer-replot-cells-modal-713a (PR #190, itself stacked on #189). Merge #189 → #190 → this one; GitHub retargets the base to main when the previous branch is deleted after its squash merge. The diff shown against the stacked base is this issue only.

What

Groups can now be named, and the name follows the group everywhere:

  • Manage cells modal — a new Groups strip above the table: one chip per group in use (swatch, number, editable name with a group <n> placeholder, cell count). Blank restores the default. Renames follow the deferred-replot rule from update plots when cells modal closes #184. Group number inputs (sidebar + table) show the group name as a tooltip.
  • Plots — collect._batch hands cellpy the name as group_labels, so group-averaged traces are named after it. Per-cell traces of a named group get a Plotly legendgrouptitle (summary + cycles pane) via collect.group_titles().
  • API — /api/state carries groups: [{id, label, name, n_cells, color}]; POST /api/groups/{group} with {"label": "…"} sets the name and returns the state. CellMeta.group_label is the effective name.
  • Projects — project.json gains an optional groups: [{id, label}] section (saved for named groups that hold cells; older manifests still open).
  • Journals — cellpy_adapter.load_journal() returns (cells, group_labels) read from the journal's group_label column (cellpy's group <n> placeholders are not treated as names). load_journal_cells() stays as a thin wrapper. The journal job applies the names.

Design

Names are library-level (Library._group_labels, keyed by group number), not a per-cell field. Library.all() stamps a CellRecord.group_label snapshot so the collectors see it without threading a map through every call site. See .issueflows/04-designs-and-guides/manage-cells-modal.md → "Group names".

Tests

  • tests/test_core.py: library semantics; names reach the grouped legend; legend-group titles on ungrouped summary and cycles figures.
  • tests/test_projects.py: save → open round trip; manifest without groups.
  • tests/test_journal.py: group_label read (present/absent); journal job applies names via the API.
  • tests/test_api.py: /api/groups/{group} + state shape.
  • tests/test_gui_playwright.py (e2e, local): name / un-name a group in the modal, legend caption after close.

uv run pytest -q -p no:warnings: all green (3 skips, example data).

Walkthrough

Demo cells → regroup two cells into group 1 → name it "Anodes" in the Groups strip → close → legend captions the group → Group avg trace is named "Anodes" → Save project (manifest contains groups: [{"id": 1, "label": "Anodes"}]).

issue187_group_names_walkthrough.mp4

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

cursoragent and others added 3 commits October 3, 2026 22:12
The per-panel y-range lookup reads the summary column id out of each trace's
hovertemplate (variable=<id>). With Spread on, the app's hover rewrite from #40
had already replaced that id with the pretty axis title by the time the ranges
were applied, so none of them matched a facet axis and every panel stayed
autoscaled. figure_json now resolves the variable -> axis map straight after
collection.plot and passes it to _apply_y_ranges.

Adds regression tests for both-ends and one-sided ranges on the spread path.

Co-authored-by: Jan Petter Maehlen <jepe@ife.no>
Edits made inside the Manage cells dialog used to fire one plot round-trip
each, and every response redrew the chart on arrival, so after a burst of
edits the figure kept re-rendering long after the dialog had closed.

Edits now route through _replotAfterEdit(), which only flags a pending redraw
while the modal is open; closing it redraws the current tab once. Every plot
fetch also carries a per-chart sequence number, and a response overtaken by a
newer request is dropped rather than drawn, with the busy spinner held until
the last in-flight request settles. The modal footer says when the refresh
happens. Adds a Playwright e2e test counting /api/plots requests.

Co-authored-by: Jan Petter Maehlen <jepe@ife.no>
…istence (#187)

Groups can now be named in the Manage cells modal. The name is used by cellpy
for group-averaged traces, captions the per-cell legend entries of that group,
is saved in project.json (groups: [{id, label}]) and is read from the
group_label column of batch journals. POST /api/groups/{group} sets it;
/api/state carries a groups list.

Co-authored-by: Jan Petter Maehlen <jepe@ife.no>
cursoragent and others added 3 commits October 4, 2026 06:12
…ot-cells-modal-713a

Co-authored-by: Jan Petter Maehlen <jepe@ife.no>
Co-authored-by: Jan Petter Maehlen <jepe@ife.no>
…87-group-names-713a

Co-authored-by: Jan Petter Maehlen <jepe@ife.no>
Base automatically changed from cursor/184-defer-replot-cells-modal-713a to main October 4, 2026 06:21
…s-713a

Keep the group-name additions after #189 and #190 squash-merged into main.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jepegit
jepegit merged commit 7775cd9 into main Oct 4, 2026
2 checks passed
@jepegit
jepegit deleted the cursor/187-group-names-713a branch October 4, 2026 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

name of groups

2 participants