- Notifications
You must be signed in to change notification settings - Fork1.1k
chore(codersdk/toolsdk): improve static analyzability of toolsdk.Tools#17562
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
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
12 commits Select commitHold shift + click to select a range
4d2dbf0 chore(codersdk/toolsdk): add typed argument to toolsdk.Tool
johnstcna7784ea chore(codersdk/toolsdk): add tool deps in toolbox struct instead of c…
johnstcn5b30ea0 chore(codersdk/toolsdk): add panic recovery tool middleware
johnstcndef3fcb chore(coderd): improve tests for patchWorkspaceAgentAppStatus
johnstcn5647b8b simplify toolbox impl, rename to deps
johnstcnc1057d9 add WithCleanContext middleware func
johnstcn9edd5f7 fix(codersdk/toolsdk): address type incompatibility issues
johnstcn0f1d4ac fix tests
johnstcn2462f76 address PR feedback
johnstcn233f9da address more PR comments
johnstcn40b2fdc unexport deps fields
johnstcn6d7561f Merge branch 'main' into cj/toolsdk-refactor
johnstcnFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
46 changes: 21 additions & 25 deletionscli/exp_mcp.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
22 changes: 16 additions & 6 deletionscli/exp_mcp_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
28 changes: 26 additions & 2 deletionscoderd/workspaceagents.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -338,9 +338,33 @@ func (api *API) patchWorkspaceAgentAppStatus(rw http.ResponseWriter, r *http.Req | ||
| Slug: req.AppSlug, | ||
| }) | ||
| if err != nil { | ||
| httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{ | ||
| Message: "Failed to get workspace app.", | ||
| Detail: fmt.Sprintf("No app found with slug %q", req.AppSlug), | ||
| }) | ||
| return | ||
| } | ||
| if len(req.Message) > 160 { | ||
johnstcn marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{ | ||
| Message: "Message is too long.", | ||
| Detail: "Message must be less than 160 characters.", | ||
| Validations: []codersdk.ValidationError{ | ||
| {Field: "message", Detail: "Message must be less than 160 characters."}, | ||
| }, | ||
| }) | ||
| return | ||
| } | ||
| switch req.State { | ||
| case codersdk.WorkspaceAppStatusStateComplete, codersdk.WorkspaceAppStatusStateFailure, codersdk.WorkspaceAppStatusStateWorking: // valid states | ||
| default: | ||
| httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{ | ||
| Message: "Invalid state provided.", | ||
| Detail: fmt.Sprintf("invalid state: %q", req.State), | ||
| Validations: []codersdk.ValidationError{ | ||
| {Field: "state", Detail: "State must be one of: complete, failure, working."}, | ||
| }, | ||
| }) | ||
| return | ||
| } | ||
83 changes: 64 additions & 19 deletionscoderd/workspaceagents_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.