Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore(codersdk): deprecate WorkspaceAppStatus.{NeedsUserAttention,Icon}#17358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
johnstcn merged 3 commits intomainfromcj/task-status/remove-unused-fields
Apr 15, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletioncoderd/apidoc/docs.go
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

5 changes: 4 additions & 1 deletioncoderd/apidoc/swagger.json
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

18 changes: 8 additions & 10 deletionscoderd/database/db2sdk/db2sdk.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -537,16 +537,14 @@ func WorkspaceAppStatuses(statuses []database.WorkspaceAppStatus) []codersdk.Wor

func WorkspaceAppStatus(status database.WorkspaceAppStatus) codersdk.WorkspaceAppStatus {
return codersdk.WorkspaceAppStatus{
ID: status.ID,
CreatedAt: status.CreatedAt,
WorkspaceID: status.WorkspaceID,
AgentID: status.AgentID,
AppID: status.AppID,
NeedsUserAttention: status.NeedsUserAttention,
URI: status.Uri.String,
Icon: status.Icon.String,
Message: status.Message,
State: codersdk.WorkspaceAppStatusState(status.State),
ID: status.ID,
CreatedAt: status.CreatedAt,
WorkspaceID: status.WorkspaceID,
AgentID: status.AgentID,
AppID: status.AppID,
URI: status.Uri.String,
Message: status.Message,
State: codersdk.WorkspaceAppStatusState(status.State),
}
}

Expand Down
18 changes: 8 additions & 10 deletionscoderd/database/dbmem/dbmem.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9764,16 +9764,14 @@ func (q *FakeQuerier) InsertWorkspaceAppStatus(_ context.Context, arg database.I
defer q.mutex.Unlock()

status := database.WorkspaceAppStatus{
ID: arg.ID,
CreatedAt: arg.CreatedAt,
WorkspaceID: arg.WorkspaceID,
AgentID: arg.AgentID,
AppID: arg.AppID,
NeedsUserAttention: arg.NeedsUserAttention,
State: arg.State,
Message: arg.Message,
Uri: arg.Uri,
Icon: arg.Icon,
ID: arg.ID,
CreatedAt: arg.CreatedAt,
WorkspaceID: arg.WorkspaceID,
AgentID: arg.AgentID,
AppID: arg.AppID,
State: arg.State,
Message: arg.Message,
Uri: arg.Uri,
}
q.workspaceAppStatuses = append(q.workspaceAppStatuses, status)
return status, nil
Expand Down
4 changes: 1 addition & 3 deletionscoderd/database/dump.sql
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
ALTER TABLE ONLY workspace_app_statuses
ADD COLUMN IF NOT EXISTS needs_user_attention BOOLEAN NOT NULL DEFAULT FALSE,
ADD COLUMN IF NOT EXISTS icon TEXT;
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
ALTER TABLE ONLY workspace_app_statuses
DROP COLUMN IF EXISTS needs_user_attention,
DROP COLUMN IF EXISTS icon;
18 changes: 8 additions & 10 deletionscoderd/database/models.go
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

38 changes: 14 additions & 24 deletionscoderd/database/queries.sql.go
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

6 changes: 3 additions & 3 deletionscoderd/database/queries/workspaceapps.sql
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,8 +44,8 @@ WHERE
id = $1;

-- name: InsertWorkspaceAppStatus :one
INSERT INTO workspace_app_statuses (id, created_at, workspace_id, agent_id, app_id, state, message,needs_user_attention,uri, icon)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
INSERT INTO workspace_app_statuses (id, created_at, workspace_id, agent_id, app_id, state, message, uri)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
RETURNING *;

-- name: GetWorkspaceAppStatusesByAppIDs :many
Expand All@@ -54,6 +54,6 @@ SELECT * FROM workspace_app_statuses WHERE app_id = ANY(@ids :: uuid [ ]);
-- name: GetLatestWorkspaceAppStatusesByWorkspaceIDs :many
SELECT DISTINCT ON (workspace_id)
*
FROM workspace_app_statuses
FROM workspace_app_statuses
WHERE workspace_id = ANY(@ids :: uuid[])
ORDER BY workspace_id, created_at DESC;
5 changes: 0 additions & 5 deletionscoderd/workspaceagents.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -366,11 +366,6 @@ func (api *API) patchWorkspaceAgentAppStatus(rw http.ResponseWriter, r *http.Req
String: req.URI,
Valid: req.URI != "",
},
Icon: sql.NullString{
String: req.Icon,
Valid: req.Icon != "",
},
NeedsUserAttention: req.NeedsUserAttention,
})
if err != nil {
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
Expand Down
7 changes: 6 additions & 1 deletioncoderd/workspaceagents_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -366,8 +366,10 @@ func TestWorkspaceAgentAppStatus(t *testing.T) {
AppSlug: "vscode",
Message: "testing",
URI: "https://example.com",
Icon: "https://example.com/icon.png",
State: codersdk.WorkspaceAppStatusStateComplete,
// Ensure deprecated fields are ignored.
Icon: "https://example.com/icon.png",
NeedsUserAttention: true,
})
require.NoError(t, err)

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

