Skip to content

Ignore tsserver results when both results have identical request IDs and command names #98

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

Merged
merged 4 commits into from
Feb 16, 2023

Conversation

jakebailey
Copy link
Member

While the tsc reporter will compare errors and hide when there's a diff, the tsserver reporter instead always reports if the current PR fails, including both traces.

It seems like all of our current spurious outputs (microsoft/TypeScript#52809 (comment)) are cases where the errors have identical IDs and command names.

This PR makes it so that if they are identical, we ignore the problem.

@DanielRosenwasser
Copy link
Member

I think we're trying to drive the "known" number down to 0 - so until then, we should continue reporting.

@andrewbranch
Copy link
Member

This seems like the right behavior for PRs, though.

Implementation-wise, I don’t know this codebase at all, but it’s not clear to me why command name and request id would be enough to say that two outputs are the same?

@andrewbranch
Copy link
Member

Oh, this object only exists if it’s a failure, so the assumption is that if each failed, they’re equal-ish.

@jakebailey
Copy link
Member Author

I think we're trying to drive the "known" number down to 0 - so until then, we should continue reporting.

Sure, but right now, it's spamming PRs with huge amounts of comments and text that have nothing to do with the PRs, and we don't do this at all for tsc, regardless of if it's a PR. I think we need to do something.

Implementation-wise, I don’t know this codebase at all, but it’s not clear to me why command name and request id would be enough to say that two outputs are the same?

It's not, really; I'm struggling to come up with a good mechanism because I can't just stringly-compare the messages. I would need to sanitize them for file/line, at least, but we'd still be sensitive to function name changes too.

I'll see if there's a specific option that's set on PRs, though.

@DanielRosenwasser
Copy link
Member

This seems like the right behavior for PRs, though.

I agree with that - the only exception being cases where your PR is supposed to fix these issues.

@jakebailey
Copy link
Member Author

I agree with that - the only exception being cases where your PR is supposed to fix these issues.

If we get rid of the errors, then the existing code here doesn't report anything either! I noticed that too. I can try and fix that here.

        switch (newSpawnResult.code) {
            case 0:
            case null:
                if (newSpawnResult.signal !== null) {
                    console.log(`Exited with signal ${newSpawnResult.signal}`);
                    return { status: "Unknown failure" };
                }

                console.log("No issues found");
                return { status: "Detected no interesting changes" };

@jakebailey
Copy link
Member Author

jakebailey commented Feb 16, 2023

Okay, I've changed it such that now:

  • If both succeed, we report nothing.
  • If the new fails, but the old succeeds, we report the new failure.
  • If the old fails, but the new succeeds, we report the old failure (collapsed) but say that the new server no longer fails.
  • If both fail, then:
    • If in a PR and the sequence number and command match, we report nothing.
    • Otherwise, we report both errors.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Co-authored-by: Daniel Rosenwasser <[email protected]>
@jakebailey jakebailey merged commit 97cfe6e into microsoft:main Feb 16, 2023
@jakebailey jakebailey deleted the tsserver-repeat branch February 17, 2023 00:10
@@ -233,7 +235,6 @@ async function getTsServerRepoResult(
}

console.log("No issues found");
return { status: "Detected no interesting changes" };
Copy link
Member Author

Choose a reason for hiding this comment

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

Ugh, this was wrong because fallthrough! Will fix.

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.

None yet

3 participants