Skip to content

Don't crash type-aware linting when the project's tsbuildinfo doesn't exist yet#241

Merged
NullVoxPopuli merged 2 commits into
mainfrom
nvp/fix-tsbuildinfo-enoent
Jul 8, 2026
Merged

Don't crash type-aware linting when the project's tsbuildinfo doesn't exist yet#241
NullVoxPopuli merged 2 commits into
mainfrom
nvp/fix-tsbuildinfo-enoent

Conversation

@NullVoxPopuli

@NullVoxPopuli NullVoxPopuli commented Jul 8, 2026

Copy link
Copy Markdown
Member

Running eslint with type-aware rules on a project whose tsconfig sets a custom tsBuildInfoFile (e.g. "tsBuildInfoFile": "declarations/.tsbuildinfo") blows up on a fresh checkout / after cleaning build output:

Parsing error: ENOENT: no such file or directory, open '.../declarations/.tsbuildinfo'

...for every file in the project.

The patched ts.sys.readFile already guards the default buildinfo name (tsconfig.tsbuildinfo → returns ''), but any other name falls through to the gts/gjs rename fallback, matches neither, and the second readFileSync throws. The watch program (readBuilderProgram) reads the buildinfo without a fileExists probe, so readFile has to report a missing file as absent (that's ts.sys.readFile's contract) rather than throw.

Fix: buildinfo is never a .gts/.gjs file, so the patched readFile just delegates any .tsbuildinfo path to the unpatched host readFile — content when present, undefined when missing. (This also means an existing default-named buildinfo is now actually read instead of discarded.)

Test covers both cases; the missing-file case fails on main with the exact ENOENT above.

🤖 Generated with Claude Code

Only the default `tsconfig.tsbuildinfo` name was guarded, so a project
with a custom `tsBuildInfoFile` (e.g. "declarations/.tsbuildinfo") that
hasn't been built yet crashed type-aware linting of every file with
`Parsing error: ENOENT`. The watch program reads the buildinfo without a
fileExists probe, so readFile must report missing as absent per the
ts.sys contract. Also return the real content when the file does exist.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread src/parser/ts-patch.js
let content = '';
if (fileName.endsWith('tsconfig.tsbuildinfo')) {
return content;
if (fileName.endsWith('.tsbuildinfo')) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

the main fix here is that we don't require tsconfig prefix

Comment thread src/parser/ts-patch.js Outdated
Only the default `tsconfig.tsbuildinfo` name was guarded, so a project
with a custom `tsBuildInfoFile` (e.g. "declarations/.tsbuildinfo") that
hasn't been built yet crashed type-aware linting of every file with
`Parsing error: ENOENT`. The watch program reads the buildinfo without a
fileExists probe, so readFile must report missing as absent per the
ts.sys contract.

Buildinfo is never a .gts/.gjs file, so instead of guarding with our own
fs call, delegate to the unpatched host readFile: content when present,
undefined when missing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@NullVoxPopuli NullVoxPopuli force-pushed the nvp/fix-tsbuildinfo-enoent branch from 28001d1 to 0d0c6f6 Compare July 8, 2026 21:51
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🏎️ Benchmark Comparison

Parse

Benchmark Control (p50) Experiment (p50) Δ
🟢 gts small 923.76 ms 880.13 ms -4.7%
gts medium 1568.64 ms 1564.26 ms -0.3%
gts large 737.19 ms 739.29 ms +0.3%
gjs small 768.61 ms 762.67 ms -0.8%
gjs medium 1323.68 ms 1324.53 ms +0.1%
gjs large 602.21 ms 599.33 ms -0.5%
🟢 hbs small 129.21 ms 126.60 ms -2.0%
🟢 hbs medium 720.54 ms 703.50 ms -2.4%
hbs large 796.62 ms 782.21 ms -1.8%

🟢 faster · 🔴 slower · 🟠 slightly slower · ⚪ within 2%

Full mitata output
clk: ~3.10 GHz
cpu: AMD EPYC 7763 64-Core Processor
runtime: node 24.18.0 (x64-linux)

benchmark                   avg (min … max) p75 / p99    (min … top 1%)
------------------------------------------- -------------------------------
gts small (control)          965.38 ms/iter 992.05 ms     █                
                       (805.39 ms … 1.26 s)    1.14 s     █      █         
                    ( 13.16 mb …  88.60 mb)  42.53 mb █▁█▁█▁▁██▁▁█▁▁▁▁▁█▁▁█

gts small (experiment)       920.55 ms/iter 950.65 ms    █                 
                       (798.01 ms … 1.19 s)    1.07 s    █                 
                    ( 12.80 mb …  88.30 mb)  42.32 mb █▁██▁▁██▁█▁█▁▁█▁▁▁▁▁█

                             ┌                                            ┐
                              ╷       ┌────────────┬───┐                  ╷
         gts small (control)  ├───────┤            │   ├──────────────────┤
                              ╵       └────────────┴───┘                  ╵
                             ╷    ┌──────────┬───┐                ╷
      gts small (experiment) ├────┤          │   ├────────────────┤
                             ╵    └──────────┴───┘                ╵
                             └                                            ┘
                             798.01 ms           967.06 ms           1.14 s

summary
  gts small (experiment)
   1.05x faster than gts small (control)

------------------------------------------- -------------------------------
gts medium (control)            1.60 s/iter    1.61 s     █       █        
                          (1.48 s … 1.98 s)    1.66 s ▅ ▅ █▅    ▅ █  ▅ ▅  ▅
                    ( 79.52 mb …  98.74 mb)  84.06 mb █▁█▁██▁▁▁▁█▁█▁▁█▁█▁▁█

gts medium (experiment)         1.59 s/iter    1.61 s   █                  
                          (1.49 s … 2.02 s)    1.64 s ▅▅█ ▅     ▅  ▅▅ ▅▅  ▅
                    ( 78.57 mb …  99.17 mb)  84.00 mb ███▁█▁▁▁▁▁█▁▁██▁██▁▁█

                             ┌                                            ┐
                             ╷       ┌────────────────────┬───┐           ╷
        gts medium (control) ├───────┤                    │   ├───────────┤
                             ╵       └────────────────────┴───┘           ╵
                               ╷  ┌───────────────────────┬──┐       ╷
     gts medium (experiment)   ├──┤                       │  ├───────┤
                               ╵  └───────────────────────┴──┘       ╵
                             └                                            ┘
                             1.48 s              1.57 s              1.66 s

summary
  gts medium (experiment)
   1x faster than gts medium (control)

------------------------------------------- -------------------------------
gts large (control)          780.18 ms/iter 772.70 ms   █                  
                       (714.88 ms … 1.12 s) 817.34 ms   █                  
                    ( 14.85 mb …  87.30 mb)  38.42 mb █▁███▁█▁█▁▁█▁▁█▁▁▁▁▁█

gts large (experiment)       781.89 ms/iter 772.69 ms    █                 
                       (712.91 ms … 1.09 s) 842.33 ms ▅▅▅█▅▅▅  ▅      ▅   ▅
                    ( 14.98 mb …  86.96 mb)  38.32 mb ███████▁▁█▁▁▁▁▁▁█▁▁▁█

                             ┌                                            ┐
                              ╷   ┌─────────────────┬            ╷
         gts large (control)  ├───┤                 │────────────┤
                              ╵   └─────────────────┴            ╵
                             ╷    ┌──────────────────┬                    ╷
      gts large (experiment) ├────┤                  │────────────────────┤
                             ╵    └──────────────────┴                    ╵
                             └                                            ┘
                             712.91 ms         777.62 ms          842.33 ms

summary
  gts large (control)
   1x faster than gts large (experiment)

------------------------------------------- -------------------------------
gjs small (control)          800.90 ms/iter 799.58 ms      ██              
                       (733.36 ms … 1.06 s) 866.74 ms ▅▅ ▅▅██   ▅ ▅       ▅
                    ( 29.33 mb …  85.99 mb)  37.17 mb ██▁████▁▁▁█▁█▁▁▁▁▁▁▁█

gjs small (experiment)       791.82 ms/iter 799.34 ms       █              
                       (721.20 ms … 1.07 s) 869.14 ms   █   █              
                    ( 29.43 mb …  86.25 mb)  36.97 mb ████▁▁█▁▁▁▁██▁▁▁▁▁▁▁█

                             ┌                                            ┐
                                 ╷     ┌─────────────┬                   ╷
         gjs small (control)     ├─────┤             │───────────────────┤
                                 ╵     └─────────────┴                   ╵
                             ╷   ┌────────────────┬──┐                    ╷
      gjs small (experiment) ├───┤                │  ├────────────────────┤
                             ╵   └────────────────┴──┘                    ╵
                             └                                            ┘
                             721.20 ms         795.17 ms          869.14 ms

summary
  gjs small (experiment)
   1.01x faster than gjs small (control)

------------------------------------------- -------------------------------
gjs medium (control)            1.38 s/iter    1.41 s      █               
                          (1.27 s … 1.75 s)    1.43 s      █               
                    ( 21.00 mb …  90.73 mb)  71.21 mb █▁▁▁███▁▁▁█▁█▁▁▁▁█▁██

gjs medium (experiment)         1.38 s/iter    1.40 s      ██              
                          (1.27 s … 1.74 s)    1.43 s ▅    ██▅  ▅  ▅   ▅▅ ▅
                    ( 18.25 mb …  88.82 mb)  70.29 mb █▁▁▁▁███▁▁█▁▁█▁▁▁██▁█

                             ┌                                            ┐
                              ╷           ┌─────────────────┬───────┐     ╷
        gjs medium (control)  ├───────────┤                 │       ├─────┤
                              ╵           └─────────────────┴───────┘     ╵
                             ╷          ┌───────────────────┬─────┐       ╷
     gjs medium (experiment) ├──────────┤                   │     ├───────┤
                             ╵          └───────────────────┴─────┘       ╵
                             └                                            ┘
                             1.27 s              1.35 s              1.43 s

summary
  gjs medium (experiment)
   1x faster than gjs medium (control)

------------------------------------------- -------------------------------
gjs large (control)          641.76 ms/iter 609.62 ms ▂ █                  
                    (588.36 ms … 919.16 ms) 745.49 ms █ █                  
                    (407.96 kb …  70.69 mb)  44.10 mb █▇█▇▁▁▁▇▁▁▁▁▁▁▁▁▁▁▁▁▇

gjs large (experiment)       634.82 ms/iter 602.57 ms   █                  
                    (584.82 ms … 907.02 ms) 707.24 ms  ▅█▅                 
                    (351.88 kb …  70.00 mb)  43.55 mb ▇███▁▁▁▁▁▇▁▁▁▁▁▁▁▁▁▁▇

                             ┌                                            ┐
                              ╷┌─────────────┬                            ╷
         gjs large (control)  ├┤             │────────────────────────────┤
                              ╵└─────────────┴                            ╵
                             ╷ ┌───────────┬                   ╷
      gjs large (experiment) ├─┤           │───────────────────┤
                             ╵ └───────────┴                   ╵
                             └                                            ┘
                             584.82 ms         665.15 ms          745.49 ms

summary
  gjs large (experiment)
   1.01x faster than gjs large (control)

------------------------------------------- -------------------------------
hbs small (control)          142.32 ms/iter 149.72 ms      █               
                    (111.08 ms … 252.57 ms) 153.41 ms ▅ ▅  █▅  ▅▅     ▅ ▅▅▅
                    ( 51.33 mb …  57.19 mb)  53.91 mb █▁█▁▁██▁▁██▁▁▁▁▁█▁███

hbs small (experiment)       142.75 ms/iter 148.44 ms                    █ 
                    (107.73 ms … 284.64 ms) 149.75 ms ▅  ▅ ▅▅▅ ▅ ▅    ▅  █▅
                    ( 51.23 mb …  57.20 mb)  53.85 mb █▁▁█▁███▁█▁█▁▁▁▁█▁▁██

                             ┌                                            ┐
                                ╷         ┌────────────────────┬──────┐   ╷
         hbs small (control)    ├─────────┤                    │      ├───┤
                                ╵         └────────────────────┴──────┘   ╵
                             ╷          ┌──────────────────────┬─────┐╷
      hbs small (experiment) ├──────────┤                      │     ├┤
                             ╵          └──────────────────────┴─────┘╵
                             └                                            ┘
                             107.73 ms         130.57 ms          153.41 ms

summary
  hbs small (control)
   1x faster than hbs small (experiment)

------------------------------------------- -------------------------------
hbs medium (control)         757.30 ms/iter 749.25 ms  █                   
                       (709.06 ms … 1.02 s) 796.97 ms  █ ▅                 
                    (  8.65 mb …  82.99 mb)  37.95 mb ▇█▁█▁▇▁▁▁▇▁▁▁▁▁▁▁▁▇▁▇

hbs medium (experiment)      734.07 ms/iter 718.40 ms █ ▂                  
                    (693.79 ms … 947.41 ms) 776.16 ms █ █                  
                    (  8.80 mb …  81.72 mb)  32.59 mb █▁█▁▇▁▇▁▁▁▁▁▁▁▁▁▁▁▁▇▇

                             ┌                                            ┐
                                    ╷ ┌──────────────────┬                ╷
        hbs medium (control)        ├─┤                  │────────────────┤
                                    ╵ └──────────────────┴                ╵
                             ╷┌────────────────┬                 ╷
     hbs medium (experiment) ├┤                │─────────────────┤
                             ╵└────────────────┴                 ╵
                             └                                            ┘
                             693.79 ms         745.38 ms          796.97 ms

summary
  hbs medium (experiment)
   1.03x faster than hbs medium (control)

------------------------------------------- -------------------------------
hbs large (control)          820.40 ms/iter 801.10 ms █ ▂                  
                       (793.26 ms … 1.02 s) 856.34 ms █▅█                  
                    ( 53.31 mb …  64.86 mb)  55.48 mb ███▇▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▇

hbs large (experiment)       807.43 ms/iter 803.13 ms  ██                  
                       (776.41 ms … 1.00 s) 832.01 ms  ██                  
                    ( 53.56 mb …  63.28 mb)  55.24 mb ████▁▁▁▁▁▁██▁▁▁▁▁▁▁▁█

                             ┌                                            ┐
                                      ╷┌──────────────┬                   ╷
         hbs large (control)          ├┤              │───────────────────┤
                                      ╵└──────────────┴                   ╵
                             ╷┌───────────────┬             ╷
      hbs large (experiment) ├┤               │─────────────┤
                             ╵└───────────────┴             ╵
                             └                                            ┘
                             776.41 ms         816.38 ms          856.34 ms

summary
  hbs large (experiment)
   1.02x faster than hbs large (control)
### Project mode (type-aware)
Benchmark Control (p50) Experiment (p50) Δ
project warm parse x150 576.58 ms 579.69 ms +0.5%
🟠 project parse+typed x150 603.19 ms 619.28 ms +2.7%
projectService warm parse x150 602.41 ms 593.66 ms -1.5%
projectService parse+typed x150 628.07 ms 637.23 ms +1.5%

🟢 faster · 🔴 slower · 🟠 slightly slower · ⚪ within 2%

Full mitata output
clk: ~2.98 GHz
cpu: AMD EPYC 7763 64-Core Processor
runtime: node 24.18.0 (x64-linux)

benchmark                                   avg (min … max) p75 / p99    (min … top 1%)
----------------------------------------------------------- -------------------------------
project warm parse x150 (control)            579.41 ms/iter 582.46 ms █         █  █       
                                    (571.65 ms … 594.40 ms) 588.60 ms ██▁▁███▁▁▁█▁▁█▁▁▁▁▁▁█
                                  gc(281.43 ms … 290.94 ms) 113.45 mb (112.32 mb…114.83 mb)

project warm parse x150 (experiment)         584.43 ms/iter 586.63 ms      █     ▃         
                                    (564.88 ms … 634.12 ms) 596.98 ms ▆▁▁▁▁█▁▁▆▆▁█▁▁▆▆▁▁▁▁▆
                                  gc(280.40 ms … 288.86 ms) 110.83 mb (100.78 mb…117.83 mb)

                                             ┌                                            ┐
                                                      ╷ ┌────────┬────┐       ╷
           project warm parse x150 (control)          ├─┤        │    ├───────┤
                                                      ╵ └────────┴────┘       ╵
                                             ╷          ┌───────────────┬──┐              ╷
        project warm parse x150 (experiment) ├──────────┤               │  ├──────────────┤
                                             ╵          └───────────────┴──┘              ╵
                                             └                                            ┘
                                             564.88 ms         580.93 ms          596.98 ms

summary
  project warm parse x150 (control)
   1.01x faster than project warm parse x150 (experiment)

----------------------------------------------------------- -------------------------------
project parse+typed x150 (control)           608.44 ms/iter 609.84 ms   █  █  █            
                                    (591.87 ms … 639.70 ms) 634.54 ms █▁█▁███▁██▁▁▁▁▁▁▁▁▁▁█
                                  gc(286.92 ms … 294.08 ms) 112.92 mb (108.70 mb…117.46 mb)

project parse+typed x150 (experiment)        619.80 ms/iter 624.52 ms     █     █  █       
                                    (602.87 ms … 640.44 ms) 636.47 ms █▁▁▁█▁█▁█▁██▁█▁▁▁▁▁▁█
                                  gc(292.13 ms … 300.56 ms) 116.88 mb (112.65 mb…120.75 mb)

                                             ┌                                            ┐
                                             ╷    ┌───────────┬┐                        ╷
          project parse+typed x150 (control) ├────┤           │├────────────────────────┤
                                             ╵    └───────────┴┘                        ╵
                                                        ╷      ┌─────────┬────┐           ╷
       project parse+typed x150 (experiment)            ├──────┤         │    ├───────────┤
                                                        ╵      └─────────┴────┘           ╵
                                             └                                            ┘
                                             591.87 ms         614.17 ms          636.47 ms

summary
  project parse+typed x150 (control)
   1.02x faster than project parse+typed x150 (experiment)

----------------------------------------------------------- -------------------------------
projectService warm parse x150 (control)     604.81 ms/iter 605.36 ms           █   █      
                                    (592.67 ms … 633.53 ms) 611.42 ms █▁▁▁█▁▁█▁███▁██▁▁▁▁▁█
                                  gc(290.32 ms … 306.51 ms) 115.06 mb (113.07 mb…116.51 mb)

projectService warm parse x150 (experiment)  597.30 ms/iter 598.27 ms       ▃  █           
                                    (576.62 ms … 628.65 ms) 614.10 ms ▆▁▁▁▁▁█▁▆█▁▆▆▁▁▆▁▁▁▁▆
                                  gc(293.47 ms … 307.07 ms) 111.54 mb (110.58 mb…112.04 mb)

                                             ┌                                            ┐
                                                                ╷       ┌──────┬       ╷
    projectService warm parse x150 (control)                    ├───────┤      │───────┤
                                                                ╵       └──────┴       ╵
                                             ╷              ┌─────────┬┐                  ╷
 projectService warm parse x150 (experiment) ├──────────────┤         │├──────────────────┤
                                             ╵              └─────────┴┘                  ╵
                                             └                                            ┘
                                             576.62 ms         595.36 ms          614.10 ms

summary
  projectService warm parse x150 (experiment)
   1.01x faster than projectService warm parse x150 (control)

----------------------------------------------------------- -------------------------------
projectService parse+typed x150 (control)    634.17 ms/iter 637.89 ms      █     █         
                                    (611.01 ms … 668.35 ms) 661.32 ms █▁█▁▁███▁█▁██▁▁▁▁▁▁▁█
                                  gc(296.07 ms … 326.58 ms) 116.92 mb (112.00 mb…122.17 mb)

projectService parse+typed x150 (experiment) 641.23 ms/iter 647.14 ms ▃       █            
                                    (622.78 ms … 669.66 ms) 658.00 ms █▁▁▁▆▁▁▆█▁▁▆▁▁▆▁▁▁▆▁▆
                                  gc(300.76 ms … 315.29 ms) 118.48 mb (117.54 mb…123.58 mb)

                                             ┌                                            ┐
                                             ╷           ┌────────┬──┐                    ╷
   projectService parse+typed x150 (control) ├───────────┤        │  ├────────────────────┤
                                             ╵           └────────┴──┘                    ╵
                                                        ╷     ┌─────────┬────┐         ╷
projectService parse+typed x150 (experiment)            ├─────┤         │    ├─────────┤
                                                        ╵     └─────────┴────┘         ╵
                                             └                                            ┘
                                             611.01 ms         636.16 ms          661.32 ms

summary
  projectService parse+typed x150 (control)
   1.01x faster than projectService parse+typed x150 (experiment)

@NullVoxPopuli NullVoxPopuli added the bug Something isn't working label Jul 8, 2026
@NullVoxPopuli NullVoxPopuli merged commit abd18f4 into main Jul 8, 2026
40 checks passed
@NullVoxPopuli NullVoxPopuli deleted the nvp/fix-tsbuildinfo-enoent branch July 8, 2026 22:07
@github-actions github-actions Bot mentioned this pull request Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants