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

Add twoslash repros to issues in this repo #39628

Merged
merged 1 commit into from
Jul 16, 2020

Conversation

orta
Copy link
Contributor

@orta orta commented Jul 16, 2020

Fixes #35389

From microsoft/TypeScript-Website#130 (comment)

Compiler-back Bug Repros

giphy-3
source

Keeping on top of compiler bugs is hard work, even just hitting watch on the TypeScript repo gets you many hundreds of emails a day from GitHub. Proving and validating a bug is easier now, thanks to the Playground improvements (supporting many TS versions, a lot more compiler flags etc), but it's still hard to keep on top of and Ryan C basically lives in an almost permanent state of triage in our issues.

To give us the chance to improve our bug reports via automation, I wrote an RFC pitching that we can support letting people write compiler backed bug reports in issues/comments which we can use to know when a bug is fixed, and if it has regressed in the future.

There are two parts to this system:

  • Making good bug reports
  • Verifying Bugs

Making Good Bug Reports

This is done by offering a web-app which gives you real-time information about the bug report you are making. Here's an example of the bug workbench which shows an inconsistency in the way we present a particular type ( #39262 )

Screen Shot 2020-07-05 at 3 19 02 PM

The app uses the same twoslash syntax we use in code snippets inside the TypeScript website to highlight type information for a particular identifier. The workbench calls the results of these queries assertions, you can assert things like:

  • Compiler errors
  • What an identifier says it is (like above)
  • The emitted .js/.d.ts/.map files from a sample
  • Completion entries

The site's goal is to teach you the syntax, and get you making repros quickly, so there's a lot of documentation in the app:

Screen Shot 2020-07-05 at 3 26 57 PM

I've been using it to write code samples for the TypeScript v2 website as it's faster than using my text editor and the CLI.

Verifying Bugs

Once you've got your repro, it gets pasted into an issue or a comment on an issue. From here it gets picker up by the verification tools. This is a GitHub Action you can find at microsoft/TypeScript-Twoslash-Repro-Action and its job is to run nightly and provide useful information about the state of your compiler-backed bug report.

You would write a repro like:

Screen Shot 2020-07-05 at 3 04 33 PM

Then overnight the bot would post something like this:

Screen Shot 2020-07-05 at 3 32 17 PM

Expanding the historical section, you can see that the verification step has also checked the repro against older builds:

Screen Shot 2020-07-05 at 3 33 22 PM

So, it looks like the bug only existed for 3.8 and 3.9. This bug was looked at after I created the repro and is actually fixed now, so the nightly run updates the original comment so that someone looking over the issue can see the new results against historical data.

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug and removed Author: Team labels Jul 16, 2020
@orta
Copy link
Contributor Author

orta commented Jul 16, 2020

I'm going to merge when green, given that there's really nothing in here.

All the code lives in: https://github.com/microsoft/TypeScript-Twoslash-Repro-Action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFC: Improving bug reports by supporting inline reproductions
2 participants