Skip to content

Commit 831e2de

Browse files
authored
fix(ci): support frozen target tooling (#127002)
1 parent bdbc581 commit 831e2de

2 files changed

Lines changed: 91 additions & 22 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 56 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,7 +1908,11 @@ jobs:
19081908
# A missing startup asset rebuild must finish before any verifier forks
19091909
# so concurrent readers never observe dist mid-write.
19101910
startup_assets=success
1911-
node --import tsx scripts/ensure-cli-startup-build.mts || startup_assets=failure
1911+
startup_builder=(node --import tsx scripts/ensure-cli-startup-build.mts)
1912+
if [[ ! -f scripts/ensure-cli-startup-build.mts ]]; then
1913+
startup_builder=(node scripts/ensure-cli-startup-build.mjs)
1914+
fi
1915+
"${startup_builder[@]}" || startup_assets=failure
19121916
19131917
# Hosted runners keep the remaining verifiers serial; Blacksmith
19141918
# overlaps them with the selected checks below.
@@ -3003,11 +3007,18 @@ jobs:
30033007
shell: bash
30043008
run: |
30053009
set -euo pipefail
3006-
fingerprint="$(node --import tsx scripts/prepare-extension-package-boundary-artifacts.mts --print-input-fingerprint)"
3007-
echo "fingerprint=$fingerprint" >> "$GITHUB_OUTPUT"
3010+
if [[ -f scripts/prepare-extension-package-boundary-artifacts.mts ]]; then
3011+
fingerprint="$(node --import tsx scripts/prepare-extension-package-boundary-artifacts.mts --print-input-fingerprint)"
3012+
echo "fingerprint=$fingerprint" >> "$GITHUB_OUTPUT"
3013+
echo "enabled=true" >> "$GITHUB_OUTPUT"
3014+
else
3015+
# Older targets build this boundary through their candidate-owned
3016+
# runner, but cannot produce the v2 cache fingerprint safely.
3017+
echo "enabled=false" >> "$GITHUB_OUTPUT"
3018+
fi
30083019
30093020
- name: Cache extension package boundary artifacts for hosted lint
3010-
if: needs.preflight.outputs.cache_mode != 'off' && matrix.task == 'lint' && (needs.preflight.outputs.runner_profile == 'github' || needs.preflight.outputs.runner_profile == 'hybrid')
3021+
if: needs.preflight.outputs.cache_mode != 'off' && matrix.task == 'lint' && steps.extension-boundary-inputs.outputs.enabled == 'true' && (needs.preflight.outputs.runner_profile == 'github' || needs.preflight.outputs.runner_profile == 'hybrid')
30113022
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
30123023
with:
30133024
path: |
@@ -3024,7 +3035,7 @@ jobs:
30243035
# the shared sticky. Strictly read-only (commit: false): only the
30253036
# protected boundary lane may publish this repository-global snapshot.
30263037
- name: Mount extension boundary sticky disk
3027-
if: matrix.task == 'lint' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'github' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'hybrid' && github.event_name != 'workflow_dispatch' && github.repository == 'openclaw/openclaw' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'openclaw/openclaw')
3038+
if: matrix.task == 'lint' && steps.extension-boundary-inputs.outputs.enabled == 'true' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'github' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'hybrid' && github.event_name != 'workflow_dispatch' && github.repository == 'openclaw/openclaw' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'openclaw/openclaw')
30283039
uses: useblacksmith/stickydisk@35ba2e331a80056a42af053ee54968511de2b7c7 # v1.5.0
30293040
with:
30303041
# One stable disk for the whole repository. The v1 per-PR/per-config
@@ -3037,7 +3048,7 @@ jobs:
30373048
commit: "false"
30383049

30393050
- name: Restore extension boundary artifacts from sticky disk
3040-
if: matrix.task == 'lint' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'github' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'hybrid' && github.event_name != 'workflow_dispatch' && github.repository == 'openclaw/openclaw' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'openclaw/openclaw')
3051+
if: matrix.task == 'lint' && steps.extension-boundary-inputs.outputs.enabled == 'true' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'github' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'hybrid' && github.event_name != 'workflow_dispatch' && github.repository == 'openclaw/openclaw' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'openclaw/openclaw')
30413052
shell: bash
30423053
run: |
30433054
set -euo pipefail
@@ -3178,7 +3189,11 @@ jobs:
31783189
lint_args=(--threads=1)
31793190
export GOMAXPROCS=2
31803191
fi
3181-
if [ "$RUN_CONTROL_UI_I18N" = "true" ] || [ "$RUN_UI_TESTS" = "true" ]; then
3192+
if [[ ! -f scripts/run-oxlint-shards.mts ]]; then
3193+
# The candidate's older shard runner owns all three source
3194+
# groups; do not split core stripes it cannot represent.
3195+
pnpm lint
3196+
elif [ "$RUN_CONTROL_UI_I18N" = "true" ] || [ "$RUN_UI_TESTS" = "true" ]; then
31823197
pnpm lint "${lint_args[@]}"
31833198
else
31843199
echo "[skip] changed scope cannot affect control-UI i18n catalogs"
@@ -3329,9 +3344,16 @@ jobs:
33293344
env:
33303345
GOMAXPROCS: "2"
33313346
OPENCLAW_LOCAL_CHECK: "0"
3332-
run: >-
3333-
node --import tsx scripts/run-oxlint-shards.mts
3334-
--only=core --split-core --core-stripe=${{ matrix.stripe }}/5 --threads=1
3347+
run: |
3348+
set -euo pipefail
3349+
# Older candidates run their complete lint set in check-lint; their
3350+
# runner predates core-stripe, so these five new-only jobs are redundant.
3351+
if [[ ! -f scripts/run-oxlint-shards.mts ]]; then
3352+
echo "[skip] target does not support core lint stripes"
3353+
exit 0
3354+
fi
3355+
node --import tsx scripts/run-oxlint-shards.mts \
3356+
--only=core --split-core --core-stripe=${{ matrix.stripe }}/5 --threads=1
33353357
33363358
# The github/hybrid planner profile stripes the 14 serial core test-type
33373359
# graphs (~34-42s per graph on either runner class; tsgo saturates a machine
@@ -3460,16 +3482,23 @@ jobs:
34603482
shell: bash
34613483
run: |
34623484
set -euo pipefail
3463-
fingerprint="$(node --import tsx scripts/prepare-extension-package-boundary-artifacts.mts --print-input-fingerprint)"
3464-
echo "fingerprint=$fingerprint" >> "$GITHUB_OUTPUT"
3485+
if [[ -f scripts/prepare-extension-package-boundary-artifacts.mts ]]; then
3486+
fingerprint="$(node --import tsx scripts/prepare-extension-package-boundary-artifacts.mts --print-input-fingerprint)"
3487+
echo "fingerprint=$fingerprint" >> "$GITHUB_OUTPUT"
3488+
echo "enabled=true" >> "$GITHUB_OUTPUT"
3489+
else
3490+
# Older targets build this boundary through their candidate-owned
3491+
# runner, but cannot produce the v2 cache fingerprint safely.
3492+
echo "enabled=false" >> "$GITHUB_OUTPUT"
3493+
fi
34653494
34663495
# Same-repo runs carry boundary artifacts on a Blacksmith sticky disk:
34673496
# the GitHub cache below is evicted so quickly under the repo quota that
34683497
# its prefix restore never hits, leaving every run to rebuild ~113s of
34693498
# plugin-sdk declarations. Fork PRs must never produce writable
34703499
# repository-global snapshots, so they keep the GitHub cache path.
34713500
- name: Mount extension boundary sticky disk
3472-
if: matrix.group == 'extension-package-boundary' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'github' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'hybrid' && github.event_name != 'workflow_dispatch' && github.repository == 'openclaw/openclaw' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'openclaw/openclaw')
3501+
if: matrix.group == 'extension-package-boundary' && steps.extension-boundary-inputs.outputs.enabled == 'true' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'github' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'hybrid' && github.event_name != 'workflow_dispatch' && github.repository == 'openclaw/openclaw' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'openclaw/openclaw')
34733502
uses: useblacksmith/stickydisk@35ba2e331a80056a42af053ee54968511de2b7c7 # v1.5.0
34743503
with:
34753504
# One stable disk for the whole repository. The v1 per-PR/per-config
@@ -3490,7 +3519,7 @@ jobs:
34903519

