-
Notifications
You must be signed in to change notification settings - Fork 46
Run diff prototype #228
Run diff prototype #228
Conversation
I can't see "summary" in the diff, but this is based on the summary pass/fail numbers alone, right? Would anything much need to change in order to use the full pass/fail data once that's available in a more convenient format than tens of thousands of individual files? |
No, should be straightforward to diff all the data once it's unsharded.
This current state does not include subtests.
…On Wed, Nov 22, 2017, 5:31 PM Philip Jägenstedt ***@***.***> wrote:
I can't see "summary" in the diff, but this is based on the summary
pass/fail numbers alone, right? Would anything much need to change in order
to use the full pass/fail data once that's available in a more convenient
format than tens of thousands of individual files?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#228 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAve5DsFsfiIM_ZzTs9cawwb9C5zETufks5s5KCogaJpZM4QaDd3>
.
|
return | ||
} | ||
|
||
diffJSON := diffResults(beforeJSON, afterJSON) |
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.
My first time reading go code. If I'm reading this right, almost everything up to this point is error handling :)
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.
Yeah, go's error handling is .. verbose.
run_diff.go
Outdated
} else { | ||
platformAtRevision.Revision = pieces[1] | ||
} | ||
if IsBrowserName(platformAtRevision.Platform) { |
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.
Can you add a comment about this? Seems curious to check if the platform is a browser.
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.
Platform is actually browser[-version[-os[-version]]], in this case enforced as only the browser.
run_diff.go
Outdated
|
||
var results []TestRun | ||
query := baseQuery. | ||
Filter("BrowserName =", revision.Platform) |
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 looks funny in the same way, so now I'm thinking we're just using browser and platform as synonyms in these parts. Is that the case?
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.
TODO's added.
run_diff.go
Outdated
return results[0], nil | ||
} | ||
|
||
func fetchRunResultsJSON(ctx context.Context, r *http.Request, run TestRun) (results map[string][]int, err error) { |
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.
Can you sprinkle some TODOs around here about not fetching lots of little files, and linking to the issue for that?
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 don't think we should open the issue until this code lands (issues against branches feels dirty). However, I think this diff is valid once all data is in the one blob, so probably not a TODO for this code either.
reqURL.Path = url | ||
} | ||
var resp *http.Response | ||
if resp, err = client.Get(url); err != nil { |
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.
If this is where network errors end up, it seems somewhat likely that we'll see some. Will the client see a HTTP 500 then? If it's not very unlikely to happen, seems like some retry logic will be needed in the Travis integration?
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.
Yes, 500, idk about the likelyhood, not going to overengineer until we see an actual problem (travis makes a HUGE number of network fetches for pip etc anyway).
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.
Sure, I suppose that this will only make a handful of requests, I was thinking about what @mdittmer told me about in code where he fetched 10k files or so. If we expected that kind of load some precautions might be in order.
run_diff.go
Outdated
return results, nil | ||
} | ||
|
||
func diffResults(before map[string][]int, after map[string][]int) map[string][]int { |
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.
@mdittmer, here are a bunch of loops over test results, this is the shape of things I was imagining would be involved in computing metrics. Just FYI, let's keep going in the design doc.
diff := make(map[string][]int) | ||
for test, resultsBefore := range before { | ||
if resultsAfter, ok := after[test]; !ok { | ||
// Missing? Then N / N tests are 'different' |
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.
Do we have any tests in the code base yet? This is a bit of code that would easier to review the tests for than convince oneself about correctness in edge cases by executing in head.
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.
Will add some tests shortly and push them into this PR.
run_diff.go
Outdated
} | ||
|
||
func diffResults(before map[string][]int, after map[string][]int) map[string][]int { | ||
diff := make(map[string][]int) |
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.
Can you add a comment about what the 2-tuple int represents here? I think "number of tests different" and "total number of tests known"?
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.
Done.
util.go
Outdated
} | ||
for _, browser := range browsers { | ||
if browser == name { | ||
return true |
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.
Is there no array.contains(thing) in Go?
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.
no.
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.
Weird :)
util.go
Outdated
return false | ||
} | ||
|
||
func abs(x int) int { |
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.
Don't know go, but if https://golang.org/pkg/math/ is part of the standard library, is it most idiomatic to use that or roll your own?
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.
math lib works with floats, not ints, arguing that ints are 'trivial to roll your own'.
(I don't like Go in that regard.)
run_diff_test.go
Outdated
assertDelta(t, []int {0, 1}, []int {0, 2}, []int {1, 2}) | ||
|
||
// One new test, new test passing | ||
assertDelta(t, []int {0, 1}, []int {1, 2}, []int {1, 2}) |
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.
If I'm reading this right, the numbers returned as the same when a new test is pass and when it's failing, is that right? That would make it impossible to notify about new failing tests but not new passing tests, which I think we should.
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.
Yeah, currently the case. Removing the abs call would let you see negative values; however, this API will be extended to take a filters param, and you'd filter to only newly-failing in the fetch which is used for notifying.
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.
Sounds like a plan!
See #301
Running at https://20171122t141813-dot-wptdashboard.appspot.com/
Example: Chrome 7a0cf8ade7 vs 6ed1ba18d0 (Nov 2nd vs Nov 4th)
https://20171122t141813-dot-wptdashboard.appspot.com/api/diff?before=chrome@7a0cf8ade7&after=chrome@6ed1ba18d0
This PR adds
/api/diff?before=platform@sha&after=platform@sha
endpoint, for (dangerously simplified) summaries of the diff counts between 2 runs.Produces the same JSON format as
/results?browser={platform}&sha={sha}
, only instead ofit produces
And omits anything with the same counts. This format can* then be piped into
<wpt-results>
* Not yet prototyped
/cc @jeffcarp