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

Add secondary_profiles to profile.py #11308

Merged
merged 9 commits into from
Feb 20, 2025
Merged

Add secondary_profiles to profile.py #11308

merged 9 commits into from
Feb 20, 2025

Conversation

aranke
Copy link
Member

@aranke aranke commented Feb 14, 2025

Resolves XPLAT-241.

Problem

We need to parse secondary_profiles associated with a given profile.

Solution

  • Create a new secondary_profiles dict on the Profile class.
  • Validate and load each secondary profile as if they were primary profiles.
  • Allow target_name to be optional iff a secondary profile has a single target.
  • Add tests.

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 or 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 Feb 14, 2025
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 Feb 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.96%. Comparing base (7041e58) to head (cd7472b).
Report is 7 commits behind head on main.

❌ Your patch status has failed because the patch coverage (42.85%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #11308   +/-   ##
=======================================
  Coverage   88.95%   88.96%           
=======================================
  Files         189      189           
  Lines       24169    24182   +13     
=======================================
+ Hits        21500    21513   +13     
  Misses       2669     2669           
Flag Coverage Δ
integration 86.25% <42.85%> (-0.03%) ⬇️
unit 62.55% <100.00%> (+0.02%) ⬆️

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

Components Coverage Δ
Unit Tests 62.55% <100.00%> (+0.02%) ⬆️
Integration Tests 86.25% <42.85%> (-0.03%) ⬇️

@aranke aranke marked this pull request as ready for review February 14, 2025 12:37
@aranke aranke requested a review from a team as a code owner February 14, 2025 12:37
@aranke aranke changed the title Add secondary_profiles to profile.py Add secondary_profiles to profile.py Feb 14, 2025
@aranke aranke marked this pull request as draft February 14, 2025 18:04
@aranke
Copy link
Member Author

aranke commented Feb 14, 2025

Converted to draft temporarily to see if I can address feedback from @amychen1776 re making target optional for secondary profiles.

@aranke aranke marked this pull request as ready for review February 19, 2025 14:13
Copy link
Contributor

@mikealfare mikealfare left a comment

Choose a reason for hiding this comment

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

I left a few minor nits and one readability/maintainability suggestion. As far as interfaces go, this aligns with what the base adapter will expect (basically secondary_profiles).

@aranke aranke requested a review from mikealfare February 19, 2025 16:26
Copy link
Contributor

@mikealfare mikealfare left a comment

Choose a reason for hiding this comment

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

Approved from Adapters' point of view.

# if we only have one target, we can infer the target name
# currently, this is only used for secondary profiles
target_name = next(iter(raw_profile["outputs"]))
fire_event(MissingProfileTarget(profile_name=profile_name, target_name=target_name))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this event necessary in this case?

Copy link
Member Author

@aranke aranke Feb 19, 2025

Choose a reason for hiding this comment

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

The event name is slightly misleading, but the message is useful for debugging purposes to indicate that we inferred a target_name:

class MissingProfileTarget(InfoLevel):
def code(self) -> str:
return "A005"
def message(self) -> str:
return f"target not specified in profile '{self.profile_name}', using '{self.target_name}'"

I'll add a comment for the same.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a comment here, let me know if any other changes are needed here.

@aranke aranke requested a review from MichelleArk February 19, 2025 17:24
@aranke aranke merged commit 71a93b0 into main Feb 20, 2025
64 of 65 checks passed
@aranke aranke deleted the xplat_241 branch February 20, 2025 16:38
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.

3 participants