Repository navigation
Commit e954b81
authored
build(html): sweep the HTML printer for spelling-dependent output (#22097)
* build(html): sweep the HTML printer for spelling-dependent output
`yarn check:html-invariants` holds the printer to two properties of its own,
which is the class of defect `benchmark:html-tools` cannot see: being a few
bytes off webpack's own best is not being worse than another tool.
Minifying an already-minified page must change nothing, and a value's
spelling must not decide what it minifies to. Respellings are lexical and
checked against webpack's own tokenizer before use, so a mutation that moved
the document is dropped rather than reported; each finding is bisected to the
attributes carrying it and re-run on the enclosing tag alone, then grouped by
that repro.
Over `test/**/*.html` it names 112 findings in under two seconds, 40 of which
#22095 fixes.
* build(html): report a printer that throws on its own output
The second minify call sat outside a handler, so a printer that reads its
own output back and throws would end the sweep with a stack trace — losing
every later document, and hiding the strongest finding the sweep can make.
It is a report now, and the respellings still answer: they never read the
second pass.
A grouped finding also counted one document once per preset, so a defect
both presets reach read as two documents and sorted above one that reached
more pages.
* test(html): keep the sweep's own test from passing vacuously
Restoring an env var that was unset stored the string "undefined", which
reads as a filter matching nothing in whatever loads the module next in that
worker — so the filters are deleted rather than reassigned.
A filter naming a fixture that was since renamed would leave the corpus
empty and every assertion after it vacuous, so the corpus is asserted to
still hold what the filter names.
* build: sweep the CSS and HTML printers from the comparison itself
The invariant sweep moves into `compare-html-tools.js` as an `--invariants`
mode, `compare-css-tools.js` gains the same over `test/**/*.css`, and the
relation both hold is `minify(minify(source)) === minify(source)`. Their
shared half — bisection, the finding report, the relation itself — lives in
`compare-tools-harness.js`, so one script per language owns that language.
Every printing row in both comparisons also carries a `2nd` column now: what
a second pass over the tool's own output moved, which is the same question
asked of the ecosystem's tools rather than only of webpack's.
The standalone script and its unit test are gone with it: what catches a
defect here is a tooling script, not a test beside it.
* build: report the printer's own invariants from a plain comparison run
The relations need no install, so each comparison opens with them rather
than hiding them behind a script of its own: what a run costs and what it
owes are one report. `--invariants` still prints that section and stops,
for a caller that does not want the ten minutes behind it.
The sweep reads the comparison's built fixtures too — tag soup, web
components, a component page, a table report — at a size the bisection can
still cut a repro out of.1 parent da4ad13 commit e954b81
5 files changed
Lines changed: 1076 additions & 59 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
380 | 380 | | |
381 | 381 | | |
382 | 382 | | |
| 383 | + | |
383 | 384 | | |
384 | 385 | | |
385 | 386 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
| |||
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
36 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
37 | 46 | | |
38 | 47 | | |
| 48 | + | |
39 | 49 | | |
40 | 50 | | |
41 | 51 | | |
| 52 | + | |
42 | 53 | | |
| 54 | + | |
| 55 | + | |
43 | 56 | | |
44 | 57 | | |
45 | 58 | | |
| |||
212 | 225 | | |
213 | 226 | | |
214 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
215 | 251 | | |
216 | 252 | | |
217 | 253 | | |
| |||
366 | 402 | | |
367 | 403 | | |
368 | 404 | | |
369 | | - | |
| 405 | + | |
| 406 | + | |
370 | 407 | | |
371 | 408 | | |
372 | 409 | | |
373 | 410 | | |
374 | 411 | | |
375 | 412 | | |
376 | 413 | | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
| 414 | + | |
382 | 415 | | |
383 | 416 | | |
384 | 417 | | |
385 | 418 | | |
386 | 419 | | |
387 | 420 | | |
388 | 421 | | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
393 | | - | |
394 | | - | |
| 422 | + | |
| 423 | + | |
395 | 424 | | |
396 | 425 | | |
397 | 426 | | |
| |||
574 | 603 | | |
575 | 604 | | |
576 | 605 | | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
577 | 725 | | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
578 | 729 | | |
579 | 730 | | |
580 | 731 | | |
| |||
610 | 761 | | |
611 | 762 | | |
612 | 763 | | |
613 | | - | |
| 764 | + | |
614 | 765 | | |
615 | 766 | | |
616 | 767 | | |
| |||
647 | 798 | | |
648 | 799 | | |
649 | 800 | | |
650 | | - | |
| 801 | + | |
| 802 | + | |
651 | 803 | | |
652 | 804 | | |
653 | 805 | | |
| |||
665 | 817 | | |
666 | 818 | | |
667 | 819 | | |
668 | | - | |
669 | | - | |
670 | | - | |
671 | | - | |
672 | | - | |
673 | | - | |
674 | | - | |
675 | | - | |
676 | | - | |
677 | | - | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
678 | 838 | | |
679 | 839 | | |
680 | 840 | | |
| |||
0 commit comments