Problem/Motivation
Talking with @bnjmnm he brought up the fact that the node_modules folder will often have symlinks. So our SymlinkValidator will stop operations if the node_modules folder is present. This is pain for Project Browser development
Right now don't have a listener that excludes node_modules but if we added one like the others in package_manager/src/PathExcluder that excluded the folder on PreCreate and PreApply would it be safe to ignore node_modules in SymlinkValidator
If so would that also be true for any other folders that we exclude? For instance we exclude the files directories in SiteFilesExcluder for PreCreate and PreApply but if there are symlinks those directories we would still stop any operations.
Proposed resolution
Github Composer stager branch https://github.com/TravisCarden/composer-stager/tree/feature/preconditio...
Issue fork automatic_updates-3304365
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
traviscarden commentedComposer Stager does not currently take exclusions into account in its precondition test for symlinks. (c.f. CodeBaseContainsNoSymlinks.php. It would require a small (BC-safe) API addition to add support. I can work on that if/whenever you want to prioritize it.
Comment #3
tedbowComment #4
traviscarden commentedI'm currently working on the aforementioned feature addition to Composer Stager.
Comment #5
traviscarden commentedThe required enhancement has been merged into Composer Stager and released (v1.2.0), and the module has been updated to require it in #3317409: Update Composer Stager to v1.2.0. This is ready to move forward.
Comment #8
tedbowComment #9
phenaproximaThis is probably ready for review.
I'm not really sure how else we could test this because:
So I think we probably should get this manually tested, and merge it.
Comment #10
bnjmnmProject Browser runs a status check to determine if UI installs are possible. If the status check fails then there's a warning and the UI does not make the install controls available.
With the changes here, the status check is still failing and preventing the UI install
It looks like it doesn't run on status check?
I made a temporary change to make StatusCheckEvent part of that condition + added use ExcludedPathsTrait; to the event and that did not address it. I'm guessing the fact that StatusCheckEvent isn't already taking excluded paths into account is due to complexities that make it more involved than just adding ExcludedPathsTrait
Comment #11
bnjmnmManually tested with Project Browser, it's good!
Comment #12
phenaproximaCrediting @bnjmnm for manual testing, and assigning to @tedbow for final review.
Comment #13
tedbowNeeds test coverage the for the fact that our stage actually get the collected events and passes them on
and `SymlinkValidatorTest` doesn't test any other events but `PreCreate`
Comment #14
phenaproximaI'd like to handle this in another issue. It's a pre-existing problem, and therefore out-of-scope here. Besides, the structure of both the test and the validator make it quite hard to test pre-apply without significant refactoring.
Comment #15
tedbowLooks good!
Comment #17
phenaproximaI'm really happy with the solution we landed on. Merrily merged into 8.x-2.x.