Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/agent/risk-rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@
],
"codeExt": "\\.(js|mjs|cjs|ts|jsx|tsx|py|sh|yml|yaml|json|html|css)$",
"diffPatterns": [
"\\bchild_process\\b",
"\\beval\\(",
"new Function\\(",
"\\bexec(Sync)?\\(['\"]",
"\\bos\\.system\\(|\\bsubprocess\\.(run|call|Popen|check_output)",
"process\\.env\\.[A-Za-z_]*(TOKEN|KEY|SECRET)",
"os\\.environ(\\.get)?[\\[(][^\\n]{0,60}(TOKEN|KEY|SECRET)",
"\\.dsh(?![-\\w])|DSH_HOME",
Expand All @@ -42,7 +37,12 @@
],
"diffPatternsNotInTests": [
"https?://(?!(localhost|127\\.0\\.0\\.1|example\\.(com|org)|github\\.com/(ThinkFlowLab|Birfy)|raw\\.githubusercontent\\.com/(ThinkFlowLab|Birfy)|registry\\.npmjs\\.org))",
"untrusted-(message|file)|\\bfence|sanitiz|displayName|display name"
"untrusted-(message|file)|\\bfence|sanitiz|displayName|display name",
"\\bchild_process\\b",
"\\beval\\(",
"new Function\\(",
"\\bexec(Sync)?\\(['\"]",
"\\bos\\.system\\(|\\bsubprocess\\.(run|call|Popen|check_output)"
],
"testPaths": ["tests/**", "**/test/**", "**/tests/**", "**/*.test.{js,mjs,cjs,ts,jsx,tsx}", "**/test_*.py", "**/*_test.py"],
"topics": []
Expand Down
12 changes: 12 additions & 0 deletions .github/scripts/risk-gate.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ test('judge: content hits in added lines of code raise to T3', () => {
}
})

test('judge: exec-family hits in a test file stay out of the tier, in product code they still count', () => {
// These two patterns used to hit fixtures: #3382 was called T3 for `new Function(` inside
// runtime/flybot/plugins/social/test/. A test that evaluates or spawns is ordinary test
// machinery, so those patterns are read on product code only. `.only(` and the lint
// suppressions stay in `diffPatterns`, because in a test file they still mean something.
const spawned = ["+import { exec } from 'node:child_process'"]
assert.notEqual(gate.judge([file('tests/harness.mjs', spawned)]).tier, 'T3', 'test helper')
assert.notEqual(gate.judge([file('runtime/flybot/plugins/social/test/poll-visibility.test.js', ['+new Function(source)'])]).tier, 'T3', 'test fixture')
assert.equal(gate.judge([file('runtime/flybot/plugins/social/src/a.js', spawned)]).tier, 'T3', 'product code still counts')
assert.equal(gate.judge([file('tests/test_a.py', ['+test.only("x")'])]).tier, 'T3', '.only still counts in a test')
})

test('#679: a topic counts on the registration line, not on a line that names the tool', () => {
// The rule survives the port even though no tool in this tree registers a topic yet (`topics` is
// empty): a plain substring match made any mention of a tool a T3 PR, so the narrow form is kept
Expand Down
Loading