Repository navigation
Anchor the Nx workspace root to each checkout - #3461
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3461 +/- ##
==========================================
+ Coverage 84.82% 84.85% +0.02%
==========================================
Files 159 160 +1
Lines 19297 19327 +30
Branches 500 502 +2
==========================================
+ Hits 16369 16399 +30
Misses 2889 2889
Partials 39 39
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Lerna runs its tasks through Nx. Without an nx.json, Nx takes the outermost directory that has node_modules/nx as its workspace root, so a checkout nested inside another one builds the outer checkout. This happens to the clone create-release.py makes under build/release and to git worktrees inside the repo. Lerna still reports success, but the nested checkout's labextensions are never built, and the wheels and extension packages it produces ship without any UI. Add an nx.json so Nx stops at the current checkout. It defines no targets, so lerna keeps its default task behavior. It also pins the settings Nx changes once the file exists: the daemon stays off, and the JS plugin still skips lockfile and source file analysis. The resulting project graph matches the one built without nx.json. With nx.json present, Nx keeps its cache and workspace data in .nx/ instead of node_modules/.cache, so ignore that directory and remove it in make purge. Also make create-release.py fail when make release leaves any labextension unbuilt, instead of packaging wheels without the UI. The tests for that check import the script, so omit it from coverage measurement: it ships in no package, and its release steps would otherwise count against the project coverage total. Fixes elyra-ai#3460 Signed-off-by: Luciano Resende <lresende@apple.com>
lresende
force-pushed
the
fix-nx-workspace-root
branch
from
November 15, 2026 00:23
f23fa93 to
59a99df
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Lerna runs its tasks through Nx. Without an
nx.json, Nx takes the outermost directory that hasnode_modules/nxas its workspace root, so a checkout nested inside another one builds the outer checkout. This is what happens to the clonecreate-release.pymakes underbuild/release/elyra. Its labextensions are never built, so the release wheels and extension packages ship without the UI, while every step reports success. #3460 has the details, reproduction steps, and theNX_WORKSPACE_ROOT_PATHworkaround for branches without this fix.nx.json(new) anchors the Nx workspace root at the checkout. It defines no targets, so lerna keeps its default task behavior. It also pins the settings Nx changes as soon as annx.jsonexists, so everything else behaves as it does today:"useDaemonProcess": false. Withoutnx.json, Nx never starts its daemon. With the file present, local runs would launch one.pluginsConfig["@nx/js"]withanalyzeLockfile: falseandanalyzeSourceFiles: false. Nx skips lockfile analysis in lerna repositories withoutnx.json(lerna/lerna#3807) and turns it on once the file exists. Adding any@nx/jsoptions also turns on source-file analysis by default..gitignore: ignore.nx/, where Nx now keeps its cache and workspace data instead ofnode_modules/.cache/nx*.Makefile:make purge, and thereforemake clean, also removes.nx. Before this change, that data was removed along withnode_modules.create-release.py: aftermake release,verify_labextensions_built()fails the release if anylabextensions/elyra_*package is missing its builtlabextension/package.json. A build without the UI can no longer be packaged silently.elyra/tests/test_create_release.py(new): tests for that check.pyproject.toml: omitcreate-release.pyfrom coverage measurement. The new tests import the script, which would otherwise add all of it to the project total and failcodecov/project(-1.88%). The script ships in no package, and most of it only runs during a real release.Fixes #3460
How was this pull request tested?
All runs below were done from a checkout nested inside another checkout (both with dependencies installed), with
NX_WORKSPACE_ROOT_PATHunset.yarn lerna list --all --json: before this change, all 12 packages resolved into the outer checkout. With it, all 12 resolve inside the nested checkout.create-release.py(build_server,build_release,prepare_extensions_release, pre-release mode) in the nested checkout:build:prodfor all 12 projects there, and the new check reported 12 built labextensions.elyrawheel contains 131 files undershare/jupyter/labextensions(12 labextensions), and each of the five extension wheels contains its UI.packages/*/lib,labextensions/*/labextension/package.json, andnode_modules/.yarn-state.ymlwere not modified.nx.json(root set throughNX_WORKSPACE_ROOT_PATH) with the one built with thisnx.json. They are identical: 12 projects, 19 dependency edges between them, no external nodes, and no lockfile parsing. Without thepluginsConfigpin, Nx parsedyarn.lockand added 1,900 external nodes. WithoutuseDaemonProcess: false, local runs launched the Nx daemon.yarn lerna run clean:lintcache --verboselogs "Nx target configuration was not found. Task dependencies will not be automatically included." This is lerna's default task mode, and the target ran for all 12 projects.pytest elyra/tests/test_create_release.py: 4 passed. A fully built tree passes. One missing build, all builds missing, and no packages each fail and name what is missing.--covas inmake pytest: before theomit, the report includedcreate-release.py(511 statements, 11% covered by these tests). With it, that file is the only one removed (41 to 40 measured files).nx.json, and black and flake8 on the changed Python files.Developer's Certificate of Origin 1.1