Skip to content

fix(BA-1200): Wrong types in ResourcePolicy GQL modifier #4154

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

Merged
merged 2 commits into from
Apr 21, 2025

Conversation

jopemachine
Copy link
Member

@jopemachine jopemachine commented Apr 12, 2025

resolves #NNN (BA-1200).

Checklist: (if applicable)

  • Mention to the original issue

@jopemachine jopemachine changed the title fix: Wrong type in ResourcePolicy GQL modifier fix: Wrong types in ResourcePolicy GQL modifier Apr 12, 2025
@github-actions github-actions bot added size:S 10~30 LoC comp:manager Related to Manager component labels Apr 12, 2025
@jopemachine jopemachine changed the title fix: Wrong types in ResourcePolicy GQL modifier fix(BA-1200): Wrong types in ResourcePolicy GQL modifier Apr 21, 2025
@jopemachine jopemachine marked this pull request as ready for review April 21, 2025 02:31
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes type mismatches in the GraphQL modifiers for KeyPair resource policies. The key changes include:

  • Changing the type of default_for_unspecified from Optional[str] to Optional[DefaultForUnspecified] in both the creator and modifier.
  • Updating max_pending_session_resource_slots from Optional[dict[str, Any]] to Optional[ResourceSlot] for stronger type consistency.
  • Adjusting the conversion logic in the model to reflect the updated types.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/ai/backend/manager/services/keypair_resource_policy/types.py Updates type annotations in KeyPairResourcePolicyCreator for default_for_unspecified and max_pending_session_resource_slots
src/ai/backend/manager/services/keypair_resource_policy/actions/modify_keypair_resource_policy.py Adjusts the modifier’s field types to use DefaultForUnspecified and ResourceSlot
src/ai/backend/manager/models/resource_policy.py Revises the GraphQL-to-modifier conversion for default_for_unspecified via OptionalState
Comments suppressed due to low confidence (2)

src/ai/backend/manager/services/keypair_resource_policy/types.py:12

  • Verify that the GraphQL input for default_for_unspecified is properly converted to the DefaultForUnspecified type. Ensure any conversion logic (present in the input transformation) is aligned with this type change to avoid runtime issues.
default_for_unspecified: Optional[DefaultForUnspecified]

src/ai/backend/manager/services/keypair_resource_policy/types.py:17

  • Confirm that the conversion logic for max_pending_session_resource_slots matches the new ResourceSlot type and that any GraphQL input conversion is updated accordingly.
max_pending_session_resource_slots: Optional[ResourceSlot]

@HyeockJinKim HyeockJinKim added this pull request to the merge queue Apr 21, 2025
Merged via the queue into main with commit 860f10f Apr 21, 2025
28 checks passed
@HyeockJinKim HyeockJinKim deleted the fix/wrong_types branch April 21, 2025 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:manager Related to Manager component size:S 10~30 LoC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants