fix: update flavor implementation to enable/disable flavor only#107
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the flavor update endpoint to restrict modifications to only the is_disabled field, aligning the implementation with the API specification. The change replaces a general-purpose UpdateFlavor method with specialized EnableFlavor and DisableFlavor methods that exclusively toggle the disabled status.
Changes:
- Replaced
UpdateFlavorwithEnableFlavorandDisableFlavormethods in the store interface and implementations - Updated the
/api/v1/flavors/{name}endpoint to accept onlyis_disabledin the request body - Changed the success response status from 200 OK to 204 No Content
- Removed obsolete tests for the general update functionality
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/planner/server.go | Replaced general flavor update logic with enable/disable-specific methods and simplified request handling |
| internal/planner/server_test.go | Updated mock store and test cases to use new enable/disable methods instead of UpdateFlavor |
| internal/planner/telemetry_test.go | Updated mock store to implement EnableFlavor and DisableFlavor instead of UpdateFlavor |
| internal/database/database.go | Removed the general UpdateFlavor method (only diff shown, actual enable/disable implementations exist elsewhere) |
| internal/database/database_test.go | Removed tests for the deprecated UpdateFlavor functionality |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3 tasks
weiiwang01
approved these changes
Feb 2, 2026
yanksyoon
approved these changes
Feb 2, 2026
yanksyoon
reviewed
Feb 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Fix the current
updateFlavorserver endpoint to allow for updatingisDisabledfield only.Rationale
So that the implementation match the specification that the only field allowed to be updated is the is_disabled field. And this behavior is preserved: when a flavor is disabled, it resets the assigned_flavor in all jobs associated with it and reruns the pressure algorithm to assign a new flavor to those jobs.
Checklist
CONTRIBUTING.mdhas been updated upon changes to the contribution/development process (e.g. changes to the way tests are run)