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

[ui] don't assume that an allocation has a task events array when checking if it hasBeenRestarted #20383

Conversation

philrenaud
Copy link
Contributor

@philrenaud philrenaud commented Apr 12, 2024

the hasBeenRestarted allocation property checks against its task events, which can sometimes be null

This can result on a job-index-page error when calculating the filteredAllocations to show (we don't show those allocations as "failed" that have been restarted/rescheduled if other more recent ones exist, up to a job's desired count)

(The ?. is a defensive pattern that fails truthiness checks when the object in question doesn't exist, so s.events?.content will return null instead of erroring)

@philrenaud philrenaud requested review from lgfa29 and tgross April 12, 2024 17:26
@philrenaud philrenaud self-assigned this Apr 12, 2024
@philrenaud philrenaud force-pushed the b-ui/fix-alloc-model-has-been-restarted-checking-for-null-events branch from b1ec864 to 2328d32 Compare April 12, 2024 17:28
@philrenaud philrenaud added backport/1.6.x backport to 1.6.x release line backport/1.7.x backport to 1.7.x release line labels Apr 12, 2024
@philrenaud philrenaud force-pushed the b-ui/fix-alloc-model-has-been-restarted-checking-for-null-events branch from 2328d32 to 4cb7941 Compare April 12, 2024 17:30
Copy link

github-actions bot commented Apr 12, 2024

Ember Test Audit comparison

main 4cb7941 change
passes 1550 1550 0
failures 0 0 0
flaky 0 0 0
duration 10m 40s 134ms 10m 44s 057ms +03s 923ms

Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@lgfa29 lgfa29 left a comment

Choose a reason for hiding this comment

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

Elvis operator to the rescue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.6.x backport to 1.6.x release line backport/1.7.x backport to 1.7.x release line
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants