Skip to content

Conversation

@seedspirit
Copy link
Contributor

resolves #7202 (BA-3307)

Checklist: (if applicable)

  • Milestone metadata specifying the target backport version
  • Mention to the original issue
  • Installer updates including:
    • Fixtures for db schema changes
    • New mandatory config options
  • Update of end-to-end CLI integration tests in ai.backend.test
  • API server-client counterparts (e.g., manager API -> client SDK)
  • Test case(s) to:
    • Demonstrate the difference of before/after
    • Demonstrate the flow of abstract/conceptual models with a concrete implementation
  • Documentation
    • Contents in the docs directory
    • docstrings in public interfaces and type annotations

@github-actions github-actions bot added size:L 100~500 LoC comp:manager Related to Manager component labels Dec 23, 2025
@seedspirit seedspirit marked this pull request as ready for review December 23, 2025 06:57
Copy link
Contributor

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 BA-3307 by implementing proper cascade deletion of foreign key relationships (sessions and routes) when purging a scaling group. The fix prevents integrity errors that previously occurred when attempting to delete a scaling group that had associated sessions or routes.

Key Changes:

  • Implements a new purge_scaling_group action and repository method that handles cascade deletion in the correct order: RoutingRow → SessionRow → ScalingGroupRow
  • Migrates the GraphQL DeleteScalingGroup mutation from direct SQL deletion to using the new purge action
  • Adds test coverage for the purge operation with basic scenarios

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/manager/repositories/scaling_group/test_scaling_group_repository.py Adds tests for purge_scaling_group operation including success and not-found scenarios
src/ai/backend/manager/services/scaling_group/service.py Adds service method to handle purge_scaling_group action
src/ai/backend/manager/services/scaling_group/processors.py Registers purge_scaling_group action processor
src/ai/backend/manager/services/scaling_group/actions/purge_scaling_group.py Defines new PurgeScalingGroupAction and result classes
src/ai/backend/manager/repositories/scaling_group/repository.py Adds repository method for purging scaling groups
src/ai/backend/manager/repositories/scaling_group/db_source/db_source.py Implements cascade deletion logic: routes → sessions → scaling group
src/ai/backend/manager/models/gql_models/scaling_group.py Refactors DeleteScalingGroup mutation to use new purge action, removes old error handling
changes/7582.fix.md Documents the fix in changelog

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@HyeockJinKim HyeockJinKim added this pull request to the merge queue Dec 30, 2025
Merged via the queue into main with commit 059d9c7 Dec 30, 2025
31 checks passed
@HyeockJinKim HyeockJinKim deleted the fix/BA-3307 branch December 30, 2025 08:56
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:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scaling Group deletion fails without any instruction

3 participants