Repository navigation
risk-gate: a test that mounts the client bundle with new Function( is scored T3 - #3089
Conversation
…ed code new Function( and eval( now live in diffPatternsNotInTests, so a test file that mounts the client bundle is scored by its path instead of being labelled T3. Shipped code is unchanged: a non-test code file still reads both lists.
|
@Birfy — new tip for review: Tier T3 ( Checks at this tip: 12 success + 1 still running ( Evidence in the body: red first ×2 (22/24, both new cases red) then green ×2 (24/24) at base |
|
Verdict: PASS at 0011b84 Ran at this tip: 1. 红先(必测) 在 tip 树上只把 2. 规则面 diff 逐字只有一行换位: 3. 不误伤 91 行合成矩阵(13 条路径 × 7 种行形):83 行档位不变,变的 8 行全是上述下降,没有一行变严,也没有任何普通插件测试被判成 T3 —— T3 只由路径(.github/)或留在 diffPatterns 里的模式给出。真实 PR 抽验:#3089 T3→T3(.github/ 路径)、#3084 T3→T3( 4. 范围 2 文件 5. 口径 6. Check-runs(tip) 16 项全终态,唯一红 |
|
Correction to my earlier review request on this PR: I listed "URL/fence rules" among the patterns that still raise a test file to T3. That was wrong — the external-URL, What remained in |
Fixes #3087
Owner: Dev-1
Reviewer: Reviewer
Written-by: Dev-1
Bot: FlyBot Dev-1
Claim-Id: 68f6cedfd0b34f568b1b921a281b0bb2
Tier: T3 (
.github/**)Base: ca07de0
Verified commit: 451c285063def5b7a674ac3374b93a3824f9c557
Tree: e28b0f24991a3fdc8d4dead49ab082f222026c6b
Pushed head: 0011b84
risk-gate.mjsis untouched; the whole change is two entries moving between the two lists a rule file already has, plus the tests that pin where each list applies.The pushed head
0011b84d52carries this tree (e28b0f24): the two-file patch is byte-identical to the version verified at4a040aa1on base3891b4f0— the only thing that changed is the rebase ontoca07de02after#3084merged, andTZ=UTC npm run verifywas re-run on the rebased tree (451c2850, same tree) with exit 0, so every count below is that tree's.What was wrong
tiers.T3.diffPatternsis read against the added lines of every code file, tests included (risk-gate.mjs:82-86). It listednew Function\(and\beval\(, so any pull request that adds a client test which mounts the built bundle —new Function('window', readFileSync(…))(window)is the standard way — was scored T3 by its own test harness.#3084is the live example: four files, real change T2 (client code) + T2 (test) + T1 (changelog) + T0 (docs), yet it carriesrisk:T3while its body saysTier: T2andenqueue-guardcomputes T2.Nothing merges that should not — T2 and T3 take the same path in
merge-gate.mjs— but "T3 = high risk" becomes noise for every PR that adds a client test, and the label contradicts both the body and the guard.The change
.github/agent/risk-rules.json, one line moved each way:tiers.T3.diffPatterns—"\\bchild_process\\b", "\\beval\\(", "new Function\\("→"\\bchild_process\\b"tiers.T3.diffPatternsNotInTests— gains"\\beval\\(", "new Function\\("ahead of the URL and fence rules.The two lists keep exactly the meaning they had:
diffPatternsis read for every code file,diffPatternsNotInTestsfor code files that are not tests, and a non-test code file reads both. So a bundle mount inplugins/social/test/x.test.jsis now scored by its path (T2), while the same expression inplugins/social/client.js,core/src/client/**orcore/src/host/**is still a T3 content hit. Everything else in the list is untouched —child_process,process.env.*TOKEN|KEY|SECRET,.only(/.skip(, lint-disable, the URL and fence rules and thecreate_child_bottopic.Red first, at
ca07de02, twiceThe three tests were added with the rule file untouched:
node --test .github/scripts/risk-gate.test.mjs→ 24 tests, 22 pass, 2 fail, exit 1, both runs:red-new-1.logsha256f607b52f4871a308,red-new-2.logsha2565310cf6f51f3dba4. The third new test passed in the red run on purpose: it is the control that the rules left indiffPatternsstill count in a test file (child_process, a secret-shaped variable,it.skip(, a lint suppression → T3 each).Green after, twice
Same command with the rule file changed → 24 tests, 24 pass, 0 fail, exit 0, both runs (
green-new-1.logsha2561d6f90e2fe869529,green-new-2.logsha25622669eec49ae599a).The three cases say what the issue asks for, and nothing wider:
new Function(inplugins/social/test/x.test.js→ T2, with nonew Function(row inwhy; the same line inplugins/social/client.js→ T3,whynamingplugins/social/client.js: /new Function\(/.eval(incore/test/a.test.js→ T1 (core/test/**is T1 by path, noevalrow); the same line incore/src/host/groups.js→ T3.diffPatternsstill raise a test file to T3.The base moved:
#3084merged, so this was re-cutWhile this was being verified,
#3084— the very pull request the issue cites — merged asca07de0289. Live main isca07de02, none of its four files is one this branch touches, so the change was rebased onto it and every number above was taken again there: the rebased commit451c2850has treee28b0f2499, the same tree the push path built onca07de02, and red ×2 (24/22/2) and green ×2 (24/24) come from that tree.The live proof, re-run on
#3084's four files atf56aa4163d2bLoaded the PR's
GET /pulls/3084/filesinto both rule sets and rancreateGate(...).judge(files):tier: T3, onewhyrow —plugins/social/test/approval-dock-memory.test.js: /new Function\(/.new Function(row is gone, and the row is still T3 — now on the size cap:size 373 lines / 4 files > 250 / 12 allowed for T2.So the pattern defect is fixed, and that pull request is not the proof of a T2 outcome:
#3084is 373 lines over four files (plugins/social/client.js+85/−21, the test +264, changelog +1,docs/subsystems/social.md+2), andtiers.T2caps at 250 lines / 12 files. That cap is a separate, intended brake — a T2-sized change stays T2, and a change larger than the T2 budget is T3 whatever its patterns say. The issue's own file counts (+64/−19, +236, +1, +2 = 322 lines) also exceed 250, so this was already true before the change.Gates, at
451c2850(treee28b0f24, the pushed tree)TZ=UTC npm run verify→ exit 0: core 3248, social 684, tree 149, timeline 172, workflow 535, project 147, gate/policy 681, interop 37, live-e2e 34 — 0 fail everywhere (sha256of the log4b7d3b2fc0592bbd).Also run on this tree:
node .github/scripts/changelog.mjs check— 0 fragments, none needed (changelog.d/is empty of pending entries; no user-visible path is touched);node .github/scripts/testing-layers.mjs --check— 880 test files in 16 workflows, all classified;node .github/scripts/check-mojibake.mjs --check— 0 occurrences of U+FFFD in 1703 text files;node .github/scripts/check-pack.mjs— exit 0;node core/scripts/build-client.mjs --checkandnode scripts/ds-bot-patches.mjs check/canonicalran green insideverify;cd core && ARCH_DOCS_BASE=3891b4f0… node scripts/check-arch-docs.mjs—arch-docs: OK (2 changed file(s)).enqueue-guardwill be red on this row forno Verifier report names the tip, the expected state of a T3 pull request before the verdict lands.Files
2 files,
+44/−1:.github/agent/risk-rules.json(+2/−1) — the two entries moved todiffPatternsNotInTests.github/scripts/risk-gate.test.mjs(+42) — the three cases aboveCheckpoint
{ "pr": 3089, "claim": "Dev-1", "issue": 3087, "summary": "risk-gate read new Function( and eval( against every code file, tests included, so a client test that mounts the bundle was scored T3 by its own harness. The two entries moved from diffPatterns to diffPatternsNotInTests, which is read only for non-test code files, and neither risk-gate.mjs nor any other pattern changed. A test file that mounts the bundle now takes its path tier while the same expression in client or host code is still a T3 content hit. Re-run on #3084's four files at f56aa4163d2b the new Function row is gone, and the row is T3 on the T2 size cap instead.", "files": [ ".github/agent/risk-rules.json", ".github/scripts/risk-gate.test.mjs" ], "checks": { "ran": "TZ=UTC npm run verify; node --test .github/scripts/risk-gate.test.mjs (red x2 before, green x2 after); tier re-run over #3084 files", "result": "green", "at": "0011b84d5241896b7b8cd77d55dd0580bed81c27" }, "next": "verdict at the pushed head, then the queue" }