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

Fix: prefer disabled project nodes to external node #10223

Merged
merged 2 commits into from
May 28, 2024

Conversation

MichelleArk
Copy link
Contributor

@MichelleArk MichelleArk commented May 24, 2024

resolves #10224

Problem

Currently, an external node can clobber an existing project node if that project node is disabled. This should not be the case as it leads to duplicative nodes in the manifest! (one in manifest.nodes, one in manifest.disabled)

Solution

When injecting an external node to the manifest that already exists from the FS, handle merges by:

  • Enabled project nodes are preferred to external nodes
  • Disabled project nodes are preferred to external nodes

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX
  • This PR includes type annotations for new and modified functions

@cla-bot cla-bot bot added the cla:yes label May 24, 2024
Copy link
Contributor

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

Copy link

codecov bot commented May 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.67%. Comparing base (84456f5) to head (403a1d0).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10223      +/-   ##
==========================================
- Coverage   88.69%   88.67%   -0.03%     
==========================================
  Files         180      180              
  Lines       22449    22449              
==========================================
- Hits        19912    19906       -6     
- Misses       2537     2543       +6     
Flag Coverage Δ
integration 85.94% <100.00%> (-0.07%) ⬇️
unit 63.37% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MichelleArk MichelleArk marked this pull request as ready for review May 24, 2024 17:51
@MichelleArk MichelleArk requested a review from a team as a code owner May 24, 2024 17:51
Copy link
Contributor

@ChenyuLInx ChenyuLInx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have one question but otherwise looks good to me!

# node may already exist from package or running project (even if it is disabled),
# in which case we should avoid clobbering it with an external node
if (
node.unique_id not in self.manifest.nodes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to warn user in this case?

Copy link
Contributor Author

@MichelleArk MichelleArk May 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could end up being quite noisy as a warning because it would likely be multiple project nodes (e.g. from a package) being favoured over a collection of external nodes. I've been viewing it as something similar to our other precedence / resolution behaviour for resolving macros, refs, etc which is just 'expected' behaviour. Definitely warrants documentation though!

cc: @jtcohen6

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, I don't think we want a warning here. We will document here that, in all cases where identical resources from the same namespace are installed via both "project" and "package" dependency, the "package" dependency is preferred, whether or not the resources from that package are actually enabled.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MichelleArk MichelleArk merged commit e0783c2 into main May 28, 2024
65 checks passed
@MichelleArk MichelleArk deleted the prefer-disabled-nodes-to-external branch May 28, 2024 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prefer existing project nodes to external nodes, even if the project node is disabled
4 participants