Skip to content

Conversation

vladlearns
Copy link
Contributor

@vladlearns vladlearns commented Oct 7, 2025

Fixes #37771.

Defensive change to make sure that if a.type is undefined or any falsy val, it defaults to an empty string before calling .toLowerCase(), preventing the crash

Crash happens here:
image
image

@vladlearns
Copy link
Contributor Author

@microsoft-github-policy-service agree

@github-actions

This comment has been minimized.

@vladlearns vladlearns force-pushed the fix/html-reporter-annotation-type-check branch from 2059116 to 4165f16 Compare October 8, 2025 08:09
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@vladlearns vladlearns force-pushed the fix/html-reporter-annotation-type-check branch from 09cc292 to 8393d85 Compare October 8, 2025 10:59
@github-actions

This comment has been minimized.

@vladlearns vladlearns force-pushed the fix/html-reporter-annotation-type-check branch from 5edd4f0 to e9b5ebe Compare October 8, 2025 11:46
@github-actions

This comment has been minimized.

@vladlearns vladlearns force-pushed the fix/html-reporter-annotation-type-check branch from e9b5ebe to 38b3ba0 Compare October 8, 2025 11:51
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Copy link
Contributor

@agg23 agg23 left a comment

Choose a reason for hiding this comment

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

With a project of this size, we require that users file an issue so we can triage it before evaluating any PRs.

@vladlearns vladlearns force-pushed the fix/html-reporter-annotation-type-check branch from 6b1df0f to e04b44f Compare October 8, 2025 15:53
@github-actions

This comment has been minimized.

@vladlearns
Copy link
Contributor Author

With a project of this size, we require that users file an issue so we can triage it before evaluating any PRs.

here you go, please #37771

@vladlearns vladlearns requested a review from agg23 October 8, 2025 16:37
@github-actions

This comment has been minimized.

@vladlearns vladlearns force-pushed the fix/html-reporter-annotation-type-check branch from eb75da7 to 27b0222 Compare October 9, 2025 10:08
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@vladlearns
Copy link
Contributor Author

I unknowingly copied a buggy pattern that was introduced in Jun 2023 f55bfe2#diff-9fe1fe455371e5592c4ac04ef88de1ae4331ce749bd6333afe8734bb4f7d8b4e for attachments.push. It was latent, because no tests were comparing the attachments arr with toEqual(). When I applied the same pattern to annotations.push, I triggered the bug because the test DOES compare the annotations arr.

Fixed both.

@github-actions

This comment has been minimized.

@vladlearns vladlearns requested a review from agg23 October 9, 2025 14:10
@github-actions

This comment has been minimized.

@vladlearns
Copy link
Contributor Author

I unknowingly copied a buggy pattern that was introduced in Jun 2023 f55bfe2#diff-9fe1fe455371e5592c4ac04ef88de1ae4331ce749bd6333afe8734bb4f7d8b4e for attachments.push. It was latent, because no tests were comparing the attachments arr with toEqual(). When I applied the same pattern to annotations.push, I triggered the bug because the test DOES compare the annotations arr.

It's unclear to me what this bug was, even looking at the previously failing test. The change for attachments should be made in a different PR.

I’ve reverted that change in this PR - I’ll open a separate issue explaining why the og pattern is buggy and share the link here /w you once it’s ready.

@github-actions

This comment has been minimized.

@vladlearns
Copy link
Contributor Author

I unknowingly copied a buggy pattern that was introduced in Jun 2023 f55bfe2#diff-9fe1fe455371e5592c4ac04ef88de1ae4331ce749bd6333afe8734bb4f7d8b4e for attachments.push. It was latent, because no tests were comparing the attachments arr with toEqual(). When I applied the same pattern to annotations.push, I triggered the bug because the test DOES compare the annotations arr.

It's unclear to me what this bug was, even looking at the previously failing test. The change for attachments should be made in a different PR.

#37813


let description = annotation.description;
if (description !== undefined && description !== null && typeof description !== 'string')
description = JSON.stringify(description);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#37761 (comment)
I think, for non-string descriptions

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@vladlearns vladlearns requested a review from dgozman October 14, 2025 09:44
@github-actions
Copy link
Contributor

Test results for "MCP"

2550 passed, 102 skipped


Merge workflow run.

@github-actions
Copy link
Contributor

Test results for "tests 1"

2 flaky ⚠️ [firefox-library] › library/inspector/cli-codegen-1.spec.ts:1079 › cli codegen › should not throw csp directive violation errors `@firefox-ubuntu-22.04-node18`
⚠️ [firefox-page] › page/page-emulate-media.spec.ts:144 › should keep reduced motion and color emulation after reload `@firefox-ubuntu-22.04-node18`

45628 passed, 811 skipped


Merge workflow run.

@pavelfeldman
Copy link
Member

Sorry folks, I'm closing this due to no issue and / or repro steps. I know it is frustrating, but it must start with the issue.

@vladlearns
Copy link
Contributor Author

@pavelfeldman the issue is here: #37771

I even created it on req: #37761 (comment)

@vladlearns
Copy link
Contributor Author

Also, @dgozman and @agg23 I've addressed all of your comments. Please re-review

@dgozman
Copy link
Contributor

dgozman commented Oct 21, 2025

@vladlearns Sorry, there was a misunderstanding here!

@dgozman dgozman reopened this Oct 21, 2025
@pavelfeldman
Copy link
Member

PR should start with the issue, this is now addressed, so we can proceed.

Looking at it again, a couple of thoughts:

  • You are validating one of the user-provided objects out of tens or hundreds. It improves this exact situation but does not really change the overall validation story. Also it does so in an ad-hock manner.
  • If we want to improve the user-objects validation we should start using zod and not produce dozens of lines of object validation.
  • I don't think it is fair for us to ask you to do the first path of these validations and honestly, I don't think the review would converge if we do. But I don't think we should introduce these dozens of lines of ad-hock validation for this one property at the same time.

With that I'm inclined to close the PR.

@vladlearns
Copy link
Contributor Author

PR should start with the issue, this is now addressed, so we can proceed.

Looking at it again, a couple of thoughts:

  • You are validating one of the user-provided objects out of tens or hundreds. It improves this exact situation but does not really change the overall validation story. Also it does so in an ad-hock manner.
  • If we want to improve the user-objects validation we should start using zod and not produce dozens of lines of object validation.
  • I don't think it is fair for us to ask you to do the first path of these validations and honestly, I don't think the review would converge if we do. But I don't think we should introduce these dozens of lines of ad-hock validation for this one property at the same time.

With that I'm inclined to close the PR.

yeah, this is a much better approach. Let's use zod. I will close this one.

@vladlearns vladlearns closed this Oct 21, 2025
@vladlearns vladlearns deleted the fix/html-reporter-annotation-type-check branch October 21, 2025 19:48
@vladlearns
Copy link
Contributor Author

ref: #37959

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.

[Bug]: HTML reporter crashes in browser when test annotation has missing or non-string type

4 participants