Skip to content

Commit b9122b6

Browse files
committed
fix(routines): address CI lint and spell-check failures
- cspell.yaml: add exterrors, sess, routineName, azdProjectSources to word list - endpoint.go: remove unused projectEndpointPathPrefix constant - routine_create.go: wrap long buildAction() call (line >125 chars) - routine_update.go: wrap long --file flag help text - routine_manifest_test.go: expand inline map literals to multi-line - client.go: wrap ListRoutineRuns signature to fit 125-char limit - Run gofmt -w and go fix on all files (codes.go, client.go, models.go formatting)
1 parent e092aa5 commit b9122b6

9 files changed

Lines changed: 39 additions & 22 deletions

File tree

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
import: ../../.vscode/cspell.yaml
2-
words: []
2+
words:
3+
- exterrors
4+
- sess
5+
- routineName
6+
- azdProjectSources

cli/azd/extensions/azure.ai.routines/internal/cmd/endpoint.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ var foundryHostSuffixes = []string{
3434
".services.ai.azure.com",
3535
}
3636

37-
// projectEndpointPathPrefix is the expected path prefix for Foundry project endpoints.
38-
const projectEndpointPathPrefix = "/api/projects/"
39-
4037
// projectContextConfigPath is the global config path for the persisted project context.
4138
// Matches the azure.ai.agents extension for cross-extension compatibility.
4239
const projectContextConfigPath = "extensions.ai-agents.project.context"

cli/azd/extensions/azure.ai.routines/internal/cmd/routine_create.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func runRoutineCreate(ctx context.Context, cmd *cobra.Command, flags *routineCre
100100

101101
var body routines.Routine
102102
body.Name = flags.name
103-
body.Enabled = ptrBool(flags.enabled)
103+
body.Enabled = new(flags.enabled)
104104
if flags.description != "" {
105105
body.Description = flags.description
106106
}
@@ -136,7 +136,10 @@ func runRoutineCreate(ctx context.Context, cmd *cobra.Command, flags *routineCre
136136
routines.DefaultTriggerKey: trigger,
137137
}
138138

139-
action, err := buildAction(flags.action, flags.agentName, flags.agentEndpointID, flags.conversationID, flags.sessionID)
139+
action, err := buildAction(
140+
flags.action, flags.agentName, flags.agentEndpointID,
141+
flags.conversationID, flags.sessionID,
142+
)
140143
if err != nil {
141144
return err
142145
}

cli/azd/extensions/azure.ai.routines/internal/cmd/routine_helpers.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ func boolStr(b *bool) string {
6767
}
6868

6969
// ptrBool returns a pointer to b.
70-
func ptrBool(b bool) *bool { return &b }
70+
//
71+
//go:fix inline
72+
func ptrBool(b bool) *bool { return new(b) }
7173

7274
// routineSummaryTable prints a short summary of a routine in table format.
7375
func routineSummaryTable(r *routines.Routine) {

cli/azd/extensions/azure.ai.routines/internal/cmd/routine_manifest_test.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,21 @@ func TestMergeRoutineFromFile_BodyFieldsWinOverFile(t *testing.T) {
107107
Name: "from-cli",
108108
Description: "cli description",
109109
Enabled: &enabled,
110-
Triggers: map[string]routines.RoutineTrigger{"default": {Type: "timer", At: "2026-01-01T00:00:00Z"}},
111-
Actions: map[string]routines.RoutineAction{"default": {Type: "invoke_agent_responses_api", AgentName: "cli-agent"}},
110+
Triggers: map[string]routines.RoutineTrigger{
111+
"default": {Type: "timer", At: "2026-01-01T00:00:00Z"},
112+
},
113+
Actions: map[string]routines.RoutineAction{
114+
"default": {Type: "invoke_agent_responses_api", AgentName: "cli-agent"},
115+
},
112116
}
113117
file := &routines.Routine{
114118
Description: "file description",
115-
Triggers: map[string]routines.RoutineTrigger{"default": {Type: "schedule", Cron: "* * * * *"}},
116-
Actions: map[string]routines.RoutineAction{"default": {Type: "invoke_agent_invocations_api", AgentEndpointID: "ep"}},
119+
Triggers: map[string]routines.RoutineTrigger{
120+
"default": {Type: "schedule", Cron: "* * * * *"},
121+
},
122+
Actions: map[string]routines.RoutineAction{
123+
"default": {Type: "invoke_agent_invocations_api", AgentEndpointID: "ep"},
124+
},
117125
}
118126
mergeRoutineFromFile(body, file)
119127

cli/azd/extensions/azure.ai.routines/internal/cmd/routine_update.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ To change the trigger or action type, delete and recreate the routine.`,
6565
cmd.Flags().StringVar(&flags.agentEndpointID, "agent-endpoint-id", "", "New agent endpoint ID")
6666
cmd.Flags().StringVar(&flags.conversationID, "conversation-id", "", "New conversation ID (preview)")
6767
cmd.Flags().StringVar(&flags.sessionID, "session-id", "", "New session ID")
68-
cmd.Flags().StringVar(&flags.file, "file", "", "Path to a YAML/JSON manifest; merged fields win unless overridden by flags")
68+
cmd.Flags().StringVar(&flags.file, "file", "",
69+
"Path to a YAML/JSON manifest; merged fields win unless overridden by flags")
6970

7071
azdext.RegisterFlagOptions(cmd, azdext.FlagOptions{
7172
Name: "output", AllowedValues: []string{"json", "table"}, Default: "table",

cli/azd/extensions/azure.ai.routines/internal/exterrors/codes.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ const (
1010

1111
// Error codes for validation errors.
1212
const (
13-
CodeInvalidParameter = "invalid_parameter"
14-
CodeConflictingArguments = "conflicting_arguments"
13+
CodeInvalidParameter = "invalid_parameter"
14+
CodeConflictingArguments = "conflicting_arguments"
1515
CodeInvalidRoutineManifest = "invalid_routine_manifest"
16-
CodeRoutineAlreadyExists = "routine_already_exists"
16+
CodeRoutineAlreadyExists = "routine_already_exists"
1717
)
1818

1919
// Error codes for dependency errors.

cli/azd/extensions/azure.ai.routines/internal/pkg/routines/client.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import (
2020
)
2121

2222
const (
23-
routinesAPIVersion = "v1"
24-
routinesPreviewHeader = "x-ms-foundry-features-opt-in"
25-
routinesPreviewValue = "Routines=V1Preview"
23+
routinesAPIVersion = "v1"
24+
routinesPreviewHeader = "x-ms-foundry-features-opt-in"
25+
routinesPreviewValue = "Routines=V1Preview"
2626
)
2727

2828
// Client is the data-plane client for Foundry Routines API operations.
@@ -283,7 +283,9 @@ type ListRoutineRunsOptions struct {
283283
}
284284

285285
// ListRoutineRuns retrieves runs for a routine, respecting Top and Filter options.
286-
func (c *Client) ListRoutineRuns(ctx context.Context, routineName string, opts ListRoutineRunsOptions) ([]RoutineRun, error) {
286+
func (c *Client) ListRoutineRuns(
287+
ctx context.Context, routineName string, opts ListRoutineRunsOptions,
288+
) ([]RoutineRun, error) {
287289
var all []RoutineRun
288290

289291
var extraQuery []string

cli/azd/extensions/azure.ai.routines/internal/pkg/routines/models.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ type DispatchRoutineRequest struct {
7575

7676
// DispatchRoutineResponse is the response from the dispatch_async route.
7777
type DispatchRoutineResponse struct {
78-
DispatchID string `json:"dispatch_id,omitempty"`
79-
ActionCorrelationID string `json:"action_correlation_id,omitempty"`
80-
Status string `json:"status,omitempty"`
78+
DispatchID string `json:"dispatch_id,omitempty"`
79+
ActionCorrelationID string `json:"action_correlation_id,omitempty"`
80+
Status string `json:"status,omitempty"`
8181
}
8282

8383
// TriggerCLIToWire maps CLI --trigger aliases to TypeSpec wire type values.

0 commit comments

Comments
 (0)