Repository navigation
test(sanitize): drop the optimization scaffolding - #3121
Merged
SamMorrowDrums merged 1 commit intoAug 19, 2026
Merged
Conversation
The benchmarks and the reference-implementation equivalence harness existed to justify the sanitizer rewrite. They have served that purpose, so remove them along with the verbatim copy of the old pipeline they carried. Five checks move into sanitize_test.go rather than going away, because none of them reference the old implementation and all of them guard behaviour the rewrite introduced: - isHTMLInert must be a fixed point of the live bluemonday policy, checked byte by byte and as whole strings, with the accepted byte set pinned explicitly. Nothing else fails if that set is widened, and widening it changes sanitizer output. - Both filters are fixed points on their own output, which is what licenses Sanitize to skip its second pass. - Clean ASCII sanitizes with zero allocations. - Invalid UTF-8 is re-encoded to U+FFFD. - Known payloads still lose content. Net -560 lines. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
SamMorrowDrums
force-pushed
the
sammorrowdrums-drop-sanitizer-migration-scaffolding
branch
from
August 19, 2026 14:41
a2a9761 to
3e9d347
Compare
SamMorrowDrums
deleted the
sammorrowdrums-drop-sanitizer-migration-scaffolding
branch
August 19, 2026 14:42
Contributor
There was a problem hiding this comment.
Pull request overview
Removes temporary sanitizer optimization benchmarks and equivalence scaffolding while retaining durable regression checks.
Changes:
- Deletes sanitizer and converter benchmarks.
- Removes the legacy reference-equivalence harness.
- Moves essential sanitizer invariants into the main test suite.
Show a summary per file
| File | Description |
|---|---|
pkg/sanitize/sanitize_test.go |
Adds retained invariant and regression tests. |
pkg/sanitize/equivalence_test.go |
Removes legacy equivalence scaffolding. |
pkg/sanitize/bench_test.go |
Removes sanitizer benchmarks. |
pkg/github/minimal_types_bench_test.go |
Removes converter benchmarks. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Balanced
|
|
||
| // TestFiltersAreIdempotent states the fixed-point properties that let Sanitize | ||
Follow-up to #3120.
The benchmarks and the equivalence harness existed to justify the sanitizer rewrite and produce its before/after report. That job is done, so this removes them, including the verbatim copy of the old pipeline the harness carried:
pkg/sanitize/bench_test.gopkg/sanitize/equivalence_test.gopkg/github/minimal_types_bench_test.gopkg/sanitize/sanitize.gois untouched. Net −560 lines.What is deliberately kept
Five checks move into
sanitize_test.goinstead of going away. None of them reference the old implementation, so none are equivalence scaffolding, and each guards behaviour the rewrite introduced:isHTMLInertis a fixed point of the live bluemonday policy — byte by byte, in context, and as whole strings, with the accepted byte set pinned explicitlyhtmlInertBytesand a silent change in sanitizer output. Verified by mutation: adding\rto the table fails withisHTMLInert accepted "a\rb" (byte 0x0D) but the policy rewrote it. Nothing else in the repo notices.Sanitizeto skip its second invisible/code-fence pass. If it stops holding, the early return starts dropping work.testing.AllocsPerRun)[]runeround trip the copy-on-write scan replaced; easy to lose by accident.FuzzHTMLInertIsPolicyFixedPointis kept for the same reason as the first row; the reference-diffing fuzz target is removed. Happy to strip these too if you'd rather have a clean sweep.Validation
script/lintclean,script/test(race) green, 40s fuzz on the retained target clean.