⚡️ 降低网络规则跨页测试成本并固化测试约束 - #1734
Merged
CodFrm merged 3 commits intoSep 9, 2026
Merged
Conversation
This was referenced Sep 8, 2026
Merged
Member
Collaborator
Author
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 / 检查清单
背景
NetworkRules 的跨页置顶测试用
PAGE_SIZE + 1条规则验证第二页行为,但先等待完整快照再输入筛选,导致无关的首屏行先被渲染,在 UI 850ms budget 下出现超时。本次改动
act内释放状态,并断言此时没有无关行,随后只观察跨页匹配规则。order的断言。scriptcat/no-test-large-boundary-fixture:仅识别PAGE_SIZE + 1/PAGE_ROWS + 1/PAGE_LIMIT + 1及一个const别名,要求逐处写明分页边界 rationale;不判断实际耗时或渲染顺序。AGENTS.md和测试开发规范。实现考虑
原始问题是测试 setup 的 eager state/DOM materialization,不是产品逻辑变化。规则只提供可重复的边界审查入口;helper 生成的数组、其他构造器、React 渲染量与实际耗时仍由行为测试和同环境 timing 负责。
已知限制
本地并行运行整个 NetworkRules 目录时,仓库现有 850ms UI budget 会出现 worker contention 超时;同目录单 worker 运行通过。该 PR 不提高全局 timeout,也不改变生产代码。
建议审查重点
act内完成。order,而非筛选后的可见页。constalias,并正确放行+2、任意foo + 1、let、alias chain、Array 词法遮蔽与非页面测试。验证
pnpm exec vitest run --no-coverage eslint-rules/harness.test.mjs:连续 3 次 37/37 passed。pnpm run lint:通过(Prettier、TypeScript、i18n、issue-template、全量 ESLint)。pnpm exec vitest run --project ui --no-coverage --maxWorkers=1 src/pages/options/routes/Tools/NetworkRules:10 files / 61 tests passed。pnpm exec vitest run --project ui --coverage .../NetworkRules/index.test.tsx:18/18 passed。Description的 Radix 警告,不影响退出状态。