Skip to content

Commit 8d30790

Browse files
authored
fix(ci): provision ripgrep for native grep tests (#132609)
Hosted reruns could execute the offline native-grep fixture on a runner without ripgrep, so otherwise-correct pull requests failed before the tested behavior ran. The CI planner now marks the exact shard that owns the real ripgrep fixture. That Linux job installs the package only when its runner image does not already provide it; every other shard keeps its existing setup path. Co-authored-by: Ayaan Zaidi <[email protected]>
1 parent f5eea31 commit 8d30790

3 files changed

Lines changed: 38 additions & 0 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,18 @@ jobs:
12521252
requires_go:
12531253
shard.shardName.startsWith("core-tooling") ||
12541254
shard.groups?.some((group) => group.shard_name.startsWith("core-tooling")),
1255+
requires_ripgrep:
1256+
shard.targets?.includes("src/agents/sessions/tools/index.test.ts") ||
1257+
shard.includePatterns?.includes("src/agents/sessions/tools/index.test.ts") ||
1258+
(shard.shardName === "agentic-agents-support" && !shard.includePatterns) ||
1259+
shard.groups?.some(
1260+
(group) =>
1261+
group.includePatterns?.includes(
1262+
"src/agents/sessions/tools/index.test.ts",
1263+
) ||
1264+
(group.shard_name === "agentic-agents-support" &&
1265+
!group.includePatterns),
1266+
),
12551267
}));
12561268
const nodeTestNonDistShards = nodeTestShards.filter((shard) => !shard.requires_dist);
12571269
const nodeTestDistShards = nodeTestShards.filter((shard) => shard.requires_dist);
@@ -2902,6 +2914,16 @@ jobs:
29022914
VITEST: "1"
29032915
run: pnpm build:ci-artifacts
29042916

2917+
- name: Install ripgrep for native grep tests
2918+
if: matrix.requires_ripgrep == true && runner.os == 'Linux'
2919+
shell: bash
2920+
run: |
2921+
if command -v rg >/dev/null 2>&1; then
2922+
exit 0
2923+
fi
2924+
sudo apt-get update -qq
2925+
sudo apt-get install -y --no-install-recommends ripgrep
2926+
29052927
- name: Run Node test shard
29062928
env:
29072929
NODE_OPTIONS: --max-old-space-size=8192

‎docs/ci.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,10 @@ Runner choice follows contributor trust, not whether a pull request came from a
347347
| `blacksmith-6vcpu-macos-15` | `macos-node` on `openclaw/openclaw`; untrusted authors fall back to `macos-15` |
348348
| `blacksmith-12vcpu-macos-26` | `macos-swift`, `ios-build`, and the two `ios-screenshot-shard` rows on `openclaw/openclaw`; untrusted authors fall back to `macos-26` |
349349

350+
The Node test planner marks only shards that run the real native grep fixture.
351+
Those Linux jobs install the `ripgrep` package when the selected runner image
352+
does not provide it. Other Node shards do not pay that setup cost.
353+
350354
### Runner backend modes
351355

352356
The `macos-swift` lane builds Swift tests once and runs each test once per job. The ordinary suite retains default-profile behavior; AppState isolation tests run in a separate named-profile process through the same resource-owning launcher. Each launch owns a private home and disposable, unlocked default Keychain until the test process group and output pipes close. HOME and profile markers do not isolate macOS services; both partitions run only on the disposable credentialless macOS worker. Automatic first attempts use parallel execution; manual dispatches and rerun attempts use serial execution. A failing test fails the job without an in-job retry. See [native test safety](/platforms/mac/dev-setup#run-native-tests-safely).

‎test/scripts/ci-workflow-guards.test.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8999,9 +8999,14 @@ printf '%s\n' "\${CURL_SUCCESS_IP:-203.0.113.7}"
89998999
const buildRuntimeStep = nodeTestJob.steps.find(
90009000
(step: WorkflowStep) => step.name === "Build Node test runtime",
90019001
);
9002+
const installRipgrepStep = nodeTestJob.steps.find(
9003+
(step: WorkflowStep) => step.name === "Install ripgrep for native grep tests",
9004+
);
90029005

90039006
expect(JSON.stringify(preflightJob.steps)).toContain("timeout_minutes: shard.timeoutMinutes");
90049007
expect(manifestStep.run).toContain("pretest_build_mode: shard.pretestBuildMode");
9008+
expect(manifestStep.run).toContain("requires_ripgrep:");
9009+
expect(manifestStep.run).toContain("src/agents/sessions/tools/index.test.ts");
90059010
expect(manifestStep.run).toContain(
90069011
'shard.groups?.some((group) => group.shard_name.startsWith("core-tooling"))',
90079012
);
@@ -9023,9 +9028,16 @@ printf '%s\n' "\${CURL_SUCCESS_IP:-203.0.113.7}"
90239028
},
90249029
run: "pnpm build:ci-artifacts",
90259030
});
9031+
expect(installRipgrepStep).toMatchObject({
9032+
if: "matrix.requires_ripgrep == true && runner.os == 'Linux'",
9033+
run: expect.stringContaining("apt-get install -y --no-install-recommends ripgrep"),
9034+
});
90269035
expect(nodeTestJob.steps.indexOf(buildRuntimeStep)).toBeLessThan(
90279036
nodeTestJob.steps.indexOf(runStep),
90289037
);
9038+
expect(nodeTestJob.steps.indexOf(installRipgrepStep)).toBeLessThan(
9039+
nodeTestJob.steps.indexOf(runStep),
9040+
);
90299041
const trustedRunnerStep = nodeTestJob.steps.find(
90309042
(step: WorkflowStep) => step.name === "Checkout trusted Node shard runner",
90319043
);

0 commit comments

Comments
 (0)