Skip to content

Commit d094506

Browse files
committed
fix: tighten real behavior proof heuristics
1 parent 0470589 commit d094506

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

scripts/github/real-behavior-proof-policy.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const mockOnlyEvidenceRegex =
5757
/\b(?:pnpm|npm|yarn|bun)\s+(?:run\s+)?(?:test|vitest|lint|typecheck|tsgo|build|check)\b|\b(?:vitest|unit tests?|mock(?:ed|s)?|snapshots?|lint|typechecks?|tsgo|ci(?:\s+passes?)?)\b/i;
5858

5959
const realEvidenceRegex =
60-
/!\[[^\]]*\]\([^)]+\)|github\.com\/user-attachments\/assets\/|https?:\/\/\S+\.(?:png|jpe?g|gif|webp|mp4|mov|webm)\b|\b(?:screenshot|screen\s*recording|recording|terminal\s+(?:capture|screenshot|transcript|output)|console\s+(?:output|log)|runtime\s+logs?|redacted\s+logs?|live\s+output|actual\s+output|observed\s+output|stdout|stderr|stack trace|trace excerpt|log excerpt)\b|```[\s\S]*\n[\s\S]*\n```/i;
60+
/!\[[^\]]*\]\([^)]+\)|github\.com\/user-attachments\/assets\/|github\.com\/[^/\s]+\/[^/\s]+\/actions\/runs\/\d+\/artifacts\/\d+|https?:\/\/\S+\.(?:png|jpe?g|gif|webp|mp4|mov|webm)\b|\b(?:screenshot|screen\s*recording|recording|terminal\s+(?:capture|screenshot|transcript|output)|console\s+(?:output|log)|runtime\s+logs?|redacted\s+logs?|live\s+output|actual\s+output|observed\s+output|stdout|stderr|stack trace|trace excerpt|log excerpt|linked\s+artifacts?|artifact\s+links?)\b/i;
6161

6262
const liveCommandRegex =
6363
/\b(?:openclaw|node|docker|curl|gh|ssh|adb|xcrun|xcodebuild|open|npm\s+run|pnpm\s+openclaw)\b/i;

test/scripts/real-behavior-proof-policy.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ function proofBody(evidence: string, overrides: Record<string, string> = {}) {
4545
describe("real-behavior-proof-policy", () => {
4646
it.each([
4747
"![after](https://github.com/user-attachments/assets/abc123)",
48+
"Linked artifact: https://github.com/openclaw/openclaw/actions/runs/123456789/artifacts/987654321",
4849
"Redacted runtime log: gateway connected Discord channel and delivered the reply.",
4950
["Terminal transcript:", "```text", "$ openclaw gateway status", "discord ready", "```"].join(
5051
"\n",
@@ -90,6 +91,20 @@ describe("real-behavior-proof-policy", () => {
9091
expect(labelsForRealBehaviorProof(evaluation)).toEqual([MOCK_ONLY_PROOF_LABEL]);
9192
});
9293

94+
it("fails external PRs whose only copied output is a fenced test or CI transcript", () => {
95+
const evaluation = evaluateRealBehaviorProof({
96+
pullRequest: externalPr(
97+
proofBody(["```text", "$ pnpm test", "CI passed with Vitest mocks", "```"].join("\n"), {
98+
steps: "pnpm test",
99+
observedResult: "CI passes.",
100+
}),
101+
),
102+
});
103+
104+
expect(evaluation.status).toBe("mock_only");
105+
expect(labelsForRealBehaviorProof(evaluation)).toEqual([MOCK_ONLY_PROOF_LABEL]);
106+
});
107+
93108
it("passes maintainer, bot, and override cases", () => {
94109
expect(
95110
evaluateRealBehaviorProof({

0 commit comments

Comments
 (0)