Expand Down
14 changes: 8 additions & 6 deletionscodersdk/agentsdk/agentsdk.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -583,12 +583,14 @@ func (c *Client) PatchLogs(ctx context.Context, req PatchLogs) error {

// PatchAppStatus updates the status of a workspace app.
type PatchAppStatus struct {
AppSlug string `json:"app_slug"`
NeedsUserAttention bool `json:"needs_user_attention"`
State codersdk.WorkspaceAppStatusState `json:"state"`
Message string `json:"message"`
URI string `json:"uri"`
Icon string `json:"icon"`
AppSlug string `json:"app_slug"`
State codersdk.WorkspaceAppStatusState `json:"state"`
Message string `json:"message"`
URI string `json:"uri"`
// Deprecated: this field is unused and will be removed in a future version.
Icon string `json:"icon"`
// Deprecated: this field is unused and will be removed in a future version.
NeedsUserAttention bool `json:"needs_user_attention"`
}

func (c *Client) PatchAppStatus(ctx context.Context, req PatchAppStatus) error {
Expand Down
20 changes: 5 additions & 15 deletionscodersdk/toolsdk/toolsdk.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -67,10 +67,6 @@ var (
"type": "string",
"description": "A link to a relevant resource, such as a PR or issue.",
},
"emoji": map[string]any{
"type": "string",
"description": "An emoji that visually represents your current progress. Choose an emoji that helps the user understand your current status at a glance.",
},
"state": map[string]any{
"type": "string",
"description": "The state of your task. This can be one of the following: working, complete, or failure. Select the state that best represents your current progress.",
Expand All@@ -81,7 +77,7 @@ var (
},
},
},
Required: []string{"summary", "link", "emoji", "state"},
Required: []string{"summary", "link", "state"},
},
},
Handler: func(ctx context.Context, args map[string]any) (string, error) {
Expand All@@ -104,22 +100,16 @@ var (
if !ok {
return "", xerrors.New("link must be a string")
}
emoji, ok := args["emoji"].(string)
if !ok {
return "", xerrors.New("emoji must be a string")
}
state, ok := args["state"].(string)
if !ok {
return "", xerrors.New("state must be a string")
}

if err := agentClient.PatchAppStatus(ctx, agentsdk.PatchAppStatus{
AppSlug: appSlug,
Message: summary,
URI: link,
Icon: emoji,
NeedsUserAttention: false, // deprecated, to be removed later
State: codersdk.WorkspaceAppStatusState(state),
AppSlug: appSlug,
Message: summary,
URI: link,
State: codersdk.WorkspaceAppStatusState(state),
}); err != nil {
return "", err
}
Expand Down
1 change: 0 additions & 1 deletioncodersdk/toolsdk/toolsdk_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -75,7 +75,6 @@ func TestTools(t *testing.T) {
"summary": "test summary",
"state": "complete",
"link": "https://example.com",
"emoji": "✅",
})
require.NoError(t, err)
})
Expand Down
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp