Skip to content

Plugin inputs drop symlinks whose targets are inside the declared sourceRoot (Composer path repositories) #2613

Done

Description

@chubes4

Problem

A plugin input with sourceRoot + sourceSubpath loses every symlink, including symlinks whose targets are inside sourceRoot. Monorepo plugins built with Composer path repositories (Jetpack: projects/plugins/<plugin>/jetpack_vendor/automattic/* -> ../../packages/*) therefore boot without their vendors and fatal in the autoloader:

PHP Fatal error: Uncaught Error: Failed opening required '/wordpress/wp-content/plugins/wpcomsh/jetpack_vendor/automattic/jetpack-assets/actions.php'

The symlink disappears silently: no validation issue or warning, and the entry is just absent in the sandbox. #1978 (dangling targets) and #2015 (cycles) were fixed by not following symlinks. Those cases still need protecting, but a contained, acyclic target inside the declared root is the common Composer case.

Minimal reproduction (wp-codebox 0.34.5, 27c50a5)

root/packages/lib/lib.php
root/plugins/myplug/myplug.php          (plugin header)
root/plugins/myplug/tests/SampleTest.php
root/plugins/myplug/vendor-link -> ../../packages/lib

recipe-run with inputs.extra_plugins: [{ sourceRoot: "<abs>/root", source: "<abs>/root", sourceSubpath: "plugins/myplug", slug: "myplug", pluginFile: "myplug/myplug.php", activate: false }] and a wordpress.run-php step probing /wordpress/wp-content/plugins/myplug:

TESTS_DIR=yes | ENTRY=yes | LINK=no | VIA_LINK=no | ROOTLS=myplug.php,tests

Without sourceRoot, the result is the same.

Desired

When a plugin input declares sourceRoot, symlinks under the plugin whose resolved target stays inside sourceRoot (and doesn't cycle) materialize as their target contents. Symlinks that escape the root, dangle, or cycle keep today's skip behavior and are reported in the run evidence (path plus reason), so a missing vendor is diagnosable instead of silent.

Context: running Jetpack's wpcomsh PHPUnit suite through Homeboy's WordPress extension on WP Codebox (Extra-Chill/homeboy#19906).

AI disclosure: Claude Opus (Pi, via Roadie) built the minimal repro, ran it against the local wp-codebox CLI, and wrote this issue.

Activity

  1. chubes4 commented on Dec 2, 2026

    @chubes4
    CollaboratorAuthor

    Correction after reading runtime-playground/src/mount-materialization.ts: the skip is reported, not silent. The run emits readonly-mount-symlink-skipped with reason: source-escape for vendor-link. The defect is the containment boundary. stageReadonlyDirectory and readonlyMountSourceGeneration check pathIsWithinRoot(realpath(mount.source), target), so the boundary is the plugin directory. A declared sourceRoot never widens it, which makes sourceRoot + sourceSubpath unable to carry Composer path-repo vendors.

    AI disclosure: Claude Opus (Pi, via Roadie).

  2. chubes4 commented on Dec 2, 2026

    @chubes4
    CollaboratorAuthor

    Fixed by #2614.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions