⚡️ 压缩用户管理网络规则的 DNR 编译输出 - #1733
Open
cyfung1031 wants to merge 1 commit into
Open
Conversation
Collaborator
Author
|
既有 vitest timeout 问题见 #1734 |
Member
|
不是很认可,哪怕 modifyHeaders 属于 DNR 的 unsafe rule,Chrome 上限 5000,一般也很难达到 而且这么压缩过后产生不一致性,会导致问题排查困难,换来的收益微乎其微 |
Collaborator
Author
这个是在DNR 层做统一合并。用户使用不变。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist / 检查清单
人工 review 尚未发生;本次 commit 已由三个分拆的自动化 review packet 分别检查 semantic/priority、domain canonicalization、以及 tests/scope,并在 commit SHA 上重新绑定复核。
背景
User-managed network rules 目前每条 enabled logical rule 都占用一条 physical DNR rule。大量相同的 response-header removal rules 会不必要地消耗
modifyHeadersdynamic-rule quota。本次改动
requestDomains外 canonical-equal 时才合并。MAX_RULE_DOMAINS分块。实现考虑
active enabled rule 是 merge barrier;disabled rule 在 candidate 阶段被跳过,因此不会阻断相邻 active rules。signature 使用完整 compiled condition 减去唯一允许变化的
requestDomains,只对已知 set-like fields canonicalize,避免未来字段被未知地忽略。第一版只允许 idempotent response-headerremove,不会合并append、set、request-header modification、redirect、allow 或 block。已知限制
建议审查重点
requestDomains之外的字段差异而产生。验证
pnpm exec vitest run --no-coverage --reporter=default src/app/service/service_worker/network_rule_compiler.test.ts src/app/service/service_worker/network_rule.test.ts src/app/repo/network_rule.test.ts src/pages/options/routes/Tools/sections/NetworkRulesSection.test.tsx— 4 files, 69 tests passed。pnpm run lint— Prettier, TypeScript, i18n, issue-template checks and ESLint passed。pnpm run build— passed; only existing size/Monaco warnings were emitted。9e07a8a1d22c0db00e74f6b3b0526ed9c34edb23; semantic, domain, and tests/scope packets all accepted.