-
Notifications
You must be signed in to change notification settings - Fork 16
DEVPROD-2643: Fix useLogDownloader bug #436
Conversation
This reverts commit b0bd2e1.
1 failed test on run #4226 ↗︎
Details:
Review all test suite changes for PR #436 ↗︎ |
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.
sorry for the late review 😭 pls ping me directly whenever you want a re-review!
await waitForNextUpdate(); | ||
await waitForNextUpdate(); |
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.
the double await here strikes me as odd... could it be removed? 🤔
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 mistake thank you!
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.
not sure if this is a problem on my end, but when I run this test suite a few times locally I see quite a bit of flakiness. I also tried switching to the main branch and running the test suite a bunch of times, but I didn't see any flakiness there
src/constants/logURLTemplates.ts
Outdated
options: { priority?: boolean; text?: boolean } | ||
logLinks: TaskType["logs"], | ||
origin: string, | ||
params: { [key: string]: any } = {} |
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.
does it make sense to type the params a bit more strongly?
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 seemed to be the general typing we use for query params, à la useQueryParams
parsley/src/hooks/useQueryParam/index.ts
Line 17 in 4126a39
(params: { [key: string]: any }) => { |
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 thought it might be nice to type with options: { priority?: boolean; text?: boolean }
since we know what params to expect and constructEvergreenTaskLogURL
has that type definition!
@@ -17,28 +17,35 @@ import { | |||
import { fetchLogFile } from "utils/fetchLogFile"; |
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.
it's not a big deal, but do you know where this flash of 0 comes from? (only happens on bigger logs)
Screen.Recording.2023-11-16.at.11.09.32.PM.mov
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 actually think this is a React strict-mode quirk that occurs locally and results in certain things firing twice! We've been running into more of those lately. I can reproduce this on main
when running locally, and don't see the behavior when my branch is deployed to beta.
src/hooks/useLogDownloader/index.ts
Outdated
@@ -142,6 +150,8 @@ const useLogDownloader = ( | |||
}); | |||
setIsLoading(false); | |||
}); | |||
} else if (url === null) { | |||
setError("Log URL not specified, unable to download."); |
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 think i might tweak the wording here to something along the lines of this:
setError("Log URL not specified, unable to download."); | |
setError("Could not retrieve log URL from task, unable to download."); |
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.
lgtm!
src/constants/logURLTemplates.ts
Outdated
options: { priority?: boolean; text?: boolean } | ||
logLinks: TaskType["logs"], | ||
origin: string, | ||
params: { [key: string]: any } = {} |
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 thought it might be nice to type with options: { priority?: boolean; text?: boolean }
since we know what params to expect and constructEvergreenTaskLogURL
has that type definition!
: constructEvergreenTaskLogURL(taskID, execution, origin as any, { | ||
priority: true, | ||
text: true, | ||
}); | ||
rawLogURL = task?.logs | ||
? getEvergreenTaskLogURL(task.logs, origin, { | ||
text: true, | ||
}) | ||
: constructEvergreenTaskLogURL(taskID, execution, origin as any, { | ||
text: true, | ||
}); | ||
htmlLogURL = task?.logs | ||
? getEvergreenTaskLogURL(task.logs, origin, { | ||
text: false, | ||
}) | ||
: constructEvergreenTaskLogURL(taskID, execution, origin as any, { |
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.
wondering if it makes sense to copy the types for getEvergreenTaskLogURL
to remove the origin as any
stuff!
@@ -184,7 +254,7 @@ const getEmptyTestLogURLMock: ApolloMock< | |||
variables: { | |||
execution: 0, | |||
taskID: "a-task-id", | |||
testName: "^a-test-name$", | |||
testName: "^a-test-name-that-doesnt-exist$", |
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.
ty for fixing 😁
DEVPROD-2643
Description
/evergreen/invalid/0/task
) where the GraphQL query doesn't return a download link, use the previous approach to construct a link given the task ID, execution, etc.Testing