Skip to content

Open projects and journals: replace by default, opt-in append with group renumbering (#174) - #192

Merged
jepegit merged 2 commits into
mainfrom
cursor/174-open-project-append-713a
Oct 4, 2026
Merged

jepegit merged 2 commits into
mainfrom
cursor/174-open-project-append-713a

Conversation

@jepegit

@jepegit jepegit commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Closes #174.

Stacked PR — based on cursor/187-group-names-713a (PR #191 → #190 → #189). Merge in order #189 → #190 → #191 → 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

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 at max+1, max+2 with 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

  • Project panel: an Append to the loaded cells checkbox (shown once cells exist). The Open / Open path buttons read Append / Append path while it is on; the panel hint explains the default.
  • Toast: "Appended “…” — N cells added to the loaded cells."
  • The journal tab of Add cells… always appends — "add" is its whole point.

API

  • POST /api/projects/open {target, mode?} and POST /api/projects/load-journal {path, mode?} (mode ∈ replace | append, default replace). Open job result carries action: opened | appended.
  • The journal job clears the library only after the journal produced cells — a corrupt or empty journal can no longer wipe the loaded set. Replace also drops the active project's cellpy config.
  • cellpy project config (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; API mode round 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.

Open in Web Open in Cursor 

Base automatically changed from cursor/187-group-names-713a to main October 4, 2026 07:06
@jepegit
jepegit added this pull request to stack #194 October 4, 2026 07:06
jepegit and others added 2 commits October 4, 2026 09:21
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
jepegit force-pushed the cursor/174-open-project-append-713a branch from 8e44bad to 7a7bbe2 Compare October 4, 2026 07:25
@jepegit
jepegit merged commit c28e31c into main Oct 4, 2026
2 checks passed
@jepegit
jepegit deleted the cursor/174-open-project-append-713a branch October 4, 2026 07:27
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.

Unclear what happens when opening a new project while already having a project loaded

2 participants