Skip to content
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

Move MakeJoin logic to GMSL #3081

Merged
merged 21 commits into from
May 17, 2023
Merged

Move MakeJoin logic to GMSL #3081

merged 21 commits into from
May 17, 2023

Conversation

devonh
Copy link
Collaborator

@devonh devonh commented May 11, 2023

No description provided.

@devonh devonh requested a review from a team as a code owner May 11, 2023 03:54
@codecov
Copy link

codecov bot commented May 11, 2023

Codecov Report

Patch coverage: 5.56% and project coverage change: -1.05 ⚠️

Comparison is base (0489d16) 67.33% compared to head (faef4da) 66.29%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3081      +/-   ##
==========================================
- Coverage   67.33%   66.29%   -1.05%     
==========================================
  Files         497      497              
  Lines       53161    53790     +629     
==========================================
- Hits        35795    35659     -136     
- Misses      13802    14587     +785     
+ Partials     3564     3544      -20     
Flag Coverage Δ
unittests 49.54% <5.00%> (-0.58%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
clientapi/auth/auth.go 72.41% <0.00%> (-11.52%) ⬇️
clientapi/auth/login_token.go 45.71% <0.00%> (-2.78%) ⬇️
clientapi/auth/user_interactive.go 75.18% <0.00%> (-3.45%) ⬇️
clientapi/httputil/httputil.go 75.86% <0.00%> (-5.62%) ⬇️
clientapi/routing/account_data.go 45.16% <0.00%> (-2.30%) ⬇️
clientapi/routing/admin_whois.go 66.66% <0.00%> (-5.56%) ⬇️
clientapi/routing/aliases.go 69.35% <0.00%> (-3.53%) ⬇️
clientapi/routing/createroom.go 57.78% <0.00%> (-4.38%) ⬇️
clientapi/routing/deactivate.go 47.36% <0.00%> (-8.89%) ⬇️
clientapi/routing/device.go 65.89% <0.00%> (-7.07%) ⬇️
... and 65 more

... and 24 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

roomserver/internal/query/query.go Outdated Show resolved Hide resolved
federationapi/routing/routing.go Outdated Show resolved Hide resolved
federationapi/routing/join.go Outdated Show resolved Hide resolved
federationapi/routing/join.go Outdated Show resolved Hide resolved
federationapi/routing/join.go Outdated Show resolved Hide resolved
federationapi/routing/join.go Outdated Show resolved Hide resolved
federationapi/routing/join.go Outdated Show resolved Hide resolved
federationapi/routing/join.go Outdated Show resolved Hide resolved
federationapi/routing/join.go Show resolved Hide resolved
} else if err != nil {
util.GetLogger(httpReq.Context()).WithError(err).Error("eventutil.BuildEvent failed")
if response == nil {
util.GetLogger(httpReq.Context()).Error("gmsl.HandleMakeJoin returned invalid response")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I strongly dislike this: we shouldn't be returning nil responses AND nil errors. If I see this log line in the logs it gives me no clue what went wrong here. Please return an error instead with contextual information. Returning nil, nil makes sense only when A) the data being nil isn't an error and B) the nil indicates absence rather than as a result of an OR operation (error OR data).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't ever actually return nil, nil, but since it returns a pointer to the result it technically could have been nil.
The result is a pointer since it returns a full ProtoEvent struct. I could change that to be behind a pointer, but that could also technically be nil too.
Which we could just not check, and just let the server panic assuming it was a programmer error that led to this case. I really don't like leaving in intentional panics across a library boundary. It's one thing to have them for internal programming errors, but relying on an external library api behaviour is dangerous.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it can never return nil, nil then why do we have this if statement? Can we remove it?

roomserver/internal/query/query.go Show resolved Hide resolved
roomserver/internal/query/query.go Outdated Show resolved Hide resolved
Copy link
Member

@kegsay kegsay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure we are returning the correct HTTP response codes with this refactor? Otherwise LGTM

@devonh devonh merged commit 67d6876 into main May 17, 2023
@devonh devonh deleted the join-refactor branch May 17, 2023 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants