-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[public-api] aligns with latest guidelines #19038
Conversation
37e26af
to
27c1691
Compare
a8bd622
to
80888c3
Compare
f3e41f8
to
da87c39
Compare
da87c39
to
ce5e2de
Compare
ffb60d1
to
d1b69a9
Compare
d1b69a9
to
a68f17f
Compare
95065d2
to
6af5924
Compare
/gh run recreate-vm=true Comment triggered a workflow runStarted workflow run: 6847733871
|
optional string avatar_url = 4; | ||
optional string full_name = 5; | ||
optional string email = 6; | ||
string avatar_url = 4; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this file I drop optional keywords from everywhere but to make update calls partial
@@ -19,15 +19,15 @@ service WorkspaceService { | |||
rpc WatchWorkspaceStatus(WatchWorkspaceStatusRequest) returns (stream WatchWorkspaceStatusResponse) {} | |||
} | |||
|
|||
message GetWorkspaceRequest { string id = 1; } | |||
message GetWorkspaceRequest { string workspace_id = 1; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixing field name conventions + drop optional keywords from everywhere
@@ -366,28 +366,19 @@ export class TeamDBImpl extends TransactionalDBImpl<TeamDB> implements TeamDB { | |||
}); | |||
} | |||
|
|||
public async setOrgSettings(orgId: string, settings: Partial<OrganizationSettings>): Promise<void> { | |||
public async setOrgSettings(orgId: string, settings: Partial<OrganizationSettings>): Promise<OrganizationSettings> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moving logic into service from DB, making sure that update returns updated data
@@ -37,41 +36,18 @@ export namespace ApplicationError { | |||
throw e; | |||
} | |||
} | |||
|
|||
export function fromGRPCError(e: any, data?: any): ApplicationError { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should never mindlessly pump error like that, we should do proper translation and if we cannot translate use INTERNAL to iterate on it
@@ -24,7 +23,7 @@ export class ApplicationError extends Error { | |||
|
|||
export namespace ApplicationError { | |||
export function hasErrorCode(e: any): e is Error & { code: ErrorCode; data?: any } { | |||
return e && e.code !== undefined; | |||
return ErrorCode.is(e["code"]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not all errors with code are ApplicationError, we will consider in the past some typeorm and Node.js errors as AppilcationErorrs, while they should be Internal
@@ -5,6 +5,8 @@ breaking: | |||
ignore: | |||
# Do not enforce breaking change detection for the experimental package | |||
- gitpod/experimental | |||
# TODO enable again after landing style changes | |||
- gitpod/v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
temporary since we are still using JSON-RPC shim
* See License.AGPL.txt in the project root for license information. | ||
*/ | ||
|
||
export type DefaultWorkspaceImageValidator = (userId: string, imageRef: string) => Promise<void>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved defaulta wokrspace image validation to organizaion-service, but then it depends on workspace-service. So decouple it we use an intermediate service with lazy loading.
@@ -2358,9 +2358,6 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable { | |||
const user = await this.checkAndBlockUser("updateOrgSettings"); | |||
traceAPIParams(ctx, { orgId, userId: user.id }); | |||
await this.guardTeamOperation(orgId, "update"); | |||
if (settings.defaultWorkspaceImage?.trim()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we forgot to move while doing org migration
@@ -282,7 +282,7 @@ function WorkspaceImageButton(props: { | |||
}; | |||
} | |||
|
|||
const image = props.settings?.defaultWorkspaceImage ?? props.defaultWorkspaceImage ?? ""; | |||
const image = props.settings?.defaultWorkspaceImage || props.defaultWorkspaceImage || ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is potentially breaking for old dashboard against new server, but affect is not significant and resolved by the page reload.
Ideally we need to deliver Huiwen's PR to stop worrying about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We discussed that a risk is pretty low, given that update is very rare operation and we deploy to cells in non working hours. Anyway we wait today for #19042 and if it takes longer then we land this one. cc @mustard-mh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mustard-mh I thinkg there is not problem actually, JSON-RPC is backward compatible, i.e. returns undefined value and old dashboard is going to use old gRPC types with optional, so it should not break, does it make sense?
6af5924
to
9d28cf8
Compare
if (!uuidValidate(req.organizationId)) { | ||
throw new ConnectError("organizationId is required", Code.InvalidArgument); | ||
} | ||
if (typeof req.name !== "string") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't allow empty name?
let message = details; | ||
// strip confusing prefix | ||
if (details.startsWith("cannt resolve base image ref: ")) { | ||
message = details.substring("cannt resolve base image ref: ".length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Respond code with be something else, see test case which use it
nit-fixing since it doesn't break UX
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what I should change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the code you added, you want to remove the prefix cannot resolve image
but it will not match since the respond rpc code is not grpc.status.INVALID_ARGUMENT
Nope, I read it wrong. Sorry for confusing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is covered because it is ||
not &&
, but I agree though that explicit check for NOT_FOUND and UNAUTHORIZED makes sense here too.
We need generally align how we propagate errors thorugh the system and we don't break contracts.
Test with preview env, LGTM /hold in case you want to fix comments above or wait #19042 to be deployed |
/unhold |
Description
This PR aligns API definition and implementation with our latest guidelines.
Summary generated by Copilot
🤖 Generated by Copilot at 27a002d
This pull request updates the protobuf files and the generated code for the public API of Gitpod, to use FieldMask for partial updates, to remove optional keywords from proto3 fields, and to fix some inconsistencies and errors in the types and default values.
Related Issue(s)
Fixes #
How to test
Test that you can update org name, workspace sharing, default image, and membership without issues.
Documentation
Preview status
Gitpod was successfully deployed to your preview environment.
Build Options
Build
Run the build with werft instead of GHA
Run Leeway with
--dont-test
Publish
Installer
Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
If enabled this will build
install/preview
If enabled this will create the environment on GCE infra
Valid options are
all
,workspace
,webapp
,ide
,jetbrains
,vscode
,ssh
. If enabled,with-preview
andwith-large-vm
will be enabled./hold