Skip to content

Save and open the workspace as a .kproj project - #265

Merged
vycdev merged 8 commits into
developfrom
t3/modernize-220-project-files
Dec 1, 2026
Merged

vycdev merged 8 commits into
developfrom
t3/modernize-220-project-files

Conversation

@vycdev

@vycdev vycdev commented Dec 1, 2026 •

Copy link
Copy Markdown
Owner

Supersedes #220 by @JohnSt99, rebased onto current develop with their work and authorship kept, as one squashed commit. Tracks #25 (basic save/load first).

Save project writes a versioned .kproj ZIP with the current image as PNG and project.json, which holds:

  • adjustments;
  • algorithm, Number of Colors and Keep detail;
  • the checked palettes, with a snapshot of each checked custom palette;
  • print settings;
  • working filaments and 3D options, including Per-region stacks.

Open project asks first, checks the whole file and decodes the image before it replaces anything, and starts a fresh undo history. Rebuild the 3D model afterwards.

  • Palettes: built-in palettes are referenced by ID, and a custom palette is added as a copy unless an identical one exists. Library palettes are never overwritten.
  • Saved defaults: while a project is open, its settings don't replace your saved defaults. Loading another image or removing the image makes the settings in use your defaults again.
  • Not saved yet: undo history and generated models.

Changes from #220:

  • Format: the extension is .kproj, chosen by the maintainer, with no .kromacut fallback since the format never shipped. Algorithm Weight was removed from develop, so it isn't saved; older files that carry it still open.
  • Merges with develop:
  • Council fixes:
    • Opened projects: a pending adjustment commit can no longer overwrite them.
    • Late palette imports: an import that started before Open, from the file picker or an OS open, imports as a copy and doesn't select itself.
    • Tolerant reading: an unusable palette snapshot no longer rejects the file, and the color count is at least 2.
    • ZIP check: before JSZip parses anything, the check walks the central directory, counts its records (204 at most) and refuses ZIP64, multi-disk archives and gaps.
    • Save: an oversized image is refused before it is encoded.
    • Color cleanup: its progress overlay shows again.
    • Docs: the CHANGELOG entry is under Unreleased, and the guide section in all 12 languages is updated.

Proof:

  • Unit tests cover the format, the ZIP directory check (decoy, ZIP64, gap and count cases), multi-palette and legacy files, Keep detail and Per-region stacks.
  • @smoke e2e tests cover a save and Open round trip, corrupt files, palette snapshots, adjustments plus 3D options plus defaults resuming, and late palette imports. Each regression test failed with its fix reverted.
  • Local lint, tsc, npm test (1458), i18n, docs and test:e2e:all on fresh servers (port 52067).

Council review

Rounds: 6

Delegate Round 1 Round 2 Round 3 Round 4 Round 5 Round 6
Claude Opus 5.5 6.5/10 8/10 8.5/10 9.5/10 9.5/10 9.5/10
GPT-6.2 Sol 6/10 7/10 not run (no approval prompts) not run not run not run
Gemini Pro unavailable unavailable unavailable unavailable unavailable unavailable

Rounds 5 and 6 reviewed the merges of #262 and #261 into this branch.

🤖 Generated with Claude Code

JohnSt99 and others added 8 commits November 30, 2026 22:15
Squashed from #220 (50dedcd, 00aef66) onto develop. Adapted to develop:
drop the removed Algorithm Weight from the project state (older files
that carry it still open), build replaceWorkspaceImage on history's
retained-URL release instead of revoking URLs by hand, and block project
open/save while a crashed session is still being recovered.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
develop now opens on the start screen instead of a preloaded logo, so the
first import left nothing to undo. Start from the sample so the check that
history survives a failed open still has a step to keep.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The project format hasn't shipped, so the save name, the open picker, the
desktop save filter, the guides in 12 languages, the changelog and the
tests switch from .kromacut to .kproj with no fallback.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- A panel replaced by Open project or Apply no longer commits stale
  adjustments on unmount, so a pending Reset can't overwrite them.
- A palette file still being read when a project opens imports without
  replacing the project's palette selection.
- Per-region stacks and its filament limit are saved and restored.
- Loading another image or removing the image leaves the project, and
  print settings and working filaments save as defaults again.
- An unusable palette snapshot is ignored instead of rejecting the file,
  the color count is at least 2, and archives with more than 204 entries
  are refused from the ZIP directory before JSZip parses them. Save
  rejects an oversized image before encoding it.
- Color cleanup shows its progress overlay again.
- The changelog entry moves to Unreleased, and the guide section sits
  before the Next link and explains when defaults save.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Projects save and restore Keep detail; older files open with it off.
- The ZIP check walks the central directory and counts its records, and
  refuses multi-disk and ZIP64 archives, before JSZip parses anything.
- A palette import that started before a project opened, from the file
  picker or an OS open, neither selects itself nor overwrites the palette
  the project selected; it imports as a copy instead.
- Leaving a project without visiting 3D saves its print settings as
  defaults, like the 3D controls do when they are mounted. The guides say
  the settings in use become defaults again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
JSZip treats bytes between the central directory and the end record as
data in front of the archive and reads its records from a shifted
offset, so a decoy directory could pass the count. Kromacut never writes
such a gap, so it is refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
develop's multi-palette select (#262) replaces the single selected palette
with a list. Projects now save the checked palette IDs and a snapshot of
each checked custom palette, and still open version 1 files that stored a
single paletteId and palette. Opening restores every checked palette the
same way as before: built-ins by ID, custom palettes as copies unless an
identical one exists, without overwriting library palettes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vycdev
vycdev merged commit 8e0a11d into develop Dec 1, 2026
14 checks passed
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.

2 participants