Skip to content

fix(studio): copy substrate symlinks verbatim so .app bundles survive install - #504

Merged
KnockOutEZ merged 1 commit into
studio-handoff-corefrom
sd-170-fix-studio-substrate-install-cor
Aug 27, 2026
Merged

fix(studio): copy substrate symlinks verbatim so .app bundles survive install#504
KnockOutEZ merged 1 commit into
studio-handoff-corefrom
sd-170-fix-studio-substrate-install-cor

Conversation

@KnockOutEZ

Copy link
Copy Markdown
Owner

Closes wigolo-studio-run#170.

What was wrong

cpSync(dir, destDir, { recursive: true }) in localPathSource().install copies symlinks without verbatimSymlinks, so Node resolves each one and writes an absolute link back into the install SOURCE. A desktop substrate is a macOS application bundle, and its frameworks are built entirely on relative links (Resources -> Versions/Current/Resources, Current -> A). The installed copy therefore:

  • crashed at launch,
  • executed bytes from outside the substrate root — the one thing the record's containment rule claims cannot happen,
  • dangled completely once the install source was deleted, which is the case "copy rather than adopt in place" exists to survive.

The acquire-time VERIFY cannot catch it: the top-level executable is a real file, so the probe passes while every framework link underneath points elsewhere.

Fix

One flag — verbatimSymlinks: true — plus the comment explaining why it is the whole copy rather than a tuning knob.

Pin

A framework-shaped fixture (Versions/A/… + Current -> A + Resources -> Versions/Current/Resources) whose manifest executable is reachable only through the relative chain. Two arms:

  1. the installed links are still relative (readlinkSync), and address nothing outside the install directory;
  2. anti-vacuity — the installed tree still resolves with the source deleted. An absolute-link copy passes existence checks for as long as the source survives, so this is the only arm that can distinguish the two.

Windows is skipped: creating a symlink there needs elevation, and this corruption class is a POSIX-symlinked bundle shape.

Verification

Forced-condition proof, not N clean runs. On tip (before the flag), the two new arms fail with exactly the predicted defect:

expected '/var/folders/…/wigolo-substrate-fw-SkbuWk/Frameworks/E.framework/Versions/A' to be 'A'
expected false to be true          // installed executable gone once the source is deleted

With the fix: Test Files 1 passed (1) · Tests 28 passed (28).

Real packaged .app differential, same script run against pre-fix and post-fix dist/, acquiring a genuine Electron bundle through WIGOLO_SUBSTRATE_PATH and launching the installed copy with the source deleted:

pre-fix   LINK /var/folders/…/sd170-src-fpx4SW/…/Versions/Current/Resources
          SOURCE_DELETED exec_exists = true          <- the verify still passes
          LAUNCH_FAILED dyld: Library not loaded: @rpath/Electron Framework.framework/Electron Framework

post-fix  LINK Versions/Current/Resources
          SOURCE_DELETED exec_exists = true
          LAUNCH_OK v43.0.0

gate:studio green; full unit suite green.

… install

cpSync without verbatimSymlinks resolves every symlink it copies and writes an
absolute link back into the install source. A desktop substrate is an
application bundle whose frameworks are built on relative links
(Resources -> Versions/Current/Resources, Current -> A), so the default copy
installed a bundle that crashed at launch, executed bytes from outside the
substrate root the record's containment rule covers, and dangled entirely once
the install source was deleted.

The acquire-time verify could not catch it: the top-level executable is a real
file, so the probe passed while the framework links underneath pointed
elsewhere. Pinned by a framework-shaped fixture whose executable is reachable
only through two relative symlinks, with the source-deleted arm as the
anti-vacuity check an absolute-link copy cannot pass.
@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d348ceea-acf9-495f-a0c4-6980d3afcc03

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@KnockOutEZ
KnockOutEZ merged commit 9004954 into studio-handoff-core Aug 27, 2026
20 checks passed
@KnockOutEZ
KnockOutEZ deleted the sd-170-fix-studio-substrate-install-cor branch August 27, 2026 21:50
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