Skip to content

feat(BA-8504): update the placement policy of a session group - #15747

Merged
fregataa merged 14 commits into
mainfrom
feature/BA-8504-update-session-group
Oct 22, 2026
Merged

fregataa merged 14 commits into
mainfrom
feature/BA-8504-update-session-group

Conversation

@wngh4628

@wngh4628 wngh4628 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • REST v2: PATCH /v2/session-groups/{session_group_id} changes a session group's placement_direction and placement_enforcement.
  • GraphQL: the updateSessionGroup mutation with UpdateSessionGroupInput and UpdateSessionGroupPayload.
  • Both call the session group adapter's update, which runs UpdateSessionGroupAction with a SessionGroupUpdater.
  • An omitted or null field leaves the value unchanged. An input that changes neither field is rejected.

Resolves BA-8504

🤖 Generated with Claude Code


📚 Documentation preview 📚: https://sorna--15747.org.readthedocs.build/en/15747/


📚 Documentation preview 📚: https://sorna-ko--15747.org.readthedocs.build/ko/15747/

@github-actions github-actions Bot added size:XL 500~ LoC comp:manager Related to Manager component comp:common Related to Common component area:docs Documentations labels Oct 16, 2026
wngh4628 added a commit that referenced this pull request Oct 16, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wngh4628
wngh4628 force-pushed the feature/BA-8500-session-group-api branch from 597bc6f to 5c270d0 Compare October 16, 2026 06:13
Base automatically changed from feature/BA-8500-session-group-api to main October 16, 2026 16:35
wngh4628 added a commit that referenced this pull request Oct 21, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wngh4628
wngh4628 force-pushed the feature/BA-8504-update-session-group branch from 69336cb to 6322cab Compare October 21, 2026 05:47
@wngh4628
wngh4628 marked this pull request as ready for review October 21, 2026 05:53
@wngh4628
wngh4628 requested a review from a team as a code owner October 21, 2026 05:53
Comment on lines +60 to +65
condition=SessionGroupSearchableFields.linked.replica_groups.not_exists(),
error=EntityNotFoundError(
f"Session group {self.group_id} not found",
entity_type=SessionGroupEntityType(),
operation=ActionOperationType.UPDATE,
),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why does this say "not found"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed it to SessionGroupInUseForUpdate in 5dfedf3.

A group a replica group holds answers not found, as the reads do.
"""

group_id: SessionGroupID

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If possible, please set the field name to "session_group_id."

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Renamed it to session_group_id in 9409047.

wngh4628 added a commit that referenced this pull request Oct 21, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wngh4628
wngh4628 force-pushed the feature/BA-8504-update-session-group branch from 3605c4c to 9409047 Compare October 21, 2026 06:26
Comment on lines +147 to +152
if not isinstance(self.placement_direction, SessionGroupPlacementDirectionEnum) and not (
isinstance(self.placement_enforcement, SessionGroupPlacementEnforcementEnum)
):
raise ValueError(
"UpdateSessionGroupInput requires 'placement_direction' or 'placement_enforcement'"
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a scenario where one side is set to None and the other is left as UNSET?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes. For example, {"placement_direction": null} passes null for one field and omits the other.

Both columns are NOT NULL, so the adapter’s OptionalState.from_unset treats null the same as an omitted field: “keep the existing value.”

Since neither field carries a value to change, the validator rejects the request (400 on REST).

wngh4628 added a commit that referenced this pull request Oct 21, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wngh4628
wngh4628 force-pushed the feature/BA-8504-update-session-group branch from 518181a to 865640e Compare October 21, 2026 07:23
async def update_session_group(
info: Info[StrawberryGQLContext],
input: UpdateSessionGroupInputGQL,
) -> UpdateSessionGroupPayloadGQL:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please set the type nullable (UpdateSessionGroupPayloadGQL | None). The reason is to set nullable response of updateSessionGroup GQL schema

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Made both updateSessionGroup and purgeSessionGroup payloads nullable in c90a4ab.

Comment on lines +145 to +152
@model_validator(mode="after")
def _require_a_change(self) -> Self:
if not isinstance(self.placement_direction, SessionGroupPlacementDirectionEnum) and not (
isinstance(self.placement_enforcement, SessionGroupPlacementEnforcementEnum)
):
raise ValueError(
"UpdateSessionGroupInput requires 'placement_direction' or 'placement_enforcement'"
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is okay but we don't need to validate all update input DTOs like this. maybe we can consider of implementing a new generalized update input type

@wngh4628 wngh4628 Oct 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Implementing a new generalized update input type sounds like a good idea. I’ll note it down and work on it in a separate PR when I get the chance.

seedspirit
seedspirit previously approved these changes Oct 22, 2026
wngh4628 and others added 7 commits October 22, 2026 10:56
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the service and adapter

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lidator

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d map

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wngh4628 and others added 6 commits October 22, 2026 10:56
…rather than not found

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…than a bare group

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ds nullable

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…phQL inspector

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wngh4628
wngh4628 force-pushed the feature/BA-8504-update-session-group branch from b607ef7 to dd24c4e Compare October 22, 2026 01:58
Co-authored-by: octodog <mu001@lablup.com>
@fregataa
fregataa merged commit 0bc3454 into main Oct 22, 2026
40 checks passed
@fregataa
fregataa deleted the feature/BA-8504-update-session-group branch October 22, 2026 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Documentations comp:common Related to Common component comp:manager Related to Manager component size:XL 500~ LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants