-
Notifications
You must be signed in to change notification settings - Fork 3k
fix(triage): compute the flake-gate diff before the env -i re-exec #9468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ee88e98
439a3ef
a537386
b386b92
b46aba5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1014,14 +1014,52 @@ describe('qwen-triage: flakiness gate (#9125)', () => { | |||||
| // executes, so it is a changed test file exactly like M. | ||||||
| assert.match( | ||||||
| recordStep.run, | ||||||
| /^\s*git -c core\.quotePath=false diff -z --name-only --diff-filter=ACMRT "\$BASE_OID" HEAD \\\n\s*> "\$GATE_HOME\/files-all"$/m, | ||||||
| /^\s*\/usr\/bin\/git -c core\.quotePath=false diff -z --name-only --diff-filter=ACMRT "\$BASE_OID" HEAD \\\n\s*> "\$\{RUNNER_TEMP:\?\}\/flake-record-files-all"$/m, | ||||||
| 'the NUL diff must flow straight into its file — $( ) strips NUL bytes, a pipeline swallows the exit status', | ||||||
| ); | ||||||
| assert.match( | ||||||
| recordStep.run, | ||||||
| /^\s*BASE_OID="\$\(cat "\$\{RUNNER_TEMP:\?\}\/verify-base-oid"\)"$/m, | ||||||
| /^\s*rm -rf -- "\$\{RUNNER_TEMP:\?\}\/flake-record-files-all"\n\s*\/usr\/bin\/git -c core\.quotePath=false diff -z/m, | ||||||
| 'the staging path must be unlinked immediately before the redirect — a planted symlink or directory there makes root write through it or hard-fail the record step', | ||||||
| ); | ||||||
| assert.match( | ||||||
| recordStep.run, | ||||||
| /^\s*BASE_OID="\$\(\/usr\/bin\/cat "\$\{RUNNER_TEMP:\?\}\/verify-base-oid"\)"$/m, | ||||||
|
yiliang114 marked this conversation as resolved.
|
||||||
| 'the record step must diff against the base OID captured while .git was root-owned, not re-resolve HEAD^1', | ||||||
| ); | ||||||
| assert.match( | ||||||
| recordStep.run, | ||||||
| /^\s*case "\$BASE_OID" in$/m, | ||||||
| 'the base OID must be shape-validated in the parent arm before the diff', | ||||||
| ); | ||||||
| assert.match( | ||||||
| recordStep.run, | ||||||
| /^\s*\[0-9a-f\]\[0-9a-f\]\[0-9a-f\]\[0-9a-f\]\[0-9a-f\]\[0-9a-f\]\[0-9a-f\]\[0-9a-f\]\*\) ;;/m, | ||||||
| 'the base OID shape must be an 8+-hex prefix — a planted valid OID would yield an empty diff and starve the gate into n/a', | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] The pins added for R2-3 cover the assert.match(
recordStep.run,
/^\s*\*\) \/usr\/bin\/printf '::error::No trusted base OID recorded; refusing to record the flakiness-gate file list\.\\n'; exit 1 ;;$/m,
'a malformed or planted base OID must refuse the record, never fall through into the diff',
);中文说明为 R2-3 新增的 pin 覆盖了 — qwen3.8-max via Qwen Code /review (v0.21.14) |
||||||
| ); | ||||||
| assert.match( | ||||||
| recordStep.run, | ||||||
| /^\s*cp "\$\{RUNNER_TEMP:\?\}\/flake-record-files-all" "\$GATE_HOME\/files-all"$/m, | ||||||
| 'the scrubbed child must copy the parent-recorded diff, never re-run git under env -i', | ||||||
| ); | ||||||
|
yiliang114 marked this conversation as resolved.
|
||||||
| const recordDiffAt = recordStep.run.search(/^\s*\/usr\/bin\/git -c core\.quotePath=false diff -z/m); | ||||||
|
yiliang114 marked this conversation as resolved.
|
||||||
| const recordReExecAt = recordStep.run.search(/exec \/usr\/bin\/env -i/); | ||||||
| const recordCpAt = recordStep.run.search(/^\s*cp "\$\{RUNNER_TEMP:\?\}\/flake-record-files-all" "\$GATE_HOME\/files-all"$/m); | ||||||
|
yiliang114 marked this conversation as resolved.
|
||||||
| const recordInstallAt = recordStep.run.search(/^\s*install -d -m 0700 -o root -g root "\$GATE_HOME"$/m); | ||||||
| assert.ok( | ||||||
| recordDiffAt !== -1 && recordReExecAt !== -1 && recordCpAt !== -1 && recordInstallAt !== -1 && | ||||||
| recordDiffAt < recordReExecAt && recordReExecAt < recordInstallAt && recordInstallAt < recordCpAt, | ||||||
| 'the diff must be recorded in the parent arm before the env -i re-exec, and copied into the recreated root-only home', | ||||||
| ); | ||||||
| // The scrubbed child must never re-run git under env -i: the ordering | ||||||
| // pin uses first-match semantics, so it cannot by itself forbid a | ||||||
| // second git in the child. Strip comments first (the child's own docs | ||||||
| // name `git diff` when describing what NOT to do) before asserting. | ||||||
| assert.doesNotMatch( | ||||||
| recordStep.run.slice(recordReExecAt).replace(/^\s*#.*$/gm, '').replace(/\\\n/g, ' '), | ||||||
| /\bgit\b[^\n]*\b(diff|log|show|whatchanged)\b/, | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] The new no-git-in-child assertion hand-enumerates four git subcommands (
Suggested change
中文说明新的“子进程禁止运行 git”断言只手工枚举了 4 个 git 子命令( — qwen3.8-max via Qwen Code /review (v0.21.14) |
||||||
| 'the scrubbed child must never re-run git under env -i — that is the failure shape of run 32227155960', | ||||||
| ); | ||||||
| assert.ok( | ||||||
| recordStep.run.includes( | ||||||
| "grep -zE '\\.(test|spec)\\.(ts|tsx|js|jsx|mjs|cjs|mts|cts)$'", | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.