-
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
[db] Make hand-written transformers more robust against odd DB values #6775
Conversation
5a98151
to
5fb7508
Compare
5fb7508
to
76b7d79
Compare
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.
- Add an entry to
d_b_workspace_cluster
and setadmissionPreferences
/admissionConstraints
to odd values like:[
,]
orNULL
Sorry, I may have taken this a bit too far 😅
mysql> insert into d_b_workspace_cluster (name, url, tls, state, score, maxScore, govern, admissionConstraints, admissionPreferences) values ('hyper2', 'https://gitpod-staging.com', '-----BEGIN RSA PRIVATE KEY-----\n1234', 'available', 100, 100, 1, '"YOLO"', "3.1415926535");
No longer able to start workspaces:
But I guess this is not what you had in mind right?
@@ -27,6 +27,7 @@ export class DBPrebuildInfo { | |||
const obj = JSON.parse(value); | |||
return PrebuildInfo.is(obj) ? obj : undefined; | |||
} catch (error) { | |||
return undefined; |
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.
Interesting. Why was it necessary to make this explicit?
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.
Why was it necessary to make this explicit?
Not necessary (empty functions return undefined
), did not even notice making this change. Just pleasing my sense of order I guess. 😉
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.
Why wouldn't we harden and re-use Transformer#Simple_JSON
? Unless there is something very specific about these cases, re-use seems to be the less error-prone fix to me here.
@JanKoehnlein The error here actually was triggered in |
@jankeromnes That's an interesting case, albeit a different one: Injecting valid JSON of a different type. IMO we should not take it too far here. The root cause here is that |
/lgtm |
LGTM label has been added. Git tree hash: 6156820224663b5063c160d9a221963e16ba2824
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: JanKoehnlein Associated issue: #6642 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Description
Make hand-written transformers more robust against odd DB values
Related Issue(s)
Fixes #6642
How to test
d_b_workspace_cluster
and setadmissionPreferences
/admissionConstraints
to odd values like:[
,]
orNULL
kubectl port-forward mysl-0 3306
mysql -u gitpod -h 127.0.0.1 -p
INSERT INTO d_b_workspace_cluster SET name = "test", url = "https://example.dev", state = "available", score = 100, maxScore = 100, govern = TRUE, tls = "{", admissionConstraints = "[", admissionPreferences = "]";
ws-manager-bridge
logs errors (and failing re-tries), but you're still able to start a workspaceerror parsing value ws-cluster from DB
Release Notes
Documentation