Skip to content

fix: update flavor implementation to enable/disable flavor only#107

Merged
florentianayuwono merged 3 commits into
mainfrom
fix/update-flavor
Feb 2, 2026
Merged

fix: update flavor implementation to enable/disable flavor only#107
florentianayuwono merged 3 commits into
mainfrom
fix/update-flavor

Conversation

@florentianayuwono

@florentianayuwono florentianayuwono commented Jan 30, 2026

Copy link
Copy Markdown
Collaborator

Overview

Fix the current updateFlavor server endpoint to allow for updating isDisabled field 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

  • Changes comply with the project's coding standards and guidelines (see CONTRIBUTING.md and STYLE.md)
  • CONTRIBUTING.md has been updated upon changes to the contribution/development process (e.g. changes to the way tests are run)
  • Technical author has been assigned to review the PR in case of documentation changes (usually *.md files)

Copilot AI left a comment

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.

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 UpdateFlavor with EnableFlavor and DisableFlavor methods in the store interface and implementations
  • Updated the /api/v1/flavors/{name} endpoint to accept only is_disabled in 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.

Comment thread internal/planner/server_test.go Outdated
Comment thread internal/planner/server.go
Comment thread internal/planner/server.go
@florentianayuwono florentianayuwono merged commit bfa83ff into main Feb 2, 2026
43 of 46 checks passed
@florentianayuwono florentianayuwono deleted the fix/update-flavor branch February 2, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants