Commit 3252011
t
Scope the transformed-source cache per handler (fix cross-handler bleed)
The TS-strip + elision cache was module-global, keyed only on (path,
mtime), but the cached bytes bake in a handler's elision verdict. Two
createRequestHandler instances for the same app with different elision
settings (a multi-tenant embedder, or the new differential elision test)
therefore poisoned each other: booting an ON handler then an OFF handler in
one process made the OFF handler serve the ON handler's already-elided
source for the same path, silently over-stripping on the OFF side.
Move the cache into per-handler state (state.tsCache). Single-handler
behaviour (production) is unchanged; multiple handlers now each serve their
own verdict. Regression test boots ON-then-OFF and asserts the OFF handler
keeps the elided import the ON handler strips.
Found in review of the differential elision test (#181).1 parent 3817eef commit 3252011
2 files changed
Lines changed: 52 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
109 | 113 | | |
110 | 114 | | |
111 | | - | |
112 | 115 | | |
113 | 116 | | |
114 | 117 | | |
| |||
291 | 294 | | |
292 | 295 | | |
293 | 296 | | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
294 | 303 | | |
295 | 304 | | |
296 | 305 | | |
| |||
524 | 533 | | |
525 | 534 | | |
526 | 535 | | |
527 | | - | |
| 536 | + | |
528 | 537 | | |
529 | 538 | | |
530 | 539 | | |
531 | 540 | | |
532 | | - | |
| 541 | + | |
533 | 542 | | |
534 | 543 | | |
535 | 544 | | |
| |||
1052 | 1061 | | |
1053 | 1062 | | |
1054 | 1063 | | |
1055 | | - | |
| 1064 | + | |
1056 | 1065 | | |
1057 | 1066 | | |
1058 | 1067 | | |
| |||
1444 | 1453 | | |
1445 | 1454 | | |
1446 | 1455 | | |
1447 | | - | |
| 1456 | + | |
1448 | 1457 | | |
1449 | | - | |
| 1458 | + | |
1450 | 1459 | | |
1451 | 1460 | | |
1452 | 1461 | | |
| |||
1499 | 1508 | | |
1500 | 1509 | | |
1501 | 1510 | | |
1502 | | - | |
1503 | | - | |
1504 | | - | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
1505 | 1514 | | |
1506 | | - | |
| 1515 | + | |
1507 | 1516 | | |
1508 | 1517 | | |
1509 | 1518 | | |
| |||
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
133 | 165 | | |
134 | 166 | | |
135 | 167 | | |
| |||
0 commit comments