Skip to content

Commit ae1d974

Browse files
committed
mark fields of PatchAppStatus as deprecated
1 parent e78af95 commit ae1d974

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

coderd/workspaceagents_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,10 @@ func TestWorkspaceAgentAppStatus(t *testing.T) {
366366
AppSlug: "vscode",
367367
Message: "testing",
368368
URI: "https://example.com",
369-
Icon: "https://example.com/icon.png",
370369
State: codersdk.WorkspaceAppStatusStateComplete,
370+
// Ensure deprecated fields are ignored.
371+
Icon: "https://example.com/icon.png",
372+
NeedsUserAttention: true,
371373
})
372374
require.NoError(t, err)
373375

@@ -376,6 +378,9 @@ func TestWorkspaceAgentAppStatus(t *testing.T) {
376378
agent, err := client.WorkspaceAgent(ctx, workspace.LatestBuild.Resources[0].Agents[0].ID)
377379
require.NoError(t, err)
378380
require.Len(t, agent.Apps[0].Statuses, 1)
381+
// Deprecated fields should be ignored.
382+
require.Empty(t, agent.Apps[0].Statuses[0].Icon)
383+
require.False(t, agent.Apps[0].Statuses[0].NeedsUserAttention)
379384
})
380385
}
381386

codersdk/agentsdk/agentsdk.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -583,12 +583,14 @@ func (c *Client) PatchLogs(ctx context.Context, req PatchLogs) error {
583583

584584
// PatchAppStatus updates the status of a workspace app.
585585
type PatchAppStatus struct {
586-
AppSlug string `json:"app_slug"`
587-
NeedsUserAttention bool `json:"needs_user_attention"`
588-
State codersdk.WorkspaceAppStatusState `json:"state"`
589-
Message string `json:"message"`
590-
URI string `json:"uri"`
591-
Icon string `json:"icon"`
586+
AppSlug string `json:"app_slug"`
587+
State codersdk.WorkspaceAppStatusState `json:"state"`
588+
Message string `json:"message"`
589+
URI string `json:"uri"`
590+
// Deprecated: this field is unused and will be removed in a future version.
591+
Icon string `json:"icon"`
592+
// Deprecated: this field is unused and will be removed in a future version.
593+
NeedsUserAttention bool `json:"needs_user_attention"`
592594
}
593595

594596
func (c *Client) PatchAppStatus(ctx context.Context, req PatchAppStatus) error {

codersdk/workspaceapps.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,16 @@ type WorkspaceAppStatus struct {
106106
AgentID uuid.UUID `json:"agent_id" format:"uuid"`
107107
AppID uuid.UUID `json:"app_id" format:"uuid"`
108108
State WorkspaceAppStatusState `json:"state"`
109-
// Deprecated: This field is unused and will be removed in a future version.
110-
NeedsUserAttention bool `json:"needs_user_attention"`
111-
Message string `json:"message"`
109+
Message string `json:"message"`
112110
// URI is the URI of the resource that the status is for.
113111
// e.g. https://github.com/org/repo/pull/123
114112
// e.g. file:///path/to/file
115113
URI string `json:"uri"`
116-
// Icon is an external URL to an icon that will be rendered in the UI.
114+
117115
// Deprecated: This field is unused and will be removed in a future version.
116+
// Icon is an external URL to an icon that will be rendered in the UI.
118117
Icon string `json:"icon"`
118+
// Deprecated: This field is unused and will be removed in a future version.
119+
// NeedsUserAttention specifies whether the status needs user attention.
120+
NeedsUserAttention bool `json:"needs_user_attention"`
119121
}

0 commit comments

Comments
 (0)