Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Js release-version: topological ordering iterates all edges per node instead of only its own #26490

Closed
1 of 4 tasks
mpsanchis opened this issue Jun 10, 2024 · 1 comment · Fixed by #26491
Closed
1 of 4 tasks

Comments

@mpsanchis
Copy link
Contributor

mpsanchis commented Jun 10, 2024

Current Behavior

Function sortProjectsTopologically processes all edges for each project in the processQueue. This means that a project A will process many edges that have nothing to do with it, creating a wrong topological ordering.

For instance, in a simple repo with dependencies:

C --> B --> A

the topological ordering algorithm will:

  • pick A
  • go through the dependency C --> B and add C to the processQueue
  • go through the dependency B --> A and add B to the processQueue
  • pick C
  • pick B

resulting in order [A, C, B] instead of the desired [A, B, C]

Expected Behavior

As the comment says in the code, when processing nodes in the project graph, we should
Process each project that depends on the current node.

That means taking only the edges whose target is the node which we just picked from the processQueue.

GitHub Repo

https://github.com/mpsanchis/nx-basic-repo

Steps to Reproduce

  1. Clone repo
  2. Go to branch all-independent
  3. Tag all projects in git (you can do it with node tools/add-tags.js HEAD~1 100.0.0) for instance
  4. run nx release version --dry-run
  5. Verify that app1 is not bumped despite of depending on lib1, because it has been wrongly sorted in the topological ordering

Nx Report

Node   : 18.20.2
OS     : darwin-arm64
pnpm   : 8.8.0

nx                 : 19.2.2
@nx/js             : 19.2.2
@nx/jest           : 19.2.2
@nx/linter         : 19.2.2
@nx/eslint         : 19.2.2
@nx/workspace      : 19.2.2
@nx/devkit         : 19.2.2
@nx/eslint-plugin  : 19.2.2
@nx/playwright     : 19.2.2
@nx/react          : 19.2.2
@nrwl/tao          : 19.2.2
@nx/web            : 19.2.2
@nx/webpack        : 19.2.2
typescript         : 5.4.5
---------------------------------------
Registered Plugins:
@nx/webpack/plugin
@nx/eslint/plugin
@nx/playwright/plugin
@nx/jest/plugin

Failure Logs

No response

Package Manager Version

pnpm 8.10.0

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

Adding this issue because I saw it was necessary when opening a PR (in the contributing guide).
Please let me know if there's something else to do. It's my first PR 😄

Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants