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

tsc -b removes silent noEmitOnError and emits files even if there are errors #58838

Merged
merged 2 commits into from
Jun 13, 2024

Conversation

sheetalkamat
Copy link
Member

On top of #58626

Add hasErrors property to tsbuildInfo so we can build again if there are errors

Also add roots property to non incremental build to check if root files went missing.

@sheetalkamat
Copy link
Member Author

@typescript-bot test it

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 12, 2024

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
test top400 ✅ Started ✅ Results
user test this ✅ Started 👀 Results
run dt ✅ Started ✅ Results
perf test this faster ✅ Started 👀 Results

@typescript-bot
Copy link
Collaborator

Hey @sheetalkamat, the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@typescript-bot
Copy link
Collaborator

@sheetalkamat Here are the results of running the user tests with tsc comparing main and refs/pull/58838/merge:

Something interesting changed - please have a look.

Details

effect

tsconfig.json

@typescript-bot
Copy link
Collaborator

@sheetalkamat Here are some more interesting changes from running the user tests suite

Details

puppeteer

packages/puppeteer/tsconfig.json

@jakebailey
Copy link
Member

Oh, I think those test results are actually good, because we're seeing compilation proceed where it couldn't before, right?

@jakebailey
Copy link
Member

Or, maybe not; the puppeteer case has two tsconfigs for cjs/esm but maybe are getting buildinfo put into the same place? Or something?

@typescript-bot
Copy link
Collaborator

@sheetalkamat
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-Unions - node (v18.15.0, x64)
Errors 30 30 ~ ~ ~ p=1.000 n=6
Symbols 62,153 62,153 ~ ~ ~ p=1.000 n=6
Types 50,242 50,242 ~ ~ ~ p=1.000 n=6
Memory used 192,406k (± 0.06%) 193,564k (± 0.92%) ~ 192,292k 195,882k p=0.575 n=6
Parse Time 1.30s (± 0.76%) 1.31s (± 0.57%) ~ 1.30s 1.32s p=0.109 n=6
Bind Time 0.72s 0.72s (± 0.57%) ~ 0.72s 0.73s p=0.405 n=6
Check Time 9.58s (± 0.33%) 9.61s (± 0.54%) ~ 9.52s 9.68s p=0.229 n=6
Emit Time 2.77s (± 0.58%) 2.76s (± 0.96%) ~ 2.72s 2.79s p=0.624 n=6
Total Time 14.37s (± 0.31%) 14.40s (± 0.42%) ~ 14.28s 14.45s p=0.260 n=6
angular-1 - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 944,109 944,109 ~ ~ ~ p=1.000 n=6
Types 407,049 407,049 ~ ~ ~ p=1.000 n=6
Memory used 1,222,240k (± 0.00%) 1,222,200k (± 0.00%) ~ 1,222,129k 1,222,253k p=0.199 n=6
Parse Time 6.78s (± 0.55%) 6.77s (± 0.62%) ~ 6.71s 6.80s p=0.462 n=6
Bind Time 1.88s (± 0.85%) 1.87s (± 0.55%) ~ 1.86s 1.89s p=0.391 n=6
Check Time 31.45s (± 0.23%) 31.26s (± 0.43%) -0.20s (- 0.62%) 31.07s 31.48s p=0.031 n=6
Emit Time 15.31s (± 0.71%) 15.31s (± 0.86%) ~ 15.11s 15.45s p=1.000 n=6
Total Time 55.43s (± 0.34%) 55.21s (± 0.42%) ~ 54.94s 55.55s p=0.109 n=6
mui-docs - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 2,131,893 2,131,893 ~ ~ ~ p=1.000 n=6
Types 925,884 925,884 ~ ~ ~ p=1.000 n=6
Memory used 2,119,876k (± 0.00%) 2,119,866k (± 0.00%) ~ 2,119,835k 2,119,898k p=0.574 n=6
Parse Time 6.84s (± 0.14%) 6.84s (± 0.22%) ~ 6.82s 6.86s p=0.344 n=6
Bind Time 2.28s (± 0.53%) 2.30s (± 1.48%) ~ 2.26s 2.36s p=0.373 n=6
Check Time 71.25s (± 0.41%) 71.02s (± 1.48%) ~ 68.99s 72.02s p=0.810 n=6
Emit Time 0.14s (± 3.77%) 0.14s (± 3.60%) ~ 0.14s 0.15s p=0.640 n=6
Total Time 80.52s (± 0.37%) 80.30s (± 1.26%) ~ 78.35s 81.28s p=0.810 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,230,424 1,230,184 -240 (- 0.02%) ~ ~ p=0.001 n=6
Types 261,178 261,055 -123 (- 0.05%) ~ ~ p=0.001 n=6
Memory used 2,351,307k (± 0.04%) 2,347,123k (± 0.03%) -4,184k (- 0.18%) 2,346,083k 2,347,878k p=0.005 n=6
Parse Time 4.99s (± 0.51%) 4.97s (± 0.70%) ~ 4.94s 5.04s p=0.089 n=6
Bind Time 1.90s (± 0.52%) 1.90s (± 0.64%) ~ 1.88s 1.91s p=0.720 n=6
Check Time 34.04s (± 0.23%) 34.19s (± 0.18%) +0.15s (+ 0.45%) 34.10s 34.24s p=0.020 n=6
Emit Time 2.65s (± 1.61%) 2.66s (± 1.85%) ~ 2.60s 2.72s p=0.575 n=6
Total Time 43.58s (± 0.27%) 43.76s (± 0.17%) +0.18s (+ 0.41%) 43.63s 43.84s p=0.010 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,230,424 1,230,184 -240 (- 0.02%) ~ ~ p=0.001 n=6
Types 261,178 261,055 -123 (- 0.05%) ~ ~ p=0.001 n=6
Memory used 2,478,929k (± 3.13%) 2,473,716k (± 3.14%) ~ 2,422,605k 2,574,600k p=0.128 n=6
Parse Time 6.24s (± 0.40%) 6.23s (± 0.97%) ~ 6.17s 6.33s p=0.873 n=6
Bind Time 2.02s (± 0.68%) 2.01s (± 1.06%) ~ 1.98s 2.03s p=0.622 n=6
Check Time 40.48s (± 0.21%) 40.59s (± 0.36%) ~ 40.41s 40.84s p=0.173 n=6
Emit Time 3.13s (± 2.42%) 3.19s (± 2.44%) ~ 3.06s 3.29s p=0.336 n=6
Total Time 51.88s (± 0.20%) 52.04s (± 0.42%) ~ 51.78s 52.41s p=0.173 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 259,181 258,785 -396 (- 0.15%) ~ ~ p=0.001 n=6
Types 105,173 105,017 -156 (- 0.15%) ~ ~ p=0.001 n=6
Memory used 428,847k (± 0.01%) 428,512k (± 0.01%) -334k (- 0.08%) 428,477k 428,558k p=0.005 n=6
Parse Time 4.05s (± 0.46%) 4.06s (± 0.72%) ~ 4.01s 4.10s p=0.570 n=6
Bind Time 1.63s (± 0.46%) 1.62s (± 1.32%) ~ 1.60s 1.66s p=0.164 n=6
Check Time 22.32s (± 0.50%) 22.30s (± 0.36%) ~ 22.16s 22.40s p=0.575 n=6
Emit Time 1.72s (± 2.11%) 1.72s (± 1.27%) ~ 1.69s 1.75s p=0.809 n=6
Total Time 29.73s (± 0.41%) 29.70s (± 0.25%) ~ 29.59s 29.81s p=0.520 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 35 35 ~ ~ ~ p=1.000 n=6
Symbols 224,565 224,565 ~ ~ ~ p=1.000 n=6
Types 93,734 93,734 ~ ~ ~ p=1.000 n=6
Memory used 369,709k (± 0.03%) 369,760k (± 0.03%) ~ 369,586k 369,882k p=0.471 n=6
Parse Time 2.79s (± 1.03%) 2.79s (± 0.67%) ~ 2.77s 2.82s p=0.936 n=6
Bind Time 1.60s (± 1.28%) 1.59s (± 1.08%) ~ 1.57s 1.61s p=0.410 n=6
Check Time 15.73s (± 0.57%) 15.73s (± 0.49%) ~ 15.62s 15.80s p=0.936 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 20.13s (± 0.46%) 20.11s (± 0.45%) ~ 19.96s 20.19s p=0.689 n=6
vscode - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,853,080 2,853,080 ~ ~ ~ p=1.000 n=6
Types 967,904 967,904 ~ ~ ~ p=1.000 n=6
Memory used 3,025,219k (± 0.00%) 3,025,244k (± 0.00%) ~ 3,025,213k 3,025,269k p=0.378 n=6
Parse Time 13.86s (± 0.43%) 13.86s (± 0.31%) ~ 13.80s 13.93s p=1.000 n=6
Bind Time 4.25s (± 2.80%) 4.25s (± 2.69%) ~ 4.15s 4.40s p=0.934 n=6
Check Time 74.36s (± 2.09%) 74.89s (± 3.03%) ~ 72.96s 77.85s p=0.936 n=6
Emit Time 23.01s (± 6.27%) 22.63s (± 9.09%) ~ 19.95s 24.29s p=0.688 n=6
Total Time 115.47s (± 0.33%) 115.62s (± 0.48%) ~ 114.88s 116.46s p=0.810 n=6
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 266,914 266,914 ~ ~ ~ p=1.000 n=6
Types 108,685 108,685 ~ ~ ~ p=1.000 n=6
Memory used 411,898k (± 0.02%) 411,926k (± 0.01%) ~ 411,879k 411,982k p=0.471 n=6
Parse Time 3.82s (± 0.96%) 3.84s (± 1.52%) ~ 3.78s 3.94s p=0.747 n=6
Bind Time 1.66s (± 0.70%) 1.66s (± 0.54%) ~ 1.65s 1.67s p=0.672 n=6
Check Time 17.04s (± 0.36%) 17.02s (± 0.29%) ~ 16.95s 17.10s p=0.688 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 22.52s (± 0.15%) 22.52s (± 0.20%) ~ 22.44s 22.56s p=0.872 n=6
xstate-main - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 523,429 523,429 ~ ~ ~ p=1.000 n=6
Types 177,955 177,955 ~ ~ ~ p=1.000 n=6
Memory used 461,696k (± 0.07%) 461,666k (± 0.08%) ~ 461,170k 462,022k p=1.000 n=6
Parse Time 3.15s (± 0.28%) 3.16s (± 0.91%) ~ 3.12s 3.20s p=0.807 n=6
Bind Time 1.19s (± 0.75%) 1.19s (± 0.92%) ~ 1.18s 1.21s p=0.932 n=6
Check Time 18.11s (± 0.53%) 18.18s (± 0.83%) ~ 17.97s 18.36s p=0.470 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 22.45s (± 0.42%) 22.52s (± 0.64%) ~ 22.35s 22.74s p=0.378 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

