Fix Pipeline settings path validation for external node module paths.
Review Request #14816 — Created Feb. 12, 2026 and updated
We recently changed the way that we check whether
babel,lessc,rollup
anduglifyjsbinaries exist in the node modules path when building
Pipeline settings. We used to hard-code paths like
<node_modules_path>/.bin/rollupand check for their existence, but now
we use thenpm execcommand.However, we invoke the command from the current working directory, when we
should actually be invoking it from the parent directory of the given node
modules path. This was made evident when trying to build Power Pack or run
its unit tests. Power Pack relies on the binaries in Review Board's node
modules, butnpm execwas being run from Power Pack's node modules
directory.This change fixes this so that the binaries are actually checked for in
the node modules paths, instead of the current working directory. And
we now include the consuming application's node modules path when
building the static media for an extension. If the binary is found,
then we use that path when running the binary withnpm exec.We also add handling for when
node_modules_pathis an empty string.
This can happen if we didn't find any node modules directories, which
should be an error state. Whenvalidate_paths=Falseand we have an
emptynode_modules_path, we use the current working directory as
the path.And finally this updates the docstring to (I hope) clarify the
validate_pathsargument and when it should be set toFalse, and
clarifies the expectations ofnode_modules_pathwhen
validate_paths=False.
- Ran unit tests.
- Was able to run Power Pack unit tests without hitting the
ImproperlyConfigurederror for rollup. - Was able to build a Power Pack package against a development server
of Review Board without hitting theImproperlyConfigurederror for
rollup. - Set
node_modules_pathwithvalidate_paths=Trueto an empty string,
a real path valid path and a non-existent one separated by a colon,
a real path valid path, and a non-existent path. - Ran the dev server, previously saw an error about the rollup command
failing but its gone away with this fix.
| Summary | ID |
|---|---|
| e512d315f32d84a5e3a42055f4b8f084975efe9d |
| Description | From | Last Updated |
|---|---|---|
|
Can we call this node_modules_paths? |
|
|
|
I tested here manually with a missing package and it prompted to install it. I checked the docs to see … |
|
|
|
If any of the node_modules paths in the list lack this, will we get an error for each one until … |
|
|
|
I wonder if we should now just log an error if a path in node_modules_path doesn't exist, since we now … |
|
|
|
Can we have this be false, None (with equivalent typing change in the signature)? Alternatively we could just return str … |
|
|
|
typo: Its -> It's |
|
|
|
This doesn't need to be inside an else because of the exception. |
|
|
|
If validate_paths is False, we never populate exec_paths. Can you look at where we might be turning this off (either … |
|
|
|
We should probably run babel_path through shlex.quote() here. |
|
|
|
The babel implementation above is using .get(), which helps with the exec_paths population issue. This here will break for sure. … |
|
|
|
Same here. |
|
|
|
Same here. |
|
|
|
Same here. |
|
-
-
I tested here manually with a missing package and it prompted to install it. I checked the docs to see what the stated behavior was if automating this, and it turns out that it assumes it should install. Looks like we need to pass
--nohere to disable that.If any requested packages are not present in the local project dependencies,
then a prompt is printed, which can be suppressed by providing either --yes
or --no. When standard input is not a TTY or a CI environment is detected,
--yes is assumed. The requested packages are installed to a folder in the npm
cache, which is added to the PATH environment variable in the executed
process. -
If any of the
node_modulespaths in the list lack this, will we get an error for each one until found? -
I wonder if we should now just log an error if a path in
node_modules_pathdoesn't exist, since we now build a list of paths to try. We'd probably still need to bail if the resulting list of paths is empty.
- Change Summary:
-
- Pass
--nothenpm execto prevent it from auto installing missing packages. - Handles an empty
node_modules_path. - Renamed
node_modules_path_seqtonode_modules_paths. - Include the
node_modules_pathin the error output for missing binaries since
its useful.
- Pass
- Description:
-
We recently changed the way that we check whether
babel,lessc,rollupand uglifyjsbinaries exist in the node modules path when buildingPipeline settings. We used to hard-code paths like <node_modules_path>/.bin/rollupand check for their existence, but nowwe use the npm execcommand.However, we invoke the command from the current working directory, when we
should actually be invoking it from the parent directory of the node modules path. This was made evident when trying to run Power Pack's unit tests. Power Pack
relies on Review Board's node modules, but since the npm execcommand wasran from the Power Pack repository, it was looking in Power Pack's node modules instead of Review Board's. This change fixes this so that the binaries are actually checked for in
the node modules paths, instead of the current working directory. If a binary isn't found in any of the configured node module paths then we raise the error. + + Additionally, we now only raise an error if all configured node modules
+ paths are invalid, whereas before we would raise an error if at least + one is invalid even if there were valid ones. + + This also adds handling for when
node_modules_pathis an empty string.+ This can happen if we didn't find any node modules directories. When + building a Pathobject, an empty string is treated as the path to the+ current working directory. So before this change, the empty + node_modules_pathstring would pass the path existence checks. Depending+ on the current working directory, the binaries existence checks could pass + too. Now, we raise an error if node_modules_pathis an empty string,+ because it should be treated as an error state instead of treating it as + the path to the current working directory. - Testing Done:
-
- Ran unit tests.
- Was able to run Power Pack unit tests without hitting the
ImproperlyConfigurederror for rollup that I was hitting before.
+ - Set
node_modules_pathto an empty string, saw the logged error and
improperly configured error raised.
+ - Set
node_modules_pathto a real path valid path and a non-existent
one separated by a colon, saw the logged error for the non-existent
path and the rest of the operation worked since the real path was valid.
+ - Set
node_modules_pathto a real path valid path and a trailing colon,
meaning it would be split into the real path plus an empty string. Saw
the logged error for the empty string and the rest of the operation worked
since the real path was valid.
+ - Set
node_modules_pathto a non-existent one, saw the logged error and
improperly configured error raised.
- Commits:
-
Summary ID fb589232b6e1785f61520dcfb59844fb9a73e2ba 0268383daf53ba74dc4b0f1f369cc046454e0f49 - Diff:
-
Revision 2 (+86 -40)
Checks run (2 succeeded)
- Change Summary:
-
Uses the
node_modulespath that the binary was found in when actually running the binary withnpm exec. - Description:
-
We recently changed the way that we check whether
babel,lessc,rollupand uglifyjsbinaries exist in the node modules path when buildingPipeline settings. We used to hard-code paths like <node_modules_path>/.bin/rollupand check for their existence, but nowwe use the npm execcommand.However, we invoke the command from the current working directory, when we
should actually be invoking it from the parent directory of the node modules path. This was made evident when trying to run Power Pack's unit tests. Power Pack
relies on Review Board's node modules, but since the npm execcommand wasran from the Power Pack repository, it was looking in Power Pack's node modules instead of Review Board's. This change fixes this so that the binaries are actually checked for in
the node modules paths, instead of the current working directory. If a binary isn't found in any of the configured node module paths then we ~ raise the error. ~ raise the error. If found, then we use that path when running the + binary with npm exec.Additionally, we now only raise an error if all configured node modules
paths are invalid, whereas before we would raise an error if at least one is invalid even if there were valid ones. This also adds handling for when
node_modules_pathis an empty string.This can happen if we didn't find any node modules directories. When building a Pathobject, an empty string is treated as the path to thecurrent working directory. So before this change, the empty node_modules_pathstring would pass the path existence checks. Dependingon the current working directory, the binaries existence checks could pass too. Now, we raise an error if node_modules_pathis an empty string,because it should be treated as an error state instead of treating it as the path to the current working directory. - Testing Done:
-
- Ran unit tests.
- Was able to run Power Pack unit tests without hitting the
ImproperlyConfigurederror for rollup that I was hitting before.
- Set
node_modules_pathto an empty string, saw the logged error and
improperly configured error raised.
- Set
node_modules_pathto a real path valid path and a non-existent
one separated by a colon, saw the logged error for the non-existent
path and the rest of the operation worked since the real path was valid.
- Set
node_modules_pathto a real path valid path and a trailing colon,
meaning it would be split into the real path plus an empty string. Saw
the logged error for the empty string and the rest of the operation worked
since the real path was valid.
- Set
node_modules_pathto a non-existent one, saw the logged error and
improperly configured error raised.
+ - Ran the dev server, previously saw an error about the rollup command
failing but its gone away with this fix.
- Commits:
-
Summary ID 0268383daf53ba74dc4b0f1f369cc046454e0f49 b81dd55d67e29e5ad2fa66dbe44c5fa541f78ddf - Diff:
-
Revision 3 (+132 -50)
Checks run (2 succeeded)
- Change Summary:
-
- Respond to feedback.
- Fix a problem with
exec_pathsbeing uninitialized when skipping path validation.
- Commits:
-
Summary ID b81dd55d67e29e5ad2fa66dbe44c5fa541f78ddf 1e1a139f60d77bb6518e3558566f5484e593e506 - Diff:
-
Revision 4 (+148 -52)
Checks run (2 succeeded)
-
-
-
-
If
validate_pathsis False, we never populateexec_paths. Can you look at where we might be turning this off (either via the arg or the environment variable) and see why we do that? I feel like we probably always want validation in our modern setups. -
-
The babel implementation above is using
.get(), which helps with theexec_pathspopulation issue. This here will break for sure.We should also quote the path.
-
-
-
- Change Summary:
-
- Always populate
exec_pathsand set the--prefixpath for binaries, regardless ofvalidate_paths. - Switch to setting a list of command args instead of a string for the
<package>_BINARYcommands. - Add some clarifications to the arg docs.
- Include the consuming application's node_modules path when packaging static media for an extension.
- Changed a missing node_modules path from an error to a warning, since it's not that severe (unless
we're missing all node_modules paths, in which case we raise an error anyway).
- Always populate
- Description:
-
We recently changed the way that we check whether
babel,lessc,rollupand uglifyjsbinaries exist in the node modules path when buildingPipeline settings. We used to hard-code paths like <node_modules_path>/.bin/rollupand check for their existence, but nowwe use the npm execcommand.However, we invoke the command from the current working directory, when we
~ should actually be invoking it from the parent directory of the node ~ modules path. ~ ~ This was made evident when trying to run Power Pack's unit tests. Power Pack
~ relies on Review Board's node modules, but since the npm execcommand was~ should actually be invoking it from the parent directory of the given node ~ modules path. This was made evident when trying to build Power Pack or run ~ its unit tests. Power Pack relies on the binaries in Review Board's node ~ modules, but npm execwas being run from Power Pack's node modules~ directory. - ran from the Power Pack repository, it was looking in Power Pack's node - modules instead of Review Board's. This change fixes this so that the binaries are actually checked for in
~ the node modules paths, instead of the current working directory. If a ~ binary isn't found in any of the configured node module paths then we ~ raise the error. If found, then we use that path when running the ~ binary with npm exec.~ the node modules paths, instead of the current working directory. And ~ we now include the consuming application's node modules path when ~ building the static media for an extension. If the binary is found, ~ then we use that path when running the binary with npm exec.~ Additionally, we now only raise an error if all configured node modules
~ paths are invalid, whereas before we would raise an error if at least ~ one is invalid even if there were valid ones. ~ We also add handling for when
node_modules_pathis an empty string.~ This can happen if we didn't find any node modules directories, which ~ should be an error state. When validate_paths=Falseand we have an+ empty node_modules_path, we use the current working directory as+ the path. ~ This also adds handling for when
node_modules_pathis an empty string.~ This can happen if we didn't find any node modules directories. When ~ building a Pathobject, an empty string is treated as the path to the~ current working directory. So before this change, the empty ~ And finally this updates the docstring to (I hope) clarify the
~ validate_pathsargument and when it should be set toFalse, and~ clarifies the expectations of node_modules_pathwhen~ validate_paths=False.- node_modules_pathstring would pass the path existence checks. Depending- on the current working directory, the binaries existence checks could pass - too. Now, we raise an error if node_modules_pathis an empty string,- because it should be treated as an error state instead of treating it as - the path to the current working directory. - Testing Done:
-
- Ran unit tests.
~ - Was able to run Power Pack unit tests without hitting the
ImproperlyConfigurederror for rollup that I was hitting before.
~ - Set
node_modules_pathto an empty string, saw the logged error and
improperly configured error raised.
~ - Set
node_modules_pathto a real path valid path and a non-existent
one separated by a colon, saw the logged error for the non-existent
path and the rest of the operation worked since the real path was valid.
~ - Set
node_modules_pathto a real path valid path and a trailing colon,
meaning it would be split into the real path plus an empty string. Saw
the logged error for the empty string and the rest of the operation worked
since the real path was valid.
~ - Was able to run Power Pack unit tests without hitting the
ImproperlyConfigurederror for rollup.
~ - Was able to build a Power Pack package against a development server
of Review Board without hitting theImproperlyConfigurederror for
rollup.
~ - Set
node_modules_pathwithvalidate_paths=Trueto an empty string,
a real path valid path and a non-existent one separated by a colon,
a real path valid path, and a non-existent path.
~ - Ran the dev server, previously saw an error about the rollup command
failing but its gone away with this fix.
- - Set
node_modules_pathto a non-existent one, saw the logged error and
improperly configured error raised.
- - Ran the dev server, previously saw an error about the rollup command
failing but its gone away with this fix.
- Commits:
-
Summary ID 1e1a139f60d77bb6518e3558566f5484e593e506 e512d315f32d84a5e3a42055f4b8f084975efe9d