Repository navigation
Description
Summary
Carry out core's side of ADR-084 §5 (proposed, decision 5(a)) for the .pkg:
-
Declare the product. Core's app bundle declares
NodeSpaceProduct = communityin itsInfo.plist. -
Move the guard before the payload. Today's guard against installing over another NodeSpace product lives in
postinstall, which runs after the payload is written, runs the installednodespacedas root, and never fires. It moves to the pre-install stage, in two places:- a new
scripts/pkg-resources/preinstall; - the Distribution installation check that
scripts/build-pkg.shwrites.
Both read only static data: the installed app's
NodeSpaceProduct, or, when that key is absent, whetherContents/MacOS/nodespaced-proexists.NODESPACE_FORCE_COMMUNITY=1stays as the override for scripted installs. - a new
-
Remove the old guard from
postinstall.
Context
-
Today's guard. In
scripts/pkg-resources/postinstall: the header bullet at 10-14,NODESPACEDat 20, and the block at 22-59. It never seespro, because the Pro installer putsnodespaced-probesidenodespacedinstead of replacing it. -
ADR-084 §5 sets the rules. The guard runs before anything is written, never runs an installed binary, reads static data, and refuses with a message that names Pro's uninstall. The message:
NodeSpace Pro is installed. To switch back to the free NodeSpace, uninstall Pro first (NodeSpace → Uninstall NodeSpace Pro…). Your databases stay on this Mac.
-
Recognition points. ADR-084 §5 lets exactly three core files name the other product's daemon, and only in the transitional fallback:
- the Distribution check in
build-pkg.sh; preinstall;- the cask generator (Add a Homebrew cask preflight for other NodeSpace products; keep databases out of zap #3350).
ADR-081 §2d and §8 are widened to allowlist exactly these three.
- the Distribution check in
-
How the script gets into the package.
pkgbuild --scripts "${PKG_RESOURCES}"(build-pkg.sh177-184) packages every file inscripts/pkg-resources. An executable file namedpreinstallthere becomes the package's preinstall script. macOS Installer passes it four arguments:$1is the package path,$2the target location,$3the target volume and$4the startup disk. Locating the app through$3also gives the tests their seam. -
Where the key comes from. Tauri merges the plist named by
bundle.macOS.infoPlistinto the bundle'sInfo.plist(tauri-utils 2.9.2MacConfig::info_plist; the CLI is 2.11.4). It also auto-merges any file named exactlyInfo.plistnext totauri.conf.json.- Use the explicit config key, pointing at a file with a different name.
- Today's Pro build runs core's
tauri build --config tauri.pro.conf.json. A JSON merge patch there can replace theinfoPlistpath with a Pro-owned plist. It cannot un-merge an auto-discoveredInfo.plist.
-
Why the pin gate. The key sits in the bundle that the Pro GUI build inherits from core's config. Until the Pro GUI builds from a pin, and overrides the key to
prowhen it bumps past this commit, a Pro build from core HEAD would declarecommunity. ADR-084's guards would then treat that Pro app as core.
Scope
-
The key.
- Add
packages/desktop-app/src-tauri/Info.product.plist: an XML plist with one dict entry,NodeSpaceProduct=community. The name is illustrative, but it must not beInfo.plist. - In
tauri.conf.json, add"infoPlist": "Info.product.plist"underbundle.macOS(31-33).
- Add
-
New
scripts/pkg-resources/preinstall. It is a bash script (#!/bin/bash,set -euo pipefail), committed as mode 755.- Set
APPto"${3:-/}"with any trailing/stripped, followed by/Applications/NodeSpace.app. IfAPPdoesn't exist, exit 0. - Read the key:
product=$(/usr/bin/plutil -extract NodeSpaceProduct raw -o - "$APP/Contents/Info.plist" 2>/dev/null || true). - If
productis empty, it isprowhen$APP/Contents/MacOS/nodespaced-proexists, andcommunityotherwise. Comment that this fallback covers bundles built before the key existed, and is removed once no such Pro build is supported (ADR-084 §5). - If
productisn'tcommunityandNODESPACE_FORCE_COMMUNITYisn't1, print the ADR message to stderr and exit 1. - Never run anything under
$APPor/usr/local/bin. Call system tools by absolute path. - The header comment says what the script checks, when it runs, why it reads only static data, and how the override works. No issue numbers and no docs paths.
- Set
-
The Distribution check. In
build-pkg.sh'sDIST_XML(192-213), add<installation-check script="nodespaceInstallationCheck()"/>and a<script>that makes the same decision in Installer JS:- Read the app with
system.files.fileExistsAtPathandsystem.files.plistAtPath('/Applications/NodeSpace.app/Contents/Info.plist'). - Read the override from
system.env. - To refuse, set
my.result.type = 'Fatal'plus a title and the message, thenreturn false.
The heredoc is unquoted, so don't use
$in the JS. First confirm thatsystem.envexists in Installer JS on the macOS version CI builds on. If it doesn't, the check can't honour the override: leave it out, keep onlypreinstall, and say so in the PR. - Read the app with
-
postinstall.- Delete the header bullet (11-12) and renumber the rest.
- Delete
NODESPACED(20), which becomes unused, and the guard block (22-59). - Keep everything else byte-identical, including the
launchd-bootstrapsentinel block.
-
The release check. In
release.yml'sverify_layout(532-563), check thatplutil -extract NodeSpaceProduct raw /Applications/NodeSpace.app/Contents/Info.plistprintscommunity. -
Ratchet exemptions. In
scripts/check-pro-boundary.ts, exemptscripts/pkg-resources/preinstallandscripts/build-pkg.shfrom theeditionBranchingandproWordingmarkers, per file. Comment the entries: "ADR-084 §5 recognition points: the transitional fallback names the other product's daemon, and the refusal names the product". Then pasteBASELINES.
Out of scope
- The cask (Add a Homebrew cask preflight for other NodeSpace products; keep databases out of zap #3350) and the CLI (Make nodespace uninstall refuse when the installed app is not the free NodeSpace #3351).
- The daemon's
--editionflag (Remove the pro feature and --edition from nodespaced and reject unknown arguments #3348). - The Pro installer,
NodeSpaceProduct = proandNodeSpaceCoreVersion(sync).
Steps
- Run the startup sequence, and assign the issue at pickup. Confirm the pin gate is met.
- Add the key, then check it on a locally built bundle:
- build with
bun run tauri build -- --debug --bundles app, or the release app build; - run
plutil -extract NodeSpaceProduct raw <app>/Contents/Info.plist.
- build with
- Write
preinstalland its tests. - Add the Distribution check.
- Edit
postinstall. - Add the CI check.
- Add the ratchet exemptions and paste the baselines.
- Run
bun run test:changed,bun run test:scripts,bun run quality:scripts:checkandbun run quality:fix. Push and open the PR.
Acceptance criteria
- The built app's
Info.plisthasNodeSpaceProduct = community. -
preinstallis executable (git mode 100755), refuses as the matrix below says, and never runs a binary. - The Distribution check refuses in the Installer GUI with the ADR message, or the PR documents why it was left out.
-
postinstallhas no guard:git grep -n -F -e --edition -e FORCE_COMMUNITY -- scripts/pkg-resources/postinstallprints nothing. - Under
scripts/,nodespaced-proandNODESPACE_FORCE_COMMUNITYappear only inpreinstallandbuild-pkg.sh. Add a Homebrew cask preflight for other NodeSpace products; keep databases out of zap #3350 later adds the cask generator. -
release.ymlchecks the key, and its two back-to-back installs still pass. Installing core over core is unchanged. -
bash -npasses on both scripts.bun run test:scriptsandbun run quality:scripts:checkpass. -
bun run scripts/check-pro-boundary.tspasses, withBASELINESlowered.editionBranchingandproWordingfall by the old guard's lines: 3 and 7 at af8ddb6.
Tests and verification
-
New
scripts/pkg-preinstall.test.ts(bun:test, DOM-free). It skips unlessprocess.platform === "darwin", because the script calls/usr/bin/plutil.- It writes fixture bundles under
<tmp>/Applications/NodeSpace.appand runsbash scripts/pkg-resources/preinstall pkg / <tmp> /with a scrubbed environment. - Build the Pro sidecar name and the override variable from fragments, for example
["nodespaced", "pro"].join("-").
Fixture Expected exit no app 0 key community0 key pro1, and stderr mentions the uninstall key other1 no key, no Pro sidecar 0 no key, Pro sidecar present 1 key pro, override set to10 - Also put an executable
Contents/MacOS/nodespacedin the fixture that writes a sentinel file, and assert the sentinel is never created.
- It writes fixture bundles under
-
Static test:
postinstallnever runs the installed daemon and never contains the edition flag (built from fragments). Mutation check: re-add the old probe line, and the test must fail. -
Static test:
tauri.conf.json'sbundle.macOS.infoPlistnames a file that exists and declaresNodeSpaceProduct=community. -
Existing test:
scripts/postinstall-bootstrap.test.tsstill passes. -
Manual, optional. On a spare macOS user or a VM:
- Build the package with
SKIP_NOTARIZATION=1. - Run
pkgutil --expandand confirm it showsScripts/preinstall. - Install over a fake bundle that declares
pro: the install is refused. - Run
sudo NODESPACE_FORCE_COMMUNITY=1 installer -pkg ... -target /: the install proceeds.
If the variable doesn't reach the script, record that in the PR and tell the ADR-084 owner.
- Build the package with
Dependencies
- NodeSpaceAI/nodespace-docs#94 (ADR-084) (ADR-084 decision 5, proposed).
- Add the Pro-boundary ratchet check and the CLAUDE.md Pro/sync placement rule #3299: the ratchet.
SYNC:Pro GUI and Pro daemon build from one pinned core rev: the Pro build inherits the key, and must override it at its pin bump.
Risks and rollback
- A mislabelled Pro build. Merging before the pin gate would let a Pro build from core HEAD declare
community. - The override might not reach the script. Whether the environment reaches installer scripts under
sudo installerisn't guaranteed. The manual check covers this. - A terse error on the command line. A failing
preinstallshows only a generic "installation failed" ininstaller. The Distribution check gives the real message in the GUI. - Rollback: revert the PR. That restores the old guard, which never fired, and removes the key.
Plan key: C8.3b (pro-boundary DAG).
🤖 Generated with Claude Code
Activity
Move the .pkg guard to a static pre-install check and declare NodeSpa…
Move the .pkg guard to a static pre-install check and declare NodeSpa…
mstomar125 commentedon Oct 1, 2026
Superseded by #3415 (umbrella against the final ADR-081–085)