@typescript-bot
Copy link
Collaborator

@sheetalkamat Here are the results of running the top 400 repos with tsc comparing main and refs/pull/58838/merge:

Everything looks good!

@sheetalkamat
Copy link
Member Author

sheetalkamat commented Jun 12, 2024

Or, maybe not; the puppeteer case has two tsconfigs for cjs/esm but maybe are getting buildinfo put into the same place? Or something?

I ran this locally and the errors are reported because the dependencies are not installed (i think it just clones and reports errors) but i tried this on main as well as this branch and number of errors are same "110" so i am not sure what bot is reporting?

If i run "npm run build" at top and then do tsc -b packages\puppeteer -clean followed by tsc -b packages\puppeteer -v there are no errors on both builds (main and this PR)

@jakebailey
Copy link
Member

The runner definitely does an install; see: https://typescript.visualstudio.com/TypeScript/_build/results?buildId=162186&view=logs&j=e514356d-f816-5eb0-c695-cd1c85d38e8d&t=87388b4c-e53f-56cd-6000-1001b7a7d293 (starting at line 388)

The only weird bit is just the order in which projects are built as far as I can tell.

…are errors

Also add roots property to non incremental build to check if root files went missing
@sheetalkamat
Copy link
Member Author

All right so i reproed it and looked at the diff and it turns out its just order. This is better and correct behavior as the errors will be sorted and reported just like they were with tsc -p rather than order of program files. Before this change we jsut got the errors and reported them but with this change we use same machinery as tsc -p for reporting errors and all the errors are sorted.

@sheetalkamat sheetalkamat marked this pull request as ready for review June 13, 2024 18:50
Copy link
Member

@weswigham weswigham left a comment

Choose a reason for hiding this comment

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

Now that there's a .buildinfo present, we can use it to store the error reporting state and don't have to rely solely on the output timestamps to ensure following builds report an error, allowing us to actually emit even when there are errors. Nice. This is probably the last thing that was blocking allowing all CLI options alongside -b at the top level, right? Just need to adjust the options parser to allow them as overrides alongside the explicit -b options and pass them through to the component projects.

@@ -1039,7 +983,7 @@ function handleDtsMayChangeOfFileAndExportsOfFile(
function getSemanticDiagnosticsOfFile(
state: BuilderProgramStateWithDefinedProgram,
sourceFile: SourceFile,
cancellationToken: CancellationToken | undefined,
cancellationToken?: CancellationToken,
Copy link
Member

Choose a reason for hiding this comment

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

Is this intentional? IIRC the token is usually required as to not forget to pass it around.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch.. that got left out from WIP and fiddling where and how to get the errors

@sheetalkamat
Copy link
Member Author

Now that there's a .buildinfo present, we can use it to store the error reporting state and don't have to rely solely on the output timestamps to ensure following builds report an error, allowing us to actually emit even when there are errors. Nice. This is probably the last thing that was blocking allowing all CLI options alongside -b at the top level, right? Just need to adjust the options parser to allow them as overrides alongside the explicit -b options and pass them through to the component projects.

Yes thats a next todo on going through them and selecting which ones make sense.

@sheetalkamat
Copy link
Member Author

Just a note that even with this change project is still not built if upstream has errors and i am looking into relaxing that so we can always generate js files and report errors

@sheetalkamat sheetalkamat merged commit b258429 into main Jun 13, 2024
28 checks passed
@sheetalkamat sheetalkamat deleted the emitOnError branch June 13, 2024 20:12
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.

4 participants