34913520
- name: Restore extension boundary artifacts from sticky disk
34923521
id: boundary-sticky-restore
3493-
if: matrix.group == 'extension-package-boundary' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'github' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'hybrid' && github.event_name != 'workflow_dispatch' && github.repository == 'openclaw/openclaw' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'openclaw/openclaw')
3522+
if: matrix.group == 'extension-package-boundary' && steps.extension-boundary-inputs.outputs.enabled == 'true' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'github' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'hybrid' && github.event_name != 'workflow_dispatch' && github.repository == 'openclaw/openclaw' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'openclaw/openclaw')
34943523
shell: bash
34953524
run: |
34963525
set -euo pipefail
@@ -3519,7 +3548,7 @@ jobs:
35193548
35203549
- name: Cache extension package boundary artifacts
35213550
id: extension-package-boundary-cache
3522-
if: needs.preflight.outputs.cache_mode != 'off' && matrix.group == 'extension-package-boundary'
3551+
if: needs.preflight.outputs.cache_mode != 'off' && matrix.group == 'extension-package-boundary' && steps.extension-boundary-inputs.outputs.enabled == 'true'
35233552
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
35243553
with:
35253554
path: |
@@ -3532,7 +3561,7 @@ jobs:
35323561
${{ runner.os }}-extension-package-boundary-v2-
35333562
35343563
- name: Preserve extension package boundary cache hit
3535-
if: matrix.group == 'extension-package-boundary' && steps.extension-package-boundary-cache.outputs.cache-hit == 'true'
3564+
if: matrix.group == 'extension-package-boundary' && steps.extension-boundary-inputs.outputs.enabled == 'true' && steps.extension-package-boundary-cache.outputs.cache-hit == 'true'
35363565
shell: bash
35373566
run: |
35383567
set -euo pipefail
@@ -3692,7 +3721,7 @@ jobs:
36923721
# clone). Seed the payload before the sticky post-action flushes.
36933722
# rsync -aR mirrors the repo-relative layout the restore step replays.
36943723
- name: Seed extension boundary sticky disk
3695-
if: success() && steps.boundary-sticky-restore.outputs.restored == 'false' && matrix.group == 'extension-package-boundary' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'github' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'hybrid' && github.event_name != 'workflow_dispatch' && github.event_name != 'pull_request' && github.repository == 'openclaw/openclaw'
3724+
if: success() && steps.extension-boundary-inputs.outputs.enabled == 'true' && steps.boundary-sticky-restore.outputs.restored == 'false' && matrix.group == 'extension-package-boundary' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'github' && vars.OPENCLAW_CI_RUNNER_BACKEND != 'hybrid' && github.event_name != 'workflow_dispatch' && github.event_name != 'pull_request' && github.repository == 'openclaw/openclaw'
36963725
shell: bash
36973726
run: |
36983727
set -euo pipefail
@@ -3935,10 +3964,18 @@ jobs:
39353964
# Linux owns the full repo test suite. Keep the Windows runner focused on
39363965
# Windows-native process/path wrappers so platform regressions fail fast.
39373966
test-1)
3938-
pnpm test:windows:ci:1
3967+
if node -e 'process.exit(require("./package.json").scripts?.["test:windows:ci:1"] ? 0 : 1)'; then
3968+
pnpm test:windows:ci:1
3969+
else
3970+
pnpm test:windows:ci
3971+
fi
39393972
;;
39403973
test-2)
3941-
pnpm test:windows:ci:2
3974+
if node -e 'process.exit(require("./package.json").scripts?.["test:windows:ci:2"] ? 0 : 1)'; then
3975+
pnpm test:windows:ci:2
3976+
else
3977+
echo "[skip] target's combined Windows suite ran in test-1"
3978+
fi
39423979
;;
39433980
*)
39443981
echo "Unsupported Windows checks task: $TASK" >&2

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

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3192,8 +3192,10 @@ NODE
31923192
label,
31933193
).toEqual(expectedWindowsMatrix);
31943194
}
3195-
expect(runStep.run).toContain("test-1)\n pnpm test:windows:ci:1");
3196-
expect(runStep.run).toContain("test-2)\n pnpm test:windows:ci:2");
3195+
expect(runStep.run).toContain('scripts?.["test:windows:ci:1"]');
3196+
expect(runStep.run).toContain('scripts?.["test:windows:ci:2"]');
3197+
expect(runStep.run).toContain("pnpm test:windows:ci");
3198+
expect(runStep.run).toContain("target's combined Windows suite ran in test-1");
31973199
expect(runStep.run).not.toContain("pnpm test:windows:ci:3");
31983200
});
31993201

