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

Fake-support the label=experimental param #82

Merged
merged 3 commits into from
Apr 25, 2018

Conversation

lukebjerring
Copy link
Contributor

@lukebjerring lukebjerring commented Apr 23, 2018

Working towards #60

Spoofs the ?label=unstable functionality support by querying for [browser]-experimental during query execution. This is to ensure that when we develop real labels, the UI doesn't need to change behaviour (just the datastore query).

Notes:

  • ?labels=A,B,C and ?label=A&label=B forms of the param are both supported.
  • Param is supported by both the /api/runs and the /results endpoints (and bubbles through).

CC @jugglinmike who may be happy to be able to view the experimental runs in the UI.

@lukebjerring
Copy link
Contributor Author

lukebjerring commented Apr 23, 2018

Oh, turns out (for obvious reasons) forks can't access the Travis secrets, so this didn't autodeploy.

Manually deployed to https://lukebjerring-unstable-dot-wptdashboard.appspot.com/results/?label=experimental

EDIT: unstable => experimental

@jugglinmike
Copy link
Contributor

You're right; I am happy to see this :)

@lukebjerring
Copy link
Contributor Author

@Hexcles - re: #83 - rebased + pushed.

Copy link
Contributor

@mdittmer mdittmer left a comment

Choose a reason for hiding this comment

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

Just a few questions + request for documentation

@@ -48,6 +49,9 @@ func apiTestRunsHandler(w http.ResponseWriter, r *http.Request) {
return
}

labels := ParseLabelsParam(r)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should have comments somewhere discussing the binding between unstable in one context and -experimental in another.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jugglinmike - can you weigh in on your preference or stable or experimental as the label? You chose -experimental as the browser suffix, so perhaps you prefer that? I'm not fussed - unstable does, as @foolip points out, kinda sound test-related.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yup, I agree with @foolip's advice, and since he made the improvement to WPT, using the same convention here will promote consistency in terminology.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK - unstable => experimental

webapp/params.go Outdated
// ParseLabelsParam returns a set list of test-run labels to include, or nil if
// no labels are provided.
func ParseLabelsParam(r *http.Request) (labels mapset.Set) {
labelParams := r.URL.Query()["label"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we do this "singular or plural" work elsewhere? Just thinking about the convenience/complexity tradeoff here, but that's moot if we have established a pattern already.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this was a copy-paste of some code above.
I'll do you one better and refactor it.

labels := ParseLabelsParam(r)
if labels != nil {
for label := range labels.Iterator().C {
sourceURL = sourceURL + "&label=" + label.(string)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is .(string) a type assertion? Could it fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it's an assertion; no it can't fail unless the set items aren't strings (which, they are).

labels := ParseLabelsParam(r)
if labels != nil {
for label := range labels.Iterator().C {
sourceURL = sourceURL + "&label=" + label.(string)
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto (type assertion)

Copy link
Member

@foolip foolip left a comment

Choose a reason for hiding this comment

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

LGTM % nits

@@ -48,6 +49,9 @@ func apiTestRunsHandler(w http.ResponseWriter, r *http.Request) {
return
}

labels := ParseLabelsParam(r)
unstable := labels != nil && labels.Contains("unstable")
Copy link
Member

Choose a reason for hiding this comment

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

I'm reminded of web-platform-tests/wpt#5956 and it doesn't seem far-fetched that it might be mistaken to mean flakiness on wpt.fyi as well, or that the label name makes its way back to wpt PRs via web-platform-tests/wpt#10503 happens.

But the only counter-proposal I can come up with which accurately describes Chrome Dev/Canary, Edge Insider Preview, Firefox Nightly and Safari Technology Preview is "latest". But if you don't think that's any better, then I surrender to "unstable" :)

webapp/params.go Outdated
// no labels are provided.
func ParseLabelsParam(r *http.Request) (labels mapset.Set) {
labelParams := r.URL.Query()["label"]
labelsParam := r.URL.Query().Get("labels")
Copy link
Member

Choose a reason for hiding this comment

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

Can you exercise labels=foo,bar in tests as well? And label=foo&label=bar if that is intended to work, which it seems like it is. (Not testing labels=foo,bar&labels=baz seems fine.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@lukebjerring lukebjerring changed the title Fake-support the label=unstable param Fake-support the label=experimental param Apr 25, 2018
@lukebjerring lukebjerring merged commit 368a3f9 into web-platform-tests:master Apr 25, 2018
@lukebjerring lukebjerring deleted the unstable branch April 25, 2018 00:09
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.

4 participants