Open projects and journals: replace by default, opt-in append with group renumbering (#174) - #192
Merged
Merged
Conversation
The generated snapshots conflict on every rebase. Keep them local. Co-authored-by: Cursor <cursoragent@cursor.com>
…oup renumbering (#174) Opening a saved project, a project path or a batch journal now carries a mode. replace (default) clears the loaded cells first and asks for confirmation in the UI; append keeps them, numbers the incoming groups above the ones in use (group names follow) and keeps the current project association. The journal job only clears the library once the journal yielded cells. The Add cells journal tab always appends. Co-authored-by: Jan Petter Maehlen <jepe@ife.no>
jepegit
force-pushed
the
cursor/174-open-project-append-713a
branch
from
October 4, 2026 07:25
8e44bad to
7a7bbe2
Compare
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 #174.
What
Every open — saved project,
project.json/ folder path, batch journal — now has an explicit mode:replace(default): clears the loaded cells first, exactly what project open always did silently. The UI now asks for confirmation when cells are loaded (and says when unsaved changes would be lost).append: keeps the loaded cells. Incoming group numbers are offset by the highest group already in use (Library.group_offset_for_append()), so a second project's groups 1, 2 land atmax+1,max+2with their internal grouping and their names (name of groups #187) intact — the collision reported in the issue comment. The current project association is kept (Save still writes the project you had open) and the set is marked dirty.UI
API
POST /api/projects/open {target, mode?}andPOST /api/projects/load-journal {path, mode?}(mode∈replace|append, defaultreplace). Open job result carriesaction: opened | appended.cellpy.toml) is switched only when the open actually replaces; an append reads the incoming cells under the current project's settings (documented limitation).Tests
tests/test_projects.py: replace default; append keeps cells / renumbers groups / carries names / keeps association; append into empty library;group_offset_for_append; APImoderound trip + 422 on unknown mode.tests/test_journal.py: journal append renumbers groups; replace is the default; corrupt journal under replace keeps the library.tests/test_gui_playwright.py(e2e, local): Append → no confirm, two cells, distinct groups, dirty tag; Open → confirm text, one cell left.uv run pytest -q -p no:warnings: all green (4 skips, example data). Design notes in.issueflows/04-designs-and-guides/project-refresh-and-import.md; README "Projects on disk" updated.Walkthrough
Demo cells (groups 1–3) → Open asks "Replace the 3 loaded cells…?" → Cancel keeps them → tick Append → button reads "Append", no dialog, 6 cells, appended groups land at 4 and 6 (named group "Anodes" travels along) → untick → Open confirms and leaves the 3 saved cells.
issue174_open_replace_vs_append_walkthrough.mp4
To show artifacts inline, enable in settings.