| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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>
There was a problem hiding this comment.
Removes temporary sanitizer optimization benchmarks and equivalence scaffolding while retaining durable regression checks.
Changes:
| 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. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Sorry, something went wrong.
|
|
||
| // TestFiltersAreIdempotent states the fixed-point properties that let Sanitize | ||
| // skip its second pass when HTML normalization changed nothing. | ||
| func TestFiltersAreIdempotent(t *testing.T) { |
| Back | FazBrowse Home | New Git URL |
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/sanitize.go is untouched. Net −560 lines.
What is deliberately kept
Five checks move into sanitize_test.go instead of going away. None of them reference the old implementation, so none are equivalence scaffolding, and each guards behaviour the rewrite introduced:
FuzzHTMLInertIsPolicyFixedPoint is 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/lint clean, script/test (race) green, 40s fuzz on the retained target clean.