Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .agents/skills/release-validation/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ Run from the repository root. Never trigger a release or create a tag merely to
Use the existing checker and smoke scripts; do not duplicate them. See `docs/RELEASE-VALIDATION.md` for scope and limitations.

After a continuous release, check the current commit in the release body, successful validation/build/publish ordering, nonempty uploaded assets, and every `latest*.yml` file URL against the literal published asset name and size. Download manifest files to verify their GitHub digest, and verify installer SHA-512 before repairing a manifest. A green publisher job alone does not prove updater URLs work. Never silently normalize mismatching names; an HTTP 404 is a failure. Record repairs separately from the original workflow run.

For installer/updater/profile changes, run the packaged lifecycle tests in `docs/INSTALLED-APP-VALIDATION.md`, and inspect the three-platform Installed application lifecycle workflow. Require actual app opening, account/session continuity after reinstall, and successful update/relaunch; checksum-only publication checks are insufficient. Use disposable profiles and installations. Keep production application identity/profile paths stable when changing branding. Never interpret an expired session as a missing account.
19 changes: 12 additions & 7 deletions .github/workflows/continuous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ jobs:
python-version: '3.11'
- run: npm ci
- run: npm run typecheck
- name: Prepare Corp resources
if: github.repository == 'criptogus/keepmind-corp'
run: npm run corp:build-brain
- run: npm run build
env:
KEEPMIND_EDITION: ${{ github.repository == 'criptogus/keepmind-corp' && 'corp' || '' }}
- name: Prune onnxruntime to target platform
run: node scripts/prune-onnxruntime.mjs ${{ matrix.onnx }}
- name: Drop optional ws natives
Expand All @@ -55,20 +60,20 @@ jobs:
# `ws` falls back to pure JS. Removing them lets the installer publish.
run: node -e "const fs=require('fs'); for (const p of ['node_modules/bufferutil','node_modules/utf-8-validate']) fs.rmSync(p,{recursive:true,force:true})"
- name: Build installers
run: npx electron-builder ${{ matrix.args }} --publish never
run: npx electron-builder ${{ github.repository == 'criptogus/keepmind-corp' && '--config electron-builder.corp.yml' || '' }} ${{ matrix.args }} --publish never
env:
CSC_IDENTITY_AUTO_DISCOVERY: false
- name: Upload installers
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}
path: |
dist/*.dmg
dist/*.zip
dist/*.exe
dist/*.AppImage
dist/latest*.yml
dist/*.blockmap
${{ github.repository == 'criptogus/keepmind-corp' && 'dist-corp' || 'dist' }}/*.dmg
${{ github.repository == 'criptogus/keepmind-corp' && 'dist-corp' || 'dist' }}/*.zip
${{ github.repository == 'criptogus/keepmind-corp' && 'dist-corp' || 'dist' }}/*.exe
${{ github.repository == 'criptogus/keepmind-corp' && 'dist-corp' || 'dist' }}/*.AppImage
${{ github.repository == 'criptogus/keepmind-corp' && 'dist-corp' || 'dist' }}/latest*.yml
${{ github.repository == 'criptogus/keepmind-corp' && 'dist-corp' || 'dist' }}/*.blockmap
if-no-files-found: error

publish:
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/installed-apps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Installed application lifecycle
on:
pull_request:
paths:
- 'src/main/**'
- 'electron-builder*.yml'
- 'scripts/packaged-*.mjs'
- '.github/workflows/installed-apps.yml'
workflow_dispatch:
permissions:
contents: read
jobs:
installed:
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-2022, ubuntu-latest]
edition: [personal, corp]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: npm ci
- run: npm run corp:build-brain
- run: npm run build
- name: Build native installation fixture
shell: bash
env:
EDITION: ${{ matrix.edition }}
CSC_IDENTITY_AUTO_DISCOVERY: 'false'
run: |
node scripts/prune-onnxruntime.mjs "$(node -p process.platform)"
node -e "for(const p of ['bufferutil','utf-8-validate'])require('fs').rmSync('node_modules/'+p,{recursive:true,force:true})"
config=electron-builder.yml
if [ "$EDITION" = corp ]; then config=electron-builder.corp.yml; fi
case "$RUNNER_OS" in
macOS) npx electron-builder --config "$config" --mac --dir --publish never ;;
Windows) npx electron-builder --config "$config" --win nsis --x64 --publish never ;;
Linux) npx electron-builder --config "$config" --linux AppImage --x64 --publish never ;;
esac
- name: Test real installation and update with disposable profiles
shell: bash
env:
EDITION: ${{ matrix.edition }}
run: |
dir=dist
if [ "$EDITION" = corp ]; then dir=dist-corp; fi
case "$RUNNER_OS" in
macOS) source=$(find "$dir" -maxdepth 2 -name '*.app' -type d | head -1); node scripts/packaged-mac-smoke.mjs "$source" "$EDITION" artifacts/installed ;;
Windows) source=$(find "$dir" -maxdepth 1 -name '*.exe' | head -1); node scripts/packaged-platform-smoke.mjs "$source" "$EDITION" artifacts/installed ;;
Linux) source=$(find "$dir" -maxdepth 1 -name '*.AppImage' | head -1); xvfb-run -a node scripts/packaged-platform-smoke.mjs "$source" "$EDITION" artifacts/installed ;;
esac
- uses: actions/upload-artifact@v4
if: always()
with:
name: installed-${{ matrix.os }}-${{ matrix.edition }}
path: artifacts/installed/
if-no-files-found: warn
33 changes: 33 additions & 0 deletions docs/INSTALLED-APP-VALIDATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Installed application validation

KeepMind SB is the personal second-brain application, not KeepMind OS. Its existing internal package name (`keepmind`), bundle identifier (`com.keepmind.app`) and profile directory remain stable. The macOS bundle remains `KeepMind.app` for compatibility with already-installed updaters; its display name, UI and new artifact names identify KeepMind SB. Corp keeps its own identity and profile.

## Account persistence

Accounts and sessions belong to the profile, outside the installed app. On macOS the personal default remains `~/Library/Application Support/keepmind`; Corp uses `keepmind-corp`. Replacing or removing the application bundle does not remove these directories. Windows NSIS explicitly retains application data on uninstall. A local SB session expires after 30 days; expiration requires login, not registration. Removing profile data with a cleaner is different from uninstalling the application. No password or account is copied between SB and Corp.

Explicit `--user-data-dir` and `KEEPMIND_USER_DATA_DIR` profiles survive updater relaunches. Neither changes HOME. Regression tests preserve a synthetic account across app replacement and confirm an expired session leaves the account intact.

## Publication finding

The old `continuous.yml` used the personal packaging configuration even inside `keepmind-corp`. Both published macOS 0.2.6 DMGs contained `name: keepmind`, `main: out/main/index.js`. The workflow now chooses the Corp config, builds Corp resources, uploads the correct output folder and includes shared main-process chunks. Corp polls only its own repository and accepts only Corp-prefixed artifacts.

## Update guarantees and limits

Downloads require the expected repository, edition-specific filename, positive size and SHA-256 digest. Partial or corrupted downloads are not installable. Pending metadata persists across restart. The macOS helper stages the replacement on the installation volume, keeps the old bundle for recovery, and preserves the profile when launching directly. It does not use LaunchServices to choose another app. Linux requires a real AppImage path and stages a replacement. Windows waits for the old process, installs to its existing directory, checks the installer exit status, then relaunches with the same profile. A receipt is written after replacement, not after download.

These changes do not add signing/notarization or remote account recovery. Existing unsigned application restrictions still apply. A local source-package smoke is not evidence that a published release contains the fix.

## Reusable tests

- `node scripts/packaged-mac-smoke.mjs APP_PATH personal|corp EVIDENCE_DIR`: copy a built app into a fresh temporary installation, create a synthetic account, remove/reinstall the app, then exercise the real updater against a controlled local archive, verifying relaunch, session, sentinel data and recovery bundle. An outer macOS sandbox denies writes to the user's home; Electron's nested sandbox is disabled only for this test process because nested seatbelt sandboxes conflict.
- `node scripts/packaged-platform-smoke.mjs INSTALLER personal|corp EVIDENCE_DIR`: Windows/Linux equivalent, restricted to disposable CI runners. Uses the native NSIS installer/uninstaller or AppImage and preserves a temporary profile.
- `.github/workflows/installed-apps.yml`: builds and tests both editions on macOS, Windows and Linux. Screenshots, reports and process logs are retained as workflow artifacts.

The fixture feed is injected through the test process's inspector; production builds contain no arbitrary update-server override. Never test update application against a user's installation, account, vault or credentials. Reports distinguish published artifacts from newly packaged source builds.

## Windows helper startup

The native regression exposed `powershell.exe` exiting with code 0 before executing its script when launched with Node's `detached` option. A hidden `cmd /c start /b /wait` bootstrap supplies a console and starts PowerShell outside the parent's libuv job. The app waits for a readiness file before quitting; startup failures keep the app open. See [libuv Windows process handling](https://github.com/libuv/libuv/blob/v1.x/src/win/process.c) and the [matching upstream reproduction](https://github.com/oven-sh/bun/issues/31603). Native lifecycle CI exercises the real helper after the parent exits.

Auth database writes use an atomic replacement and propagate disk errors. Failed mutations restore the in-memory database so a later read cannot silently save a failed registration. The regression verifies both retry and reopen behavior.
12 changes: 11 additions & 1 deletion electron-builder.corp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ extends: electron-builder.yml
directories:
output: dist-corp
files:
- out/main/index-corp.js
- out/main/**
- package.json
- LICENSE
- NOTICE
Expand All @@ -24,18 +24,28 @@ extraResources:
- "**/*"
- "!data/**"
asar: true
publish:
provider: github
owner: criptogus
repo: keepmind-corp
mac:
extendInfo:
CFBundleDisplayName: KeepMind Corp
artifactName: KeepMind-Corp-${version}-${arch}-mac.${ext}
category: public.app-category.productivity
target:
- dmg
- zip
nsis:
uninstallDisplayName: KeepMind Corp
deleteAppDataOnUninstall: false
# Keep the physical filename identical to the update manifest and GitHub asset.
artifactName: KeepMind-Corp-Setup-${version}.${ext}
win:
target:
- nsis
linux:
artifactName: KeepMind-Corp-${version}.${ext}
category: Office
target:
- AppImage
9 changes: 8 additions & 1 deletion electron-builder.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
appId: com.keepmind.app
# Keep the legacy bundle name for compatibility with already-installed updaters.
productName: KeepMind
icon: build/icon
publish:
Expand All @@ -17,17 +18,23 @@ files:
- node_modules/**
asar: true
mac:
extendInfo:
CFBundleDisplayName: KeepMind SB
artifactName: KeepMind-SB-${version}-${arch}-mac.${ext}
category: public.app-category.productivity
target:
- dmg
- zip
nsis:
uninstallDisplayName: KeepMind SB
deleteAppDataOnUninstall: false
# Keep the physical filename identical to the update manifest and GitHub asset.
artifactName: KeepMind-Setup-${version}.${ext}
artifactName: KeepMind-SB-Setup-${version}.${ext}
win:
target:
- nsis
linux:
artifactName: KeepMind-SB-${version}.${ext}
category: Utility
target:
- AppImage
Loading
Loading