Skip to content

Change SchedulingIntents.Priority from bool to int#15

Merged
ianchen0119 merged 2 commits intomainfrom
copilot/update-scheduling-intents-priority
Feb 20, 2026
Merged

Change SchedulingIntents.Priority from bool to int#15
ianchen0119 merged 2 commits intomainfrom
copilot/update-scheduling-intents-priority

Conversation

Copy link
Contributor

Copilot AI commented Feb 20, 2026

SchedulingIntents.Priority was typed as bool, inconsistent with Intent.Priority int and silently lossy — the conversion intent.Priority > 0 collapsed the full integer value to a binary flag.

Changes

  • decisionmaker/domain/pod.goSchedulingIntents.Priority: boolint
  • decisionmaker/service/service.go — assignment: intent.Priority > 0intent.Priority
  • decisionmaker/rest/intent_handler.go — local REST mirror struct: Priority boolPriority int
// Before
type SchedulingIntents struct {
    Priority bool `json:"priority"` // If true, set vtime to minimum vtime
    ...
}
// service.go
schedulingIntent := &domain.SchedulingIntents{
    Priority: intent.Priority > 0, // lossy
    ...
}

// After
type SchedulingIntents struct {
    Priority int `json:"priority"` // Priority value; higher value means higher priority
    ...
}
// service.go
schedulingIntent := &domain.SchedulingIntents{
    Priority: intent.Priority, // full value preserved
    ...
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: ianchen0119 <42661015+ianchen0119@users.noreply.github.com>
Copilot AI changed the title [WIP] Update SchedulingIntents priority type to int Change SchedulingIntents.Priority from bool to int Feb 20, 2026
Copilot AI requested a review from ianchen0119 February 20, 2026 15:12
@ianchen0119 ianchen0119 marked this pull request as ready for review February 20, 2026 15:30
Copilot AI review requested due to automatic review settings February 20, 2026 15:30
@ianchen0119 ianchen0119 merged commit ebe5141 into main Feb 20, 2026
4 checks passed
@ianchen0119 ianchen0119 deleted the copilot/update-scheduling-intents-priority branch February 20, 2026 15:31
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 aligns the decisionmaker’s internal/REST scheduling-intent representation with the existing integer Intent.Priority, avoiding the previously lossy boolean collapse (intent.Priority > 0) and preserving the full priority value end-to-end.

Changes:

  • Update SchedulingIntents.Priority from bool to int in the decisionmaker domain model.
  • Preserve full priority values when constructing stored scheduling intents in ProcessIntents.
  • Update the decisionmaker REST list/response struct to expose priority as an integer.

Reviewed changes

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

File Description
decisionmaker/domain/pod.go Changes SchedulingIntents.Priority to int to match intent priority semantics.
decisionmaker/service/service.go Removes lossy > 0 conversion and stores the full intent.Priority.
decisionmaker/rest/intent_handler.go Updates the REST-facing scheduling intent representation to return integer priority.
Comments suppressed due to low confidence (1)

decisionmaker/rest/intent_handler.go:62

  • decisionmaker/rest/intent_handler.go defines local SchedulingIntents/LabelSelector types that mirror decisionmaker/domain types, which already required updating both places for Priority. Consider reusing the domain types directly in the list response (or type-aliasing) to reduce drift and maintenance overhead.
type SchedulingIntents struct {
	Priority      int             `json:"priority"`                // Priority value; higher value means higher priority
	ExecutionTime uint64          `json:"execution_time"`          // Time slice for this process in nanoseconds
	PID           int             `json:"pid,omitempty"`           // Process ID to apply this strategy to
	Selectors     []LabelSelector `json:"selectors,omitempty"`     // Label selectors to match pods
	CommandRegex  string          `json:"command_regex,omitempty"` // Regex to match process command
}

Comment on lines 115 to 118
schedulingIntent := &domain.SchedulingIntents{
Priority: intent.Priority > 0,
Priority: intent.Priority,
ExecutionTime: uint64(intent.ExecutionTime),
PID: process.PID,
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

This change fixes the lossy mapping of Intent.Priority into the stored scheduling intent, but there isn’t a focused test that would fail if the value regressed back to a boolean collapse. Consider adding a small unit test around the scheduling-intent representation (e.g., JSON marshal/unmarshal or list response construction) to assert the full integer priority is preserved.

Copilot uses AI. Check for mistakes.
@@ -54,7 +54,7 @@ func (h *Handler) HandleIntents(w http.ResponseWriter, r *http.Request) {

// SchedulingStrategy represents a strategy for process scheduling
Copy link

Copilot AI Feb 20, 2026

Choose a reason for hiding this comment

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

The comment above type SchedulingIntents still refers to a "SchedulingStrategy", but the struct represents an individual scheduling intent returned by the decisionmaker. Please update the comment to match the type/endpoint to avoid confusing API consumers and maintainers.

Suggested change
// SchedulingStrategy represents a strategy for process scheduling
// SchedulingIntents represents a scheduling intent returned by the decisionmaker,
// including process-level parameters and selectors used for process scheduling.

Copilot uses AI. Check for mistakes.
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.

3 participants