Skip to content

Bundle the storage runtime and add library restore to Settings - #155

Merged
RobRoyce merged 5 commits into
mainfrom
feature/desktop-storage-completion
Oct 8, 2026
Merged

RobRoyce merged 5 commits into
mainfrom
feature/desktop-storage-completion

Conversation

@RobRoyce

@RobRoyce RobRoyce commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

Include the storage service and a pinned Node.js runtime in the desktop package. Add staged backup validation and safe restore activation through Settings > Backup. The unsigned package runs outside the repository without Node.js on PATH.

Depends on #154. Merge the stack in order with merge commits, retargeting each next PR to main after its predecessor lands. Do not squash or delete intermediate branches during integration.

Validation on the combined stack at 6ee979b2615db242ca6525bb7d0ccc36d563479f, using Node.js 24.21.0 in an isolated checkout:

  • Clean immutable dependency install: passed.
  • Development build and storage type check: passed.
  • Unit tests: 8 passed.
  • Storage tests: 35 passed.
  • Hidden-window desktop tests: 4 passed.
  • Headless Chrome tests: 6 passed.
  • Unsigned production package and packaged workflow: passed (1 test).

Each historical intermediate branch was not rebuilt independently. Signing, live AI credentials, other operating systems, and broad dependency security auditing are outside this review.

Focused review found no confirmed blocker in the combined stack. The review covers basic workflows, data preservation, authentication, and the dependency changes. Broader modernization remains separate work.

RobRoyce and others added 5 commits October 6, 2026 16:16
The packaged app now starts the storage service without an installed
Node.js, without the repository, and without the working directory.

- scripts/prepare-node-runtime.mjs downloads the official Node.js 24.21.0
  archive, checks the pinned SHA-256 and the upstream SHASUMS256.txt, and
  extracts bin/node and LICENSE to vendor/node/<platform>-<arch>/.
- electron-builder copies the runtime, its license, kc_storage, and
  kc_contracts to Contents/Resources, outside app.asar.
- Packaged runs use only Resources/node/bin/node and pass only the token
  to the service. Unpackaged runs keep KC_NODE or node from PATH.
- yarn package-local builds an unsigned local package.
- docs/desktop-storage-completion.md: design for this milestone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tion

Restore is now two steps in the service, used by both the command line
and the HTTP API:

- stageRestore validates the whole backup (format, supported version,
  records, duplicate IDs, project and asset references, sizes, SHA-256 of
  every file) and copies the files to restore/<id>/. The library does not
  change.
- activateRestore runs as one synchronous step: refuse a library with
  records, insert records, move files, commit. A stop before commit leaves
  files without records, which the next start removes with old staging
  directories.

The tar reader now accepts only manifest.json and assets/<uuid> as
regular files, and rejects other entry types, prefixes, duplicates, and
more than 1,000,000 entries. Entry names are never used as paths.

API: GET /v1/library, POST /v1/restores (upload and validate),
POST /v1/restores/<id>/activate, DELETE /v1/restores/<id>.

Tests: API and command line restore, non-empty refusal, writes after
validation, cancel, unsupported version, missing and damaged files,
unsafe entries, failure before commit, and process stop with restart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The Library Backup panel states what the backup contains and what it
  does not contain.
- Restore Library uploads the selected .tar to the storage service, which
  validates it. The panel shows the backup date, counts, project names,
  warnings, and the data that is not in the backup, then asks for
  confirmation. After activation it shows the result and reloads.
- A library with records is refused with the reason and the counts. No
  data is replaced, merged, or deleted.
- Counts in restore messages use correct plurals.

Tests:
- e2e/workflow.e2e.mjs restores through the UI instead of the command line.
- e2e/packaged/packaged.e2e.mjs (yarn e2e-packaged) runs the unsigned
  package from a copy outside the repository, with scratch profiles, a
  working directory outside the repository, and PATH without Node.js. It
  checks the bundled runtime in the service command line, the full
  workflow with UI restore, an unsupported backup version, the refusal
  for a non-empty library, unchanged chat history, two instances, and
  service cleanup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- DEVELOPMENT.md: runtime selection for packaged and unpackaged runs,
  yarn package-local, package contents, restore through Settings > Backup
  and the command line, what each backup contains, packaged tests, and
  current limits.
- Correct the security statements: the token stops requests without it,
  and the servers accept loopback connections only. Programs that run as
  the same OS user can read the token. The access boundary is the OS user.
- docs/storage-service.md: restore API and packaged runtime.
- docs/desktop-storage-completion.md: verification record.
- docs/follow-ups.md: remove completed items; add signing, other
  platforms, package size, and restore follow-ups.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@RobRoyce RobRoyce left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Focused integration review of PR #155 at 7cb14c0029c89bf0fb649f9e5730f5ec5713ce43.

No confirmed blocking finding in the combined revival stack. The independent code review checked storage writes, schema migration, managed files, backup/restore, local authentication, session recovery, Electron startup, and dependency removal. Main's conflicts were resolved without downgrading the stack's dependencies. All original commits are preserved.

Validation on the combined stack at 6ee979b2615db242ca6525bb7d0ccc36d563479f, using Node.js 24.21.0 in an isolated checkout:

  • Clean immutable dependency install: passed.
  • Development build and storage type check: passed.
  • Unit tests: 8 passed.
  • Storage tests: 35 passed.
  • Hidden-window desktop tests: 4 passed.
  • Headless Chrome tests: 6 passed.
  • Unsigned production package and packaged workflow: passed (1 test).

Each historical intermediate branch was not rebuilt independently. Signing, live AI credentials, other operating systems, and broad dependency security auditing are outside this review.

This is a review record submitted through the PR author's account, not the independent approving review required by main's branch protection. CodeQL status is reported separately by GitHub.

@RobRoyce
RobRoyce marked this pull request as ready for review October 8, 2026 17:41
@RobRoyce
RobRoyce changed the base branch from feature/standalone-storage to main October 8, 2026 18:14
@RobRoyce
RobRoyce merged commit 4767d95 into main Oct 8, 2026
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.

1 participant