@@ -5312,7 +5314,10 @@ server.listen(0, "127.0.0.1", () => {
53125314
expect(gate.if).toContain("vars.OPENCLAW_CI_RUNNER_BACKEND != 'github'");
53135315
}
53145316
expect(hostedLintCache.if).toBe(
5315-
"needs.preflight.outputs.cache_mode != 'off' && matrix.task == 'lint' && (needs.preflight.outputs.runner_profile == 'github' || needs.preflight.outputs.runner_profile == 'hybrid')",
5317+
"needs.preflight.outputs.cache_mode != 'off' && matrix.task == 'lint' && steps.extension-boundary-inputs.outputs.enabled == 'true' && (needs.preflight.outputs.runner_profile == 'github' || needs.preflight.outputs.runner_profile == 'hybrid')",
5318+
);
5319+
expect(boundaryCache.if).toBe(
5320+
"needs.preflight.outputs.cache_mode != 'off' && matrix.group == 'extension-package-boundary' && steps.extension-boundary-inputs.outputs.enabled == 'true'",
53165321
);
53175322
expect(hostedLintCache.uses).toBe(CACHE_V5);
53185323
expect(hostedLintCache.with).toEqual(boundaryCache.with);
@@ -5333,6 +5338,7 @@ server.listen(0, "127.0.0.1", () => {
53335338
expect(step.run).toContain(
53345339
"scripts/prepare-extension-package-boundary-artifacts.mts --print-input-fingerprint",
53355340
);
5341+
expect(step.run).toContain('echo "enabled=false" >> "$GITHUB_OUTPUT"');
53365342
}
53375343
expect(fingerprintSteps[0]?.run).toBe(fingerprintSteps[1]?.run);
53385344
// Single semantic writer: protected pushes commit explicitly (not
@@ -9075,6 +9081,12 @@ printf '%s\n' "\${CURL_SUCCESS_IP:-203.0.113.7}"
90759081

90769082
expect(buildChecks.run).toContain("pnpm test:gateway:watch-regression -- --skip-build");
90779083
expect(buildChecks.run).not.toContain("scripts/check-gateway-watch-regression.mts");
9084+
expect(buildChecks.run).toContain(
9085+
"startup_builder=(node --import tsx scripts/ensure-cli-startup-build.mts)",
9086+
);
9087+
expect(buildChecks.run).toContain(
9088+
"startup_builder=(node scripts/ensure-cli-startup-build.mjs)",
9089+
);
90789090
expect(qaBuild.run.match(/pnpm build qaRuntime/gu)).toHaveLength(1);
90799091
expect(qaBuild.run).not.toContain("package-openclaw-for-docker");
90809092
expect(additionalChecks.run).toContain(
@@ -9089,6 +9101,26 @@ printf '%s\n' "\${CURL_SUCCESS_IP:-203.0.113.7}"
90899101
expect(additionalChecks.run).not.toContain(
90909102
"if [ ! -f scripts/check-session-transcript-reader-boundary.mts ]",
90919103
);
9104+
const checkLint = workflow.jobs["check-shard"].steps.find(
9105+
(step: WorkflowStep) => step.name === "Run check shard",
9106+
);
9107+
const hostedCoreLint = workflow.jobs["check-lint-hosted-core-shard"].steps.find(
9108+
(step: WorkflowStep) => step.name === "Run hosted core lint stripe",
9109+
);
9110+
const lintBoundaryFingerprint = workflow.jobs["check-shard"].steps.find(
9111+
(step: WorkflowStep) => step.name === "Compute extension boundary input fingerprint",
9112+
);
9113+
const additionalBoundaryFingerprint = workflow.jobs["check-additional-shard"].steps.find(
9114+
(step: WorkflowStep) => step.name === "Compute extension boundary input fingerprint",
9115+
);
9116+
9117+
// The frozen candidate owns the older full lint and boundary builders;
9118+
// current-only stripe and cache mechanics must not replace that coverage.
9119+
expect(checkLint.run).toContain("if [[ ! -f scripts/run-oxlint-shards.mts ]]; then");
9120+
expect(checkLint.run).toContain("pnpm lint");
9121+
expect(hostedCoreLint.run).toContain("target does not support core lint stripes");
9122+
expect(lintBoundaryFingerprint.run).toContain("enabled=false");
9123+
expect(additionalBoundaryFingerprint.run).toContain("enabled=false");
90929124
});
90939125

90949126
it("emits one final CI gate after every selected lane", () => {

0 commit comments

Comments
 (0)