Repository navigation
Move the .pkg guard to a static pre-install check and declare NodeSpaceProduct - #3381
mstomar125 wants to merge 4 commits into
Conversation
|
Automated pragmatic-code-review (initial review, medium depth). Verdict: COMMENT (posted as a comment; GitHub blocks self-approval). No blocking defect found; three open decisions are listed below. Review Type: Initial Review Requirements Check (issue #3349 acceptance criteria)
Findings 🔴 Critical
🟡 Important
🟢 Suggestions What was verified
Recommendation: COMMENT. Implementation is correct, safe and well tested; override propagation, an end-to-end refusal and the |
mstomar125
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review: COMMENT (GitHub blocks self-approval). No blocking defect; full findings are in the comment above.
b772cb0 to
e545871
Compare
…ceProduct The old guard ran in postinstall: after the payload was written, executing the installed nodespaced as root, and it never saw the other product because that product installs its own daemon beside nodespaced instead of replacing it. - The app bundle declares NodeSpaceProduct = community. Tauri merges Info.product.plist into Info.plist through bundle.macOS.infoPlist; the file is deliberately not named Info.plist, which Tauri auto-merges and a build config cannot un-merge. - scripts/pkg-resources/preinstall runs before the payload is written and refuses when the installed app's NodeSpaceProduct is not community, or, for bundles without the key, when the other product's daemon sits in Contents/MacOS. It reads only static data and runs nothing under the bundle. NODESPACE_FORCE_COMMUNITY=1 stays as the scripted-install override. - build-pkg.sh writes a Distribution installation-check that makes the same decision in Installer JS and refuses with a dialog instead of a generic "installation failed". The generated script is exercised in tests. - postinstall loses the guard block and its header bullet; everything else, including the launchd-bootstrap block, is unchanged. - release.yml verify_layout checks the installed bundle reads community. Closes #3349 Co-Authored-By: Claude Sonnet 5 <[email protected]>
…rsion postinstall never queried nodespaced --version, and with the old edition guard removed it runs no installed binary at all. Co-Authored-By: Claude Sonnet 5 <[email protected]>
…all-log tripwire - The Distribution check now treats an unreadable Info.plist like preinstall does (no key, so decide by the daemon file) instead of allowing the install; only other exceptions still fail open, and they log. - release.yml fails the build if the install log contains the check's failure line, so a throwing check cannot silently turn the GUI refusal off. A test ties the workflow's grep text to the text the check logs. - preinstall's header no longer repeats the override variable's name, and one test name no longer claims more than it exercises. Co-Authored-By: Claude Sonnet 5 <[email protected]>
… tripwire itself - The installation check's inner catch now logs under the same "NodeSpace installation check failed" prefix as the outer catch, so the release workflow's install-log grep also trips when plistAtPath throws on the freshly built CI bundle, not just for other exceptions. - The tie test now extracts the tripwire block from release.yml and runs it under bash -eo pipefail against temp logs: it must pass for a clean or missing log and fail for the real log lines both catches produce. Co-Authored-By: Claude Sonnet 5 <[email protected]>
e545871 to
7b338af
Compare
|
Automated pragmatic-code-review (re-review of the review-fix commit). Verdict: COMMENT (posted as a comment; GitHub blocks self-approval). Review Type: Re-Review (head e545871, rebased onto ca6a50e) Previous Review Summary
Findings 🟡 Important
🟢 Suggestions What was verified
Recommendation: COMMENT. From a code standpoint this is one small fix from good; merge remains gated on the coordinator's items (override propagation, |
mstomar125
left a comment
There was a problem hiding this comment.
Automated pragmatic-code-review (re-review): COMMENT (GitHub blocks self-approval). No criticals; the one Important finding is addressed in the head commit. Details in the comment above.
|
Address-review summary (two review rounds). Round 1 (initial review, verdict COMMENT, no criticals) Addressed:
Skipped, with reasons:
Not code changes, left to the coordinator: #1 (whether Round 2 (re-review of the fix commit, verdict COMMENT, no criticals) Addressed:
Mutation checks on the final files: 40 mutations, 39 caught. The one survivor (dropping the JS early return for "no app installed") is an equivalent mutant. Tests on the final head: Re-Review DecisionDecision: NO FURTHER RE-REVIEW NEEDED Rationale: The round-2 fix is the change the reviewer specified (one log string and a test), it is covered by mutation checks that the reviewer's own scratch mutants motivated, and it touches no guard decision logic. The remaining open items (override propagation, |
|
Held (coordinator) until after the core-only release: it changes the release workflow and adds a new preinstall + Distribution installation-check that run for every free-user install, and the real install path (refusal dialog, override under |
|
Superseded by #3606, which carries all of the coexistence work for the issue in one PR, reworked to the accepted ADR-084: every check compares 🤖 Generated with Claude Code |
Closes #3349
Core's side of ADR-084 §5 (proposed) for the
.pkg: the app bundle declares which product it is, and the guard against installing over another NodeSpace product moves frompostinstall(after the payload is written, executing the installednodespacedas root, and never firing) to two pre-install checks that read only static data.What changed
NodeSpaceProduct = communityin the bundle.packages/desktop-app/src-tauri/Info.product.plistholds the one key;tauri.conf.jsonnames it underbundle.macOS.infoPlist. The file is deliberately not calledInfo.plist, which Tauri auto-merges and a build config cannot un-merge.scripts/pkg-resources/preinstall(git mode 100755, picked up by the existingpkgbuild --scripts). It locates the app through$3, reads the key with/usr/bin/plutil, and falls back to "is the other product's daemon inContents/MacOS" only when the key is absent. It refuses with the ADR message and exit 1 unlessNODESPACE_FORCE_COMMUNITY=1. It runs nothing under the bundle or/usr/local/bin.installation-checkinbuild-pkg.sh. Same decision in Installer JS, refusing withmy.result.type = 'Fatal'so the GUI shows the real message instead of a generic "installation failed". It honours the override throughsystem.env. An unreadableInfo.plistdegrades to the daemon-file check exactly aspreinstalldoes; any other exception fails open and logs, becausepreinstallmakes the same decision (added beyond the issue text).postinstall: guard block,NODESPACED, and the header bullet removed, remaining bullets renumbered. Everything else, including thelaunchd-bootstrapblock, is byte-identical.release.yml:verify_layoutrequires the installed bundle'sNodeSpaceProductto readcommunity, and after the two installs the build fails if/var/log/install.logcontains the check's failure line, so a throwing check cannot silently turn the GUI refusal off (a missing log passes; a test runs the extracted block underbash -eo pipefailagainst temp logs, using the real log lines both catches produce).scripts/check-version-sync.tsclaimed the installer's postinstall queriesnodespaced --version. It never did, and now runs no daemon at all.postinstallno longer touchesnodespaced --edition, so this is independent of the flag removal in the daemon.Tests and mutation checks
scripts/pkg-preinstall.test.ts(19 tests) runs the real script against fixture bundles under a temp volume with a scrubbed environment: the issue's full matrix, plus key-beats-fallback, override only for1, and the exact refusal text. Every fixture bundle's executables write a sentinel file, and every case asserts it was never created. It also covers the static facts:postinstallhas no edition flag, no override variable, and every line naming the daemon is achmod/chown;tauri.conf.json'sinfoPlistnames an existing plist that isn'tInfo.plistand declarescommunity.scripts/pkg-installation-check.test.ts(17 tests) renders the actualdistribution.xmlheredoc out ofbuild-pkg.shunder bash, extracts the generated JS and runs it in avmcontext with a mockedsystem/my. It checks the decision matrix (including the two catch levels), that the shell did not mangle the script, thatproductbuildaccepts the XML, and that the refusal text equalspreinstall's stderr.Mutation checks: 40 mutations applied one at a time to the real files (fallback dropped, override dropped or loosened to any value, refusal always allowed,
exit 0on refusal, a daemon run under the bundle,/usr/local/binreached into, old probe re-added topostinstall, wronginfoPlistname / missing file / wrong product, installation-check element dropped, unguardedsystem.env, fail-closed or rethrowing catches, message and tripwire-text drift, a$in the heredoc, broken XML, and others). 39 were caught. The survivor, removing the JS early return for "no app installed", is an equivalent mutant:plistAtPathreturnsnull, the fallback finds no daemon and the result is stillcommunity. One test I first wrote (trailing slashes on$3) could not fail if the strip loop were removed, since//Applicationsresolves fine, so I deleted it rather than keep a placebo.bun run test:changed(every tier, because.github/is an unrecognized path: frontend 5356, browser 136, skill 95, scripts 780, Rust 4098),bun run quality:scripts:checkandbash -non both scripts pass, andscripts/postinstall-bootstrap.test.tsis unchanged and green.Verification outside the test suite
tauri bundle --bundles app) on a scratch crate whosebundle.macOSsection is copied from this config, using the realInfo.product.plist, from both thesrc-tauridirectory and its parent (CI runs it from the package directory): the resultingInfo.plisthasNodeSpaceProduct => communityeither way. Tauri's compile-time plist embedding only reads a file namedInfo.plist, soinfoPlistdoesn't affect the Rust build.installer -volinfo -pkgon scratch packages (no-target, nothing installed):system.envexists and exposes the installer process's environment (NODESPACE_FORCE_COMMUNITY=1was visible);plistAtPathreturnsnullfor a missing file andundefinedfor a missing key;fileExistsAtPathbehaves as the check assumes; literal→and…survive in the JS string. So the Distribution check can and does honour the override, and the "leave it out" fallback in the issue was not needed.release.ymllines. Theplutillines run against the Tauri-built scratch bundle (pass) and againstproand no-key fixtures (fail with a clear message). The tripwire block was run against a clean log, a log containing the marker, and a missing log (pass, fail, pass).Not verified
.pkgwas installed, so the real refusal (Fatal dialog in the GUI, exit 1 frominstaller) was never observed end to end, and neither was the CI double install. The logic is covered by the tests above; the Installer API shapes they mock were checked on a real Installer.NODESPACE_FORCE_COMMUNITY=1reaches thepreinstallscript undersudo NODESPACE_FORCE_COMMUNITY=1 installer ...needs a real install. The Distribution check sees the variable (above), but installer scripts run in a separate environment, so the script may not. The Installer app has no way to set the variable at all. Worth a manual check on a spare user or VM, and if it doesn't reach the script, the ADR-084 owner should know (the issue's manual step 4).Pro-boundary ratchet (#3299 / #3376 not on main yet)
Issue step 6 (per-file exemptions and
BASELINES) is not in this PR:scripts/check-pro-boundary.tsdoes not exist on main. Separately, #3376'sexemptionProblemsonly admits test files, so exemption entries forscripts/pkg-resources/preinstallandscripts/build-pkg.shas the issue describes would be rejected; the tests here use fragments instead, and product code names the markers plainly (fragments in product code hide the code).I ran #3376's checker against this branch and against clean
origin/mainat the same base (dac00a70):editionBranchingproWordingeditionBranchingrises because the two recognition points name the other daemon and the override variable (4 lines:preinstall47, 54;build-pkg.sh235, 241) against 3 removed frompostinstall.proWordingfalls: the only new hits are the refusal message (3 lines) against 7 removed. This is accepted raise class 1 (the installer guard ADR-084 assigns to core). If #3376 merges first,BASELINES.editionBranchingmust be 114 in this diff (itstest:scriptscheck fails otherwise); the PR that merges second should reconcile. That step is the one acceptance item of the issue this PR does not meet, soClosesis only earned once the baseline is in.The acceptance line about
nodespaced-pro/NODESPACE_FORCE_COMMUNITYappearing underscripts/only inpreinstallandbuild-pkg.shholds for everything this PR adds.scripts/refresh-pro-proto.tsalso containsnodespaced-pro(a path into the sibling repo), which predates this change and goes with the vendored proto.Recommended follow-up
An end-to-end guard test on the ephemeral macOS release runner: set
NodeSpaceProductto the other product in the installedInfo.plist, assertsudo installer -pkg ... -target /fails and leaves the bundle untouched, then repeat withsudo NODESPACE_FORCE_COMMUNITY=1to settle whether the override reachespreinstall. It was left out of this PR because it would put untested logic in the live release pipeline (installer exit-code behaviour for a Fatal check is unobserved). Until then the override undersudo installershould be treated as unproven: if it does not reach the script, the Distribution check would let the install through only forpreinstallto refuse it with the generic error.Risk
Merging before the Pro GUI builds from a pinned core rev means a Pro build taken from core HEAD would declare
communityand pass this guard. Per the standing decision that sync-side dependencies are ignored, that is accepted here; the Pro build has to override the key when it bumps past this commit.🤖 Generated with Claude Code