Skip to content

sail: create new room via http endpoint that returns room id and secret (for later surfacing room id in UI) [ch2294]#1528

Merged
maiamcc merged 12 commits into
masterfrom
maiamcc/http-new-room
Apr 24, 2019
Merged

sail: create new room via http endpoint that returns room id and secret (for later surfacing room id in UI) [ch2294]#1528
maiamcc merged 12 commits into
masterfrom
maiamcc/http-new-room

Conversation

@maiamcc

@maiamcc maiamcc commented Apr 23, 2019

Copy link
Copy Markdown
Contributor

Hello @landism, @dmiller,

Please review the following commits I made in branch maiamcc/http-new-room:

027e857 (2019-04-23 15:44:29 -0400)
server test

7415926 (2019-04-23 15:29:55 -0400)
count number of NewRoom calls

9a47562 (2019-04-23 15:24:41 -0400)
fake roomer & green tests

1a2066f (2019-04-23 15:07:40 -0400)
better test err msg

b8abf91 (2019-04-23 15:05:51 -0400)
update make wire to include sail

def7082 (2019-04-23 12:31:09 -0400)
clean up

333f08f (2019-04-22 18:02:47 -0400)
send room id and secret with connect request

8bcc735 (2019-04-22 17:26:14 -0400)
get room id and secret from response

afa2cda (2019-04-22 17:26:09 -0400)
client calls new_room

5ae1dbe (2019-04-22 17:26:04 -0400)
new_room endpoint

Code review reminders, by giving a LGTM you attest that:

  • Commits are adequately tested
  • Code is easy to understand and conforms to style guides
  • Incomplete code is marked with TODOs
  • Code is suitably instrumented with logging and metrics

@maiamcc
maiamcc requested a review from nicks April 23, 2019 19:47
Comment thread internal/sail/client/client.go Outdated
"github.com/windmilleng/tilt/internal/hud/webview"
"github.com/windmilleng/tilt/internal/logger"
"github.com/windmilleng/tilt/internal/model"
sailCommon "github.com/windmilleng/tilt/internal/sail/common"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this seemed clearer than just referring to it as "common" in the code (and more go-like than naming the package sail_common), but idk if this stylistic 🤷‍♀️

return roomInfo.RoomID, roomInfo.Secret, nil
}

func ProvideSailRoomer(addr model.SailURL) SailRoomer {

@maiamcc maiamcc Apr 23, 2019

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it's maybe a liiittle weird that this address lives in both the roomer and the client itself? I'm not super worried but wanted to call it out.

Comment thread internal/sail/common/common.go Outdated
@@ -0,0 +1,11 @@
package common

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not call this model instead of common? Common doesn't tell me much about what's in this package.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sure that's fine

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

...damnit i should just put this in model/sail.go shouldn't i? -.-

Comment thread internal/sail/server/server.go Outdated
}

r.HandleFunc("/share", s.startRoom)
r.HandleFunc("/new_room", s.newRoom)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do you think it would be more REST-ful to make the URI /room? And then you could signal that you're want to create a new one by POST'ing to it?

Not sure how much we care about being RESTful though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🤷‍♀️ sure!


room, err := s.getRoomWithAuth(RoomID(roomID), secret)
if err != nil {
log.Printf("connectRoom: %v", err)

@jazzdan jazzdan Apr 23, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we want to set HTTP 403 here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ooh good call!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

...I don't care enough about parsing the errors to know if it should be 403 or 404 tho, so imma leave a todo

@maiamcc
maiamcc requested a review from jazzdan April 23, 2019 20:50
@maiamcc
maiamcc merged commit 69c34fe into master Apr 24, 2019
@maiamcc
maiamcc deleted the maiamcc/http-new-room branch April 24, 2019 14:51
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.

2 participants