import { execFileSync } from "node:child_process"; import { appendFileSync, lstatSync, readFileSync, writeFileSync } from "node:fs"; import { join, posix, resolve } from "node:path"; import { requireOptionArgument } from "./lib/arg-utils.runtime.mjs"; import { getChangedPathFacts } from "./lib/changed-path-facts.mjs"; import { NATIVE_COOWNED_GENERATED_I18N_RE, NATIVE_HARD_GENERATED_I18N_RE, } from "./lib/ci-native-generated-scope.mjs"; import { isDirectRunUrl } from "./lib/direct-run.mjs"; import { ensureGitCommit, resolveMergeHeadDiffBase } from "./lib/merge-head-diff-base.mjs"; import nativeProtocolInputs from "./native-protocol-inputs.json" with { type: "json" }; /** @typedef {{ runNode: boolean; runMacos: boolean; runMacosNode: boolean; runIosBuild: boolean; runAndroid: boolean; runWindows: boolean; runSkillsPython: boolean; runControlUiI18n: boolean; runUiTests: boolean }} ChangedScope */ /** @typedef {{ runFastOnly: boolean; runPluginContracts: boolean; runCiRouting: boolean }} NodeFastScope */ const CHANGED_PATHS_OUTPUT_MAX_BYTES = 64 * 1024; /** @param {string} changedPath */ export function isCiDocumentationPath(changedPath) { if ( /(?:^|\/)(?:test|tests|__tests__|fixture|fixtures|__fixtures__|test-fixtures|templates)\//u.test( changedPath, ) ) { return false; } const instruction = /(?:^|\/)AGENTS\.md$/u.test(changedPath) || /^\.agents\/skills\/.+\.md$/u.test(changedPath) || /^skills\/[^/]+\/SKILL\.md$/u.test(changedPath); return ( /(?:^|\/)README\.mdx?$/u.test(changedPath) || instruction || changedPath.startsWith("docs/") ); } /** * Catalog data skips PR Node rows; generator/runtime code keeps its test owners. * @param {string} changedPath */ export function isNodeTestDataOnlyPath(changedPath) { return ( isCiDocumentationPath(changedPath) || /^(?:ui\/src\/i18n\/(?:locales\/[^/]+\.ts|\.i18n\/[^/]+\.(?:json|jsonl))$|src\/wizard\/i18n\/locales\/[^/]+\.ts$|apps\/\.i18n\/native\/[^/]+\.json$)/u.test( changedPath, ) ); } const GLOBAL_NODE_TEST_INPUT_RE = /^(?:pnpm-workspace\.yaml|\.npmrc|node-version\.mjs|tsconfig(?:\.[^/]+)?\.json|vitest\.config\.ts|test\/setup(?:\.shared|\.extensions|-openclaw-runtime)?\.ts|test\/vitest\/vitest\.(?:shared\.config|scoped-config|performance-config)\.ts|scripts\/run-vitest\.(?:mjs|mts)|scripts\/test-projects\.mts|scripts\/lib\/vitest-(?:process-env|node-args)\.mts|\.github\/actions\/(?:setup-node-env|setup-pnpm-store-cache)\/action\.yml)$|^patches\//u; /** @param {string} changedPath @param {string} cwd */ export function isIndependentlyCheckedDocumentation(changedPath, cwd) { if ( changedPath !== changedPath.trim() || posix.normalize(changedPath) !== changedPath || !isNodeTestDataOnlyPath(changedPath) ) { return false; } // Docs/instruction routing owns these pages; packaged templates retain runtime proof. // Missing pages are deletions, but symlinks (including dangling ones) are not pages. const entry = lstatSync(join(cwd, changedPath), { throwIfNoEntry: false }); return entry === undefined || entry.isFile(); } /** * @param {readonly string[] | null} changedPaths * @param {{ cwd?: string }} [options] * @returns {{ eligible: true } | { eligible: false; reason: string }} */ export function resolveReleaseFastLaneScope(changedPaths, options = {}) { if (!changedPaths?.length) { return { eligible: false, reason: "missing changed paths" }; } const globalInput = changedPaths.find((file) => GLOBAL_NODE_TEST_INPUT_RE.test(file)); if (globalInput) { return { eligible: false, reason: `global execution or resolution input: ${globalInput}` }; } const cwd = options.cwd ?? process.cwd(); const outsideScope = changedPaths.find( (file) => !file.startsWith(".github/workflows/") && !file.startsWith("scripts/") && !file.startsWith("test/scripts/") && !/^\.agents\/skills\/release-[^/]+\//u.test(file) && file !== "docs/reference/RELEASING.md" && !isIndependentlyCheckedDocumentation(file, cwd), ); return outsideScope === undefined ? { eligible: true } : { eligible: false, reason: `outside the release tooling scope: ${outsideScope}` }; } /** @type {ChangedScope} */ const FULL_SCOPE = { runNode: true, runMacos: true, runMacosNode: true, runIosBuild: true, runAndroid: true, runWindows: true, runSkillsPython: true, runControlUiI18n: true, runUiTests: true, }; /** @type {ChangedScope} */ const EMPTY_SCOPE = { runNode: false, runMacos: false, runMacosNode: false, runIosBuild: false, runAndroid: false, runWindows: false, runSkillsPython: false, runControlUiI18n: false, runUiTests: false, }; // Skills native subscriptions need real filesystem proof on both desktop OSes. const SKILLS_WATCH_SCOPE_RE = /^src\/skills\/runtime\/refresh(?:[.-][^/]+)?\.ts$/; const SKILLS_PYTHON_SCOPE_RE = /^(skills\/|skills\/pyproject\.toml$)/; const NATIVE_PROTOCOL_GEN_RE = /^apps\/shared\/OpenClawKit\/Sources\/OpenClawProtocol\//; const APPLE_SWIFT_CONFIG_RE = /^config\/(?:swiftformat|swiftlint\.yml)$/; const SWIFT_LINT_OWNER_RE = /^scripts\/(?:run-swiftlint|lib\/check-limits)\.mts$/; const APPLE_SHARED_CONTRACT_FIXTURE_RE = /^test\/fixtures\/talk-config-contract\.json$/; const MACOS_NATIVE_RE = /^(apps\/macos\/|apps\/macos-mlx-tts\/|apps\/shared\/|apps\/swabble\/|Swabble\/)/; const GIT_OWNER_SCOPE_RE = /^(?:\.github\/(?:actions\/(?:git-owner|ensure-base-commit|publish-generated-pr|mantis-validate-trusted-ref)\/|workflows\/(?:workflow-sanity|qa-profile-evidence|maturity-scorecard|docs-agent|docs-sync-publish|openclaw-performance|linux-app-release|macos-release|npm-placeholder-bootstrap|plugin-clawhub-release|plugin-npm-release|mantis-(?:discord-(?:smoke|status-reactions|thread-attachment)|slack-desktop-smoke|web-ui-chat-proof))\.yml$)|scripts\/generate-ci-git-owner\.mts$|test\/scripts\/(?:ci-(?:checkout|git-owner|linux-git|platform-checkout|windows-process-census)\.test(?:-support)?\.ts|generated-publisher\.test-support\.ts|openclaw-performance-(?:workflow\.test(?:-support)?|git-lifecycle\.test)\.ts|plugin-release-git-lifecycle\.test\.ts|release-workflow-git-lifecycle\.test\.ts|fixtures\/(?:ci-platform-checkout\.mjs|ci-windows-process-census\.(?:mjs|py)))$)/; const MACOS_SCRIPT_SCOPE_RE = /^(?:scripts\/(?:build-and-run-mac|check-swift-tools|codesign-mac-app|create-dmg|format-swift|install-swift-tools|install-xcodegen|lint-swift|mac-elevation-host|notarize-mac-artifact|package-mac-app|package-mac-dist|prepush-ci|restart-mac|stage-cua-driver-macos|stage-mac-runtime|stage-openclaw-bun|build-mac-sqlite)\.sh|scripts\/lib\/(?:openclaw-bun|sqlite-macos)\.json|scripts\/test-macos-native\.mts|scripts\/lib\/macos-mlx-settings-(?:manifest|producer)\.mts|test\/scripts\/macos-mlx-settings-producer\.test\.ts|scripts\/(?:verify-mac-runtime(?:-fs)?|lib\/(?:mac-node-worker-proof-state|mac-runtime-portability|desktop-runtime-prune))\.mjs|scripts\/(?:materialize-mac-runtime|swift-build-cache-metadata|lib\/(?:mac-native-inventory|mac-bundle-mutation))\.py|scripts\/lib\/(?:mac-app-bundle|mac-signing-identity|plistbuddy|swift-toolchain)\.sh|test\/helpers\/mac-(?:native|signing)\.ts|test\/scripts\/(?:build-mac-sqlite|stage-openclaw-bun|codesign-mac-app|create-dmg|mac-elevation-artifact|mac-elevation-host|mac-runtime|macos-native-test-launch|notarize-mac-artifact|package-mac-app|package-mac-dist|restart-mac|swift-build-cache-metadata|verify-mac-runtime-fs)\.test\.ts|test\/scripts\/(?:mac-elevation-artifact|mac-native-fixtures|mac-runtime-materialization)\.test-support\.ts)$/; const WORKER_DEPLOY_ARTIFACT_SCOPE_RE = /^src\/(?:agents\/github-exec-(?:launcher|credential)\.ts|shared\/worker-bundle-hash\.ts|worker\/workspace-rsync-receiver\.ts|gateway\/worker-environments\/workspace-(?:accepted-(?:remote-script|sync)|mutation-remote-script|rsync-path\.test|sync(?:-helpers)?)\.ts)$/; const IOS_BUILD_RE = /^(apps\/ios\/|apps\/shared\/|apps\/swabble\/|Swabble\/|scripts\/(?:check-swift-tools|format-swift|install-simslim|install-swift-tools|install-xcodegen|lint-swift)\.sh$|scripts\/(?:ios-(?:configure-signing|screenshots|simulator-prepare|team-id|write-version-xcconfig)\.sh|ios-screenshot-evidence\.(?:mjs|d\.mts)|ios-write-swift-filelist\.m[jt]s|ios-version\.ts)$|scripts\/lib\/(?:(?:ios-fastlane|swift-toolchain)\.sh|(?:ios|mobile)-version\.ts|ios-test-results\.(?:mjs|d\.mts)|release-version\.mjs|version-script-args\.ts)$)/; // Tests and WatchTests Swift sources belong only to retained native unit-test targets. // UITests, resources, and project changes still prove the screenshot target graph. const IOS_SCREENSHOT_APP_SCOPE_RE = /^(?:apps\/ios\/(?!(?:Tests|WatchTests)\/.*\.swift$)|apps\/shared\/OpenClawKit\/|apps\/swabble\/|Swabble\/)/; const IOS_SCREENSHOT_SCRIPT_SCOPE_RE = /^scripts\/(?:check-swift-tools|format-swift|install-simslim|install-swift-tools|install-xcodegen|lint-swift)\.sh$|^scripts\/(?:ios-(?:configure-signing|screenshots|simulator-prepare|team-id|write-version-xcconfig)\.sh|ios-screenshot-evidence\.(?:mjs|d\.mts)|ios-write-swift-filelist\.m[jt]s|ios-version\.ts)$|^scripts\/lib\/(?:(?:ios-fastlane|swift-toolchain)\.sh|(?:ios|mobile)-version\.ts|ios-test-results\.(?:mjs|d\.mts)|release-version\.mjs|version-script-args\.ts)$/; const ANDROID_NATIVE_RE = /^(apps\/android\/|apps\/shared\/|\.github\/actions\/setup-android-toolchain\/)/; // JVM tests and benchmark-only changes do not enter the store capture graph. const ANDROID_SCREENSHOT_APP_SCOPE_RE = /^apps\/android\/(?!(?:[^/]+\/src\/(?:test[^/]*|androidTest[^/]*)\/|benchmark\/|fastlane\/metadata\/))/; const ANDROID_SCREENSHOT_SCRIPT_SCOPE_RE = /^scripts\/(?:android-(?:screenshots\.sh|sips-linux\.sh|app-i18n\.ts|version\.ts|sync-versioning\.ts|pin-version\.ts)|native-(?:i18n-inventory|i18n-locales)\.ts|lib\/(?:android|mobile)-version\.ts|lib\/(?:canonical-json|direct-run)\.mjs)$/; // Native bundling owns Mermaid assets and their shared coercion dependency. const MERMAID_ASSET_INPUT_RE = /^packages\/(?:mermaid-renderer\/|normalization-core\/(?:package\.json|src\/record-coerce\.ts)$)/; const ANDROID_TALK_CONTRACT_FIXTURE_RE = /^test\/fixtures\/talk-(?:config|realtime-relay)-contract\.json$/; const NODE_SCOPE_RE = /^(src\/|test\/|extensions\/|packages\/|scripts\/|ui\/|\.github\/|openclaw\.mjs$|package\.json$|pnpm-lock\.yaml$|pnpm-workspace\.yaml$|tsconfig.*\.json$|vitest.*\.ts$|tsdown\.config\.ts$|\.oxlintrc\.json$|\.oxfmtrc\.jsonc$)/; // Packaged workspace templates ship with the runtime, so they keep Node lanes. const WORKSPACE_TEMPLATE_SCOPE_RE = /^docs\/reference\/templates\//u; const WINDOWS_SQLITE_SCOPE_RE = /^src\/(?:state\/|.*sqlite.*\.ts$)/; // Windows process-start identity: the owner, the Windows probe it falls back to, // and every consumer that admits or recovers work from that identity. The // real-host proof for this contract only runs on the Windows lane, so a change // to any of them that skipped the lane would merge a Windows regression unseen. // Not gated on isTestOnly: the proof itself is a test file and must route here. const WINDOWS_PROCESS_IDENTITY_SCOPE_RE = /^src\/(?:shared\/pid-alive(?:\.[a-z-]+)?(?:\.test)?\.ts|infra\/(?:windows-process-start|gateway-lock)(?:\.test)?\.ts|node-host\/node-worker-process-identity(?:\.test)?\.ts|cron\/store\/run-receipt-store(?:\.test)?\.ts)$/; const WINDOWS_FILE_URL_SCOPE_RE = /^(?:src\/agents\/tools\/(?:media-tool-file-url\.windows\.test|media-tool-shared(?:\.test)?|pdf-tool(?:\.test)?)|src\/auto-reply\/(?:reply\/stage-sandbox-media|reply\.triggers\.trigger-handling\.stages-inbound-media-into-sandbox-workspace\.test)|src\/media\/(?:local-media-path(?:\.windows\.test)?|local-roots(?:\.test)?|web-media(?:\.file-url\.windows\.test)?)|src\/channels\/inbound-event\/media(?:\.test)?|src\/gateway\/managed-image-attachments(?:\.test)?|extensions\/msteams\/src\/(?:media-helpers|messenger)(?:\.test)?)\.ts$/; const WINDOWS_SCOPE_RE = /^(src\/cli\/completion-runtime\.ts$|extensions\/canvas\/scripts\/pnpm-runner\.(?:mjs|test\.ts)$|extensions\/mxc\/|src\/agents\/bash-tools\.exec\.script-preflight\.test\.ts$|src\/config\/sessions\/(?:session-accessor\.sqlite-archive(?:\.worker(?:\.test)?)?|store\.session-lifecycle-mutation\.test)\.ts$|src\/process\/|src\/infra\/(?:(?:exec-allowlist-pattern|fs-safe-remove)(?:\.windows)?(?:\.test)?|ports(?:-inspect|\.test)|ssh-client(?:\.windows\.test)?|update-managed-service-handoff(?:-(?:command|lifecycle)\.test)?|windows-install-roots)\.ts$|src\/shared\/(?:import-specifier|runtime-import)(?:\.test)?\.ts$|src\/test-utils\/openclaw-test-state(?:\.test)?\.ts$|scripts\/(?:android-(?:app-i18n|pin-version)\.ts|(?:check-deadcode-unused-files|deadcode-knip-runner)\.mts|ci-run-timings\.mjs|e2e\/lib\/package-compat\.mjs|generate-bundled-channel-config-metadata\.ts|(?:install|windows-testbox-openssh)\.ps1|openclaw-cross-os-release-checks\.ts|plan-release-workflow-matrix\.mjs|run-additional-boundary-checks\.mts|verify-docker-attestations\.mjs|github\/run-openclaw-cross-os-release-checks\.sh|tsx\.mjs|(?:npm-runner|pnpm-runner|ui|vitest-process-group)\.(?:mjs|mts|js)|lib\/(?:direct-run\.(?:mjs|mts)|format-generated-module\.mts|tsx-cli-shim\.mjs|cross-os-release-checks\/[^/]+\.ts))$|test\/scripts\/(?:direct-run-entrypoints|format-generated-module|install-ps1|npm-runner|openclaw-cross-os-release-workflow|pnpm-runner|ui|vitest-process-group)\.test\.ts$|\.github\/workflows\/(?:ci|openclaw-cross-os-release-checks-reusable|windows-testbox-probe|windows-blacksmith-testbox)\.yml$|\.github\/actions\/setup-node-env\/action\.yml$|\.github\/actions\/setup-pnpm-store-cache\/action\.yml$)/; const WINDOWS_LAN_ADVERTISEMENT_SCOPE_RE = /^src\/infra\/advertised-lan-host(?:\.windows)?(?:\.test)?\.ts$/; const WINDOWS_SECRETREF_SCOPE_RE = /^(?:src\/commands\/doctor-gateway-auth-token(?:\.windows\.test)?\.ts|src\/flows\/(?:doctor-core-checks|doctor-health-contributions)\.ts|src\/gateway\/(?:auth-token-resolution|resolve-configured-secret-input-string)\.ts|src\/infra\/(?:boundary-file-read|fs-safe)\.ts|src\/secrets\/(?:resolve|resolve-errors)\.ts|src\/security\/audit-fs\.ts)$/; const WINDOWS_DAEMON_SCOPE_RE = /^src\/daemon\/(?:schtasks(?:[-.][^/]+)?|runtime-hints\.windows-paths(?:\.test)?|test-helpers\/schtasks-(?:base-mocks|fixtures))\.ts$/; const WINDOWS_USAGE_TEMPLATE_SCOPE_RE = /^src\/auto-reply\/usage-bar\/template(?:\.windows\.test)?\.ts$/; const WINDOWS_MEDIA_UNDERSTANDING_FILE_URL_SCOPE_RE = /^src\/media-understanding\/attachments\.(?:cache(?:\.test)?|file-url\.windows\.test|normalize(?:\.test)?)\.ts$/; const WINDOWS_HOME_DISPLAY_SCOPE_RE = /^(?:src\/(?:utils(?:\.test)?|infra\/(?:home-display|path-guards)|commands\/agents\.commands\.list(?:\.test)?|cli\/daemon-cli\/status\.print(?:\.test)?|agents\/(?:sandbox\/fs-paths(?:\.test)?|sessions\/tools\/(?:read|render-utils\.test)))|packages\/terminal-core\/src\/display-string(?:\.test)?)\.ts$/; const WINDOWS_CHILD_ENV_SCOPE_RE = /^src\/(?:agents\/provider-local-service(?:-process|\.(?:env-case|shutdown|settlement)\.test)?|cli\/mcp-cli(?:\.path-case\.windows)?\.test|cli\/mcp-cli|infra\/process-env(?:\.test)?)\.ts$/; const WINDOWS_SOURCE_CLI_SCOPE_RE = /^src\/infra\/openclaw-cli-(?:invocation(?:\.test(?:-support)?)?|shim(?:\.(?:windows\.)?test)?)\.ts$/; // The helper is test-only, but its command and receipt owners need native process proof. const WINDOWS_TEST_INSTANCE_SCOPE_RE = /^(?:test\/helpers\/openclaw-test-instance(?:\.test)?\.ts|test\/helpers\/openclaw-test-instance\.cli\.test-support\.mjs|scripts\/lib\/(?:managed-child-process|vitest-resource-ownership)\.mts)$/; const WINDOWS_NODE_HOST_EXECUTABLE_SCOPE_RE = /^(?:src\/plugin-sdk\/node-host(?:\.test)?|src\/tui\/(?:tui|tui\.resolve-codex-bin\.test))\.ts$/; const WINDOWS_AGENT_HOME_PATH_SCOPE_RE = /^src\/(?:infra\/home-dir(?:\.test)?|agents\/(?:agent-tools\.read(?:\.host-operations|\.windows)?\.test|agent-tools\.read|sessions\/tools\/path-utils(?:\.test)?))\.ts$/; const WINDOWS_MEMORY_EXTRA_FILE_SCOPE_RE = /^(?:packages\/memory-host-sdk\/src\/host\/(?:(?:internal|read-file)(?:\.test)?|explicit-extra-markdown)|extensions\/memory-core\/src\/(?:cli-runtime-common|memory-extra-file-path\.windows\.test))\.ts$/; const WINDOWS_BROWSER_VERSION_PROBE_SCOPE_RE = /^extensions\/browser\/src\/browser\/chrome\.executable-probe\.ts$/; const WINDOWS_WORKSPACE_QUIESCENCE_SCOPE_RE = /^src\/gateway\/worker-environments\/workspace-quiescence(?:-scripts|(?:\.windows)?\.test)?\.ts$/; const WINDOWS_WORKER_BUNDLE_SCOPE_RE = /^src\/(?:shared\/worker-bundle-(?:archive|hash)(?:\.test)?|gateway\/worker-environments\/bundle(?:-staging)?(?:\.test)?|node-host\/node-worker-bundle-installer(?:\.test)?)\.ts$/; const WINDOWS_WORKER_WORKSPACE_SCOPE_RE = /^src\/(?:infra\/git-exec(?:\.test)?|agents\/worktrees\/(?:git|base-ref)(?:\.test)?|node-host\/node-worker-transfer-client(?:\.test)?|gateway\/worker-environments\/(?:node-worker-tunnel(?:\.test)?|workspace-result-(?:git(?:\.test)?|staging|ref-mutation\.test)|session-repository-checkpoints(?:\.test)?|workspace-sync-(?:scripts|manifest\.test)))\.ts$/; const CONTROL_UI_I18N_SCOPE_RE = /^(src\/shared\/(?:control-ui-locale|public-session-copy)\.ts$|ui\/src\/i18n\/|ui\/config\/control-ui-locales\.ts$|extensions\/(?:active-memory|memory-wiki)\/control-ui\.presentation\.json$|extensions\/[^/]+\/(?:package\.json$|(?:.*\/)?i18n\/(?:locales|\.i18n)\/)|scripts\/(?:control-ui-i18n(?:-verify)?\.ts|lib\/(?:control-ui-plugin-i18n-catalog\.ts|control-ui-i18n-(?:(?:catalog(?:-values)?|config|raw-copy|sync-plan)\.ts|config\.json)))$|\.github\/workflows\/control-ui-locale-refresh\.yml$)/; // A plugin can declare its browser entry in any package directory. Keep this // path-only planner conservative; source discovery selects actual UI owners. const CONTROL_UI_I18N_PRODUCTION_SOURCE_RE = /^(?:ui\/src\/(?:app|components|lib|pages)\/.*\.tsx?|extensions\/[^/]+\/.*\.tsx?|src\/config\/(?:schema[^/]*|zod-schema[^/]*|media-audio-field-metadata|talk-defaults|channel-config-keys)\.ts)$/; const CONTROL_UI_HARD_GENERATED_I18N_RE = /^(?:ui\/src\/i18n\/\.i18n\/(?:catalog-fallbacks\.json|[^/]+\.(?:meta\.json|tm\.jsonl))|extensions\/[^/]+\/(?:.*\/)?i18n\/\.i18n\/[^/]+\.(?:meta\.json|tm\.jsonl))$/; const RELEASE_BRANCH_RE = /^release\/\d{4}\.\d+\.\d+$/; class ControlUiGeneratedArtifactsMixedError extends Error {} class NativeGeneratedArtifactsMixedError extends Error {} // Browser setup and sharding inputs must select the same proof as the config; // matching the harness family also covers per-project bundle setup owners. // QA Lab real-Gateway suites share the same Chromium owner. The test runtime // owner sets the Bun UI env; main runs UI on Node, so only PRs prove it. const CHROMIUM_UI_TEST_SCOPE_RE = /^(ui\/|extensions\/(?:active-memory|memory-wiki)\/control-ui\.presentation\.json$|extensions\/[^/]+\/control-ui\.(?:channel-detail|settings-presentation|session-source)\.json$|extensions\/[^/]+\/browser(?:\/|$)|extensions\/browser\/chrome-extension\/|extensions\/qa-lab\/src\/[^/]+\.real-gateway\.e2e\.test\.ts$|test\/vitest\/vitest\.(?:ui-(?:e2e|browser)(?:-[^/.]+)?\.[^/]+\.ts|(?:pattern-file|performance-config|timeouts|weighted-sharding)\.ts|ui-(?:isolated-)?paths\.mjs)$|test\/helpers\/temp-dir\.ts$|scripts\/(?:ensure-playwright-chromium\.mts|test-desktop-resize-real\.mts|check-control-ui-(?:performance(?:-base)?|precompressed-assets)\.mts|ui\.(?:mts|js)|control-ui-mock-[^/]+\.ts|lib\/(?:ci-test-(?:runtime|timings(?:-schema)?)|desktop-resize-proof|vitest-local-scheduling)\.mts)$|config\/(?:ci-test-timings|control-ui-startup-budget-baseline)\.json$|\.github\/workflows\/ci\.yml$)/; const NATIVE_I18N_SCOPE_RE = /^(?:apps\/\.i18n\/|apps\/android\/(?:app\/src\/(?:main|play|thirdParty)\/|wear\/src\/main\/)|apps\/ios\/|apps\/macos\/Sources\/|apps\/shared\/OpenClawKit\/Sources\/|scripts\/(?:android-app-i18n|apple-app-i18n|native-(?:app-i18n|i18n-(?:inventory|locales)))\.ts$|test\/scripts\/(?:android-app-i18n|apple-app-i18n|native-app-i18n)\.test\.ts$|\.github\/workflows\/(?:ci|native-app-locale-refresh)\.yml$)/; const NODE_FAST_PLUGIN_CONTRACT_SCOPE_RE = /^src\/plugins\/contracts\/(?:inventory\/bundled-capability-metadata|registry|tts-contract-suites)\.ts$/; const NODE_FAST_CI_ROUTING_SCOPE_RE = /^(scripts\/ci-changed-scope\.mjs$|scripts\/(?:check-changed|run-vitest)\.(?:mjs|mts)$|scripts\/test-projects(?:\.test-support)?\.mts$|scripts\/lib\/changed-path-facts\.mjs$|scripts\/lib\/(?:ci-changed-node-test-plan|ci-docker-seed-plan)\.mts$|src\/commands\/status\.scan-result\.test\.ts$|src\/scripts\/ci-changed-scope(?:\.[^/]+)?\.test\.ts$|test\/scripts\/(?:changed-lanes|changed-path-facts|ci-changed-node-test-plan(?:\.(?:config-fallback|dependency-hubs|dependency-inputs|policy|process-owners|source-owners))?|ci-docker-seed-plan|run-vitest|test-projects)\.test\.ts$|test\/scripts\/ci-changed-node-test-plan\.test-support\.ts$)/; const NODE_FAST_SCOPE_RE = new RegExp( `${NODE_FAST_PLUGIN_CONTRACT_SCOPE_RE.source}|${NODE_FAST_CI_ROUTING_SCOPE_RE.source}`, ); /** @param {string} path Canonical repository-relative script or test path. */ export function isMacosToolingPath(path) { return MACOS_SCRIPT_SCOPE_RE.test(path) || SWIFT_LINT_OWNER_RE.test(path); } /** @param {string} path Canonical repository-relative build input. */ function isAppleSharedBuildInput(path) { return ( APPLE_SWIFT_CONFIG_RE.test(path) || SWIFT_LINT_OWNER_RE.test(path) || MERMAID_ASSET_INPUT_RE.test(path) || path === "scripts/prepare-apple-mermaid.mjs" ); } /** @param {string} path Canonical repository-relative build input. */ function isNativeProtocolInput(path) { return ( nativeProtocolInputs.files.includes(path) || (/\.(?:ts|mts|mjs|json)$/.test(path) && !/\.(?:test|spec)\./.test(path) && nativeProtocolInputs.directories.some((directory) => path.startsWith(`${directory}/`))) ); } /** * @param {string[]} changedPaths * @returns {ChangedScope} */ export function detectChangedScope(changedPaths) { if (!Array.isArray(changedPaths) || changedPaths.length === 0) { return { ...FULL_SCOPE }; } // The package scripts own the native test inventory; a second whitelist drifts. const scripts = JSON.parse( readFileSync(new URL("../package.json", import.meta.url), "utf8"), ).scripts; const windowsCiTests = new Set( [1, 2].flatMap((part) => { const targets = scripts[`test:windows:ci:${part}`].match(/[^\s"']+\.test\.ts/g); if (!targets) { throw new Error(`Windows CI part ${part} must declare explicit test paths`); } return targets; }), ); let runNode = false; let runMacos = false; let hasGitOwnerChanges = false; let hasSkillsWatchChanges = false; let hasMacosNodeTestSupportChanges = false; let runIosBuild = false; let runAndroid = false; let runWindows = false; let runSkillsPython = false; let runControlUiI18n = false; let runUiTests = false; let hasNonDocs = false; let hasNonNativeNonDocs = false; for (const rawPath of changedPaths) { const facts = getChangedPathFacts(rawPath); const { path } = facts; if (!path) { continue; } const isAppleBuildInput = isAppleSharedBuildInput(path); const hasNativeProtocolInput = isNativeProtocolInput(path); if (facts.surface === "docs" && !WORKSPACE_TEMPLATE_SCOPE_RE.test(path)) { continue; } hasNonDocs = true; hasGitOwnerChanges ||= GIT_OWNER_SCOPE_RE.test(path); hasSkillsWatchChanges ||= SKILLS_WATCH_SCOPE_RE.test(path); // Native shell fixture support needs Darwin proof, not Swift or Windows builds. hasMacosNodeTestSupportChanges ||= path === "test/scripts/mac-script-fixture.test-support.ts"; if (SKILLS_PYTHON_SCOPE_RE.test(path)) { runSkillsPython = true; } if ( !NATIVE_PROTOCOL_GEN_RE.test(path) && (MACOS_NATIVE_RE.test(path) || isMacosToolingPath(path) || WORKER_DEPLOY_ARTIFACT_SCOPE_RE.test(path) || APPLE_SHARED_CONTRACT_FIXTURE_RE.test(path) || isAppleBuildInput || hasNativeProtocolInput) ) { runMacos = true; } if ( IOS_BUILD_RE.test(path) || path === "scripts/ci-xcodebuild.py" || isAppleBuildInput || hasNativeProtocolInput ) { runIosBuild = true; } if ( !NATIVE_PROTOCOL_GEN_RE.test(path) && (ANDROID_NATIVE_RE.test(path) || ANDROID_TALK_CONTRACT_FIXTURE_RE.test(path) || MERMAID_ASSET_INPUT_RE.test(path) || hasNativeProtocolInput) ) { runAndroid = true; } if (NODE_SCOPE_RE.test(path)) { runNode = true; } if ( windowsCiTests.has(path) || WINDOWS_LAN_ADVERTISEMENT_SCOPE_RE.test(path) || WINDOWS_FILE_URL_SCOPE_RE.test(path) || WINDOWS_DAEMON_SCOPE_RE.test(path) || WINDOWS_USAGE_TEMPLATE_SCOPE_RE.test(path) || WINDOWS_MEDIA_UNDERSTANDING_FILE_URL_SCOPE_RE.test(path) || WINDOWS_HOME_DISPLAY_SCOPE_RE.test(path) || WINDOWS_AGENT_HOME_PATH_SCOPE_RE.test(path) || WINDOWS_CHILD_ENV_SCOPE_RE.test(path) || WINDOWS_SOURCE_CLI_SCOPE_RE.test(path) || WINDOWS_TEST_INSTANCE_SCOPE_RE.test(path) || WINDOWS_NODE_HOST_EXECUTABLE_SCOPE_RE.test(path) || WINDOWS_MEMORY_EXTRA_FILE_SCOPE_RE.test(path) || WINDOWS_BROWSER_VERSION_PROBE_SCOPE_RE.test(path) || WINDOWS_WORKSPACE_QUIESCENCE_SCOPE_RE.test(path) || WINDOWS_WORKER_BUNDLE_SCOPE_RE.test(path) || WINDOWS_WORKER_WORKSPACE_SCOPE_RE.test(path) || WINDOWS_PROCESS_IDENTITY_SCOPE_RE.test(path) || /^scripts\/lib\/(?:ci-windows-test-plan|vitest-build-prerequisites)\.mts$|^test\/scripts\/ci-windows-test-plan\.test\.ts$/u.test( path, ) || (!facts.isTestOnly && (WINDOWS_SCOPE_RE.test(path) || WINDOWS_SQLITE_SCOPE_RE.test(path) || WINDOWS_SECRETREF_SCOPE_RE.test(path))) ) { runWindows = true; } if ( CONTROL_UI_I18N_SCOPE_RE.test(path) || (CONTROL_UI_I18N_PRODUCTION_SOURCE_RE.test(path) && !facts.isTestOnly) ) { runControlUiI18n = true; } if (CHROMIUM_UI_TEST_SCOPE_RE.test(path) || MERMAID_ASSET_INPUT_RE.test(path)) { runUiTests = true; } if (!facts.isNativeOnly) { hasNonNativeNonDocs = true; } } if (!runNode && hasNonDocs && hasNonNativeNonDocs) { runNode = true; } return { runNode, runMacos, runMacosNode: runMacos || hasGitOwnerChanges || hasMacosNodeTestSupportChanges || hasSkillsWatchChanges, runIosBuild, runAndroid, runWindows: runWindows || hasGitOwnerChanges || hasSkillsWatchChanges, runSkillsPython, runControlUiI18n, runUiTests, }; } /** * Release screenshot capture is a conservative pipeline-integrity gate. App, * linked Swift, and capture-tool changes must prove the real release lane. * @param {string[] | null} changedPaths * @returns {boolean} */ export function shouldRunIosScreenshots(changedPaths) { if (!Array.isArray(changedPaths)) { return true; } return changedPaths.some((rawPath) => { const { path } = getChangedPathFacts(rawPath); return ( IOS_SCREENSHOT_APP_SCOPE_RE.test(path) || IOS_SCREENSHOT_SCRIPT_SCOPE_RE.test(path) || isAppleSharedBuildInput(path) ); }); } /** * Prove the phone and Wear store capture flow when its app or build inputs change. * @param {string[] | null} changedPaths * @returns {boolean} */ function shouldRunAndroidScreenshots(changedPaths) { if (!Array.isArray(changedPaths)) { return true; } return changedPaths.some((rawPath) => { const { path } = getChangedPathFacts(rawPath); if (isCiDocumentationPath(path) || /\.mdx?$/.test(path)) { return false; } return ( ANDROID_SCREENSHOT_APP_SCOPE_RE.test(path) || ANDROID_SCREENSHOT_SCRIPT_SCOPE_RE.test(path) || /^(?:apps\/shared\/mermaid\/|apps\/\.i18n\/|\.github\/actions\/(?:setup-android-toolchain|setup-node-env|setup-pnpm-store-cache)\/)/.test( path, ) || /^(?:\.github\/workflows\/(?:ci|android-store-release)\.yml|scripts\/ci-(?:changed-scope|build-manifest)\.mjs|pnpm-lock\.yaml)$/.test( path, ) || path === "apps/shared/OpenClawKit/Sources/OpenClawKit/Resources/tool-display.json" || MERMAID_ASSET_INPUT_RE.test(path) || isNativeProtocolInput(path) ); }); } /** * Generated Control UI locale snapshots belong in their isolated automation PR. * Mixing them into a source PR recreates deterministic rebase conflicts. * @param {string[]} changedPaths * @param {string} [branchName] * @returns {void} */ export function assertControlUiGeneratedArtifactsIsolated(changedPaths, branchName = "") { if (branchName === "main" || RELEASE_BRANCH_RE.test(branchName)) { return; } const generatedPaths = changedPaths.filter((filePath) => CONTROL_UI_HARD_GENERATED_I18N_RE.test(filePath), ); if (generatedPaths.length === 0) { return; } // Only the trusted locale publisher may pair generated memory with authored // plugin bundles/manifests. Its native builder can repair a manifest even // when that plugin's memory is unchanged; ordinary source PRs remain isolated. const sourcePaths = changedPaths.filter((filePath) => { if (CONTROL_UI_HARD_GENERATED_I18N_RE.test(filePath)) { return false; } return ( branchName !== "automation/control-ui-locale-refresh" || !/^extensions\/[^/]+\/(?:openclaw\.plugin\.json|(?:.*\/)?i18n\/locales\/translated\.json)$/.test( filePath, ) ); }); if (sourcePaths.length === 0) { return; } throw new ControlUiGeneratedArtifactsMixedError( [ "Control UI generated locale artifacts must be isolated from source changes.", "Commit English/source changes only; the locale refresh workflow owns generated translation memory and metadata.", ...generatedPaths.map((filePath) => `- generated: ${filePath}`), ...sourcePaths.map((filePath) => `- source: ${filePath}`), ].join("\n"), ); } /** * @param {string[] | null} changedPaths * @returns {boolean} */ export function shouldStrictControlUiI18n(changedPaths) { return ( changedPaths === null || changedPaths.some((filePath) => CONTROL_UI_HARD_GENERATED_I18N_RE.test(filePath)) ); } /** * Native translations and platform resources are committed by one serialized * automation PR. Source PRs own only source plus the stable-ID inventory. * @param {string[]} changedPaths * @param {string} [branchName] * @returns {void} */ export function assertNativeGeneratedArtifactsIsolated(changedPaths, branchName = "") { if (branchName === "main" || RELEASE_BRANCH_RE.test(branchName)) { return; } const generatedPaths = changedPaths.filter((filePath) => NATIVE_HARD_GENERATED_I18N_RE.test(filePath), ); if (generatedPaths.length === 0) { return; } const generatedCompanionPaths = changedPaths.filter((filePath) => NATIVE_COOWNED_GENERATED_I18N_RE.test(filePath), ); const sourcePaths = changedPaths.filter( (filePath) => !NATIVE_HARD_GENERATED_I18N_RE.test(filePath) && !NATIVE_COOWNED_GENERATED_I18N_RE.test(filePath), ); if (sourcePaths.length === 0) { return; } throw new NativeGeneratedArtifactsMixedError( [ "Native generated locale artifacts must be isolated from source changes.", "Commit native source changes and apps/.i18n/native-source.json only; the native locale refresh workflow owns translated and platform-generated artifacts.", ...generatedPaths.map((filePath) => `- generated: ${filePath}`), ...generatedCompanionPaths.map((filePath) => `- generated companion: ${filePath}`), ...sourcePaths.map((filePath) => `- source: ${filePath}`), ].join("\n"), ); } /** * @param {string[] | null} changedPaths * @returns {boolean} */ export function shouldStrictNativeI18n(changedPaths) { return ( changedPaths === null || changedPaths.some((filePath) => NATIVE_HARD_GENERATED_I18N_RE.test(filePath)) ); } /** @returns {string} */ function resolveChangedBranchName() { const githubBranch = process.env.GITHUB_HEAD_REF || process.env.GITHUB_REF_NAME; if (githubBranch) { return githubBranch; } try { return execFileSync("git", ["branch", "--show-current"], { encoding: "utf8" }).trim(); } catch { return ""; } } /** * @param {Readonly>} [env] * @param {string} [branchName] * @returns {string} */ export function resolveAllowedGeneratedMixBranch( env = process.env, branchName = resolveChangedBranchName(), ) { if (env.GITHUB_ACTIONS === "true" && env.OPENCLAW_ALLOW_RELEASE_GENERATED_MIX !== "true") { return ""; } if (RELEASE_BRANCH_RE.test(branchName) || branchName === "automation/control-ui-locale-refresh") { return branchName; } if ( env.GITHUB_ACTIONS === "true" && env.GITHUB_EVENT_NAME === "push" && env.GITHUB_REF === "refs/heads/main" && branchName === "main" ) { return branchName; } return ""; } // Retained-settings proof exercises these concrete producer and consumer owners. // Keep unrelated app/config changes out of model-download qualification. const MLX_SETTINGS_PROOF_INPUTS = new Set([ "scripts/lib/macos-mlx-settings-manifest.mts", "scripts/lib/macos-mlx-settings-producer.mts", "test/scripts/macos-mlx-settings-producer.test.ts", "apps/macos/Sources/OpenClaw/AppProfile.swift", "apps/macos/Sources/OpenClaw/OpenClawPaths.swift", "apps/macos/Sources/OpenClaw/OpenClawConfigFile.swift", "apps/macos/Sources/OpenClaw/Constants.swift", "apps/macos/Sources/OpenClaw/ConfigStore.swift", "apps/macos/Sources/OpenClaw/TalkModeGatewayConfig.swift", "apps/shared/OpenClawKit/Sources/OpenClawKit/TalkConfigSnapshot.swift", "apps/shared/OpenClawKit/Sources/OpenClawKit/TalkConfigParsing.swift", "src/config/paths.ts", "src/config/io.ts", "src/config/runtime-config-capture-state.ts", "src/config/runtime-source-projection.ts", "src/config/config.ts", "src/config/talk.ts", "src/gateway/talk/handlers/index.ts", "src/talk/provider-registry.ts", "src/tts/provider-registry.ts", "src/tts/provider-registry-core.ts", "packages/gateway-protocol/src/index.ts", "packages/gateway-protocol/src/schema/channels.ts", "packages/gateway-protocol/src/validators/integrations.ts", "packages/gateway-protocol/src/compiled/protocol.generated/validators-integrations.js", ]); /** * Model downloads belong only to explicit qualification of this native owner. * The manifest combines this input fact with the existing release-gate admission. * @param {readonly string[] | null} changedPaths * @returns {boolean} */ export function hasMlxNativeProofInputs(changedPaths) { return ( Array.isArray(changedPaths) && changedPaths.some( (file) => MLX_SETTINGS_PROOF_INPUTS.has(file) || file === "test/fixtures/macos-mlx-native/bad.Package.resolved" || /^(?:apps\/macos-mlx-tts\/|apps\/shared\/OpenClawMLXTTSProtocol\/|apps\/macos\/Tests\/OpenClawIPCTests\/MLXSettingsUpgradeTests\.swift$|scripts\/(?:test-macos-mlx-native\.py|test-macos-(?:mlx-settings|native)\.mts|lib\/native-ci-budget\.mts|macos-health-render\.sb|ci-(?:changed-scope|build-manifest)\.(?:mjs|d\.mts))$|\.github\/workflows\/ci\.yml$|test\/helpers\/macos-mlx-settings-producer\.ts$|test\/scripts\/(?:macos-mlx-(?:native|settings)|macos-native-test-launch|ci-workflow-complete)\.test\.ts$|src\/scripts\/ci-changed-scope\.test\.ts$)/u.test( file, ), ) ); } /** * @param {string[] | null | undefined} changedPaths * @returns {boolean} */ export function shouldRunNativeI18n(changedPaths) { return ( !Array.isArray(changedPaths) || changedPaths.length === 0 || changedPaths.some((path) => NATIVE_I18N_SCOPE_RE.test(path)) ); } /** * @param {string[]} changedPaths * @returns {NodeFastScope} */ export function detectNodeFastScope(changedPaths) { if (!Array.isArray(changedPaths) || changedPaths.length === 0) { return { runFastOnly: false, runPluginContracts: false, runCiRouting: false }; } let hasNonDocs = false; let runPluginContracts = false; let runCiRouting = false; for (const rawPath of changedPaths) { const facts = getChangedPathFacts(rawPath); const { path } = facts; if (!path || (facts.surface === "docs" && !WORKSPACE_TEMPLATE_SCOPE_RE.test(path))) { continue; } hasNonDocs = true; runPluginContracts ||= NODE_FAST_PLUGIN_CONTRACT_SCOPE_RE.test(path); runCiRouting ||= NODE_FAST_CI_ROUTING_SCOPE_RE.test(path); if (!NODE_FAST_SCOPE_RE.test(path)) { return { runFastOnly: false, runPluginContracts: false, runCiRouting: false }; } } const runFastOnly = hasNonDocs && (runPluginContracts || runCiRouting); return { runFastOnly, runPluginContracts: runFastOnly && runPluginContracts, runCiRouting: runFastOnly && runCiRouting, }; } /** * @param {string} base * @param {string} [head] * @param {string} [cwd] * @param {boolean} [preferMergeHeadFirstParent] * @returns {string[]} */ export function listChangedPaths( base, head = "HEAD", cwd = process.cwd(), preferMergeHeadFirstParent = false, ) { if (!base) { return []; } const headCommit = ensureGitCommit(head, cwd); const diffBase = resolveMergeHeadDiffBase({ base, head: headCommit, cwd, preferFirstParent: preferMergeHeadFirstParent, }); const baseCommit = ensureGitCommit(diffBase, cwd); const output = execFileSync( "git", ["diff", "--no-renames", "--name-only", "-z", baseCommit, headCommit], { cwd, stdio: ["ignore", "pipe", "pipe"], encoding: "utf8", }, ); return output.split("\0").filter(Boolean); } /** * @param {ChangedScope} scope * @param {string} [outputPath] * @param {NodeFastScope} [nodeFastScope] * @param {boolean} [runNativeI18n] * @param {string[] | null} [changedPaths] * @param {string} [workflowEventName] * @returns {void} */ export function writeGitHubOutput( scope, outputPath = process.env.GITHUB_OUTPUT, nodeFastScope = { runFastOnly: false, runPluginContracts: false, runCiRouting: false }, runNativeI18n = true, changedPaths = null, workflowEventName = "", ) { if (!outputPath) { throw new Error("GITHUB_OUTPUT is required"); } const nodeTestDataOnly = changedPaths !== null && changedPaths.length > 0 && changedPaths.every(isNodeTestDataOnlyPath); appendFileSync(outputPath, `node_test_data_only=${nodeTestDataOnly}\n`, "utf8"); appendFileSync(outputPath, `run_node=${scope.runNode}\n`, "utf8"); appendFileSync(outputPath, `run_macos=${scope.runMacos}\n`, "utf8"); appendFileSync(outputPath, `run_macos_node=${scope.runMacosNode}\n`, "utf8"); appendFileSync(outputPath, `run_ios_build=${scope.runIosBuild}\n`, "utf8"); appendFileSync( outputPath, `run_ios_screenshots=${shouldRunIosScreenshots(changedPaths)}\n`, "utf8", ); appendFileSync( outputPath, `run_android_screenshots=${workflowEventName !== "pull_request" && shouldRunAndroidScreenshots(changedPaths)}\n`, "utf8", ); appendFileSync(outputPath, `run_android=${scope.runAndroid}\n`, "utf8"); appendFileSync(outputPath, `run_windows=${scope.runWindows}\n`, "utf8"); appendFileSync(outputPath, `run_skills_python=${scope.runSkillsPython}\n`, "utf8"); appendFileSync(outputPath, `run_node_fast_only=${nodeFastScope.runFastOnly}\n`, "utf8"); appendFileSync( outputPath, `run_node_fast_plugin_contracts=${nodeFastScope.runPluginContracts}\n`, "utf8", ); appendFileSync(outputPath, `run_node_fast_ci_routing=${nodeFastScope.runCiRouting}\n`, "utf8"); appendFileSync(outputPath, `run_control_ui_i18n=${scope.runControlUiI18n}\n`, "utf8"); appendFileSync( outputPath, `strict_control_ui_i18n=${shouldStrictControlUiI18n(changedPaths)}\n`, "utf8", ); appendFileSync(outputPath, `run_ui_tests=${scope.runUiTests}\n`, "utf8"); appendFileSync(outputPath, `run_native_i18n=${runNativeI18n}\n`, "utf8"); appendFileSync( outputPath, `strict_native_i18n=${shouldStrictNativeI18n(changedPaths)}\n`, "utf8", ); const changedPathsJson = JSON.stringify(changedPaths); // Same-job consumers read the complete manifest without Actions output or env limits. const changedPathsFile = resolve(`${outputPath}.changed-paths.json`); writeFileSync(changedPathsFile, changedPathsJson, "utf8"); appendFileSync(outputPath, `changed_paths_file=${changedPathsFile}\n`, "utf8"); appendFileSync( outputPath, `changed_paths_json=${Buffer.byteLength(changedPathsJson, "utf8") <= CHANGED_PATHS_OUTPUT_MAX_BYTES ? changedPathsJson : "null"}\n`, "utf8", ); } /** * @param {string[]} argv * @returns {{ base: string; head: string; mergeHeadFirstParent: boolean }} */ export function parseArgs(argv) { const args = { base: "", head: "HEAD", mergeHeadFirstParent: false }; for (let i = 0; i < argv.length; i += 1) { const arg = argv[i]; if (arg === "--base" || arg === "--head") { args[arg === "--base" ? "base" : "head"] = requireOptionArgument(argv, i, arg); i += 1; continue; } if (arg === "--merge-head-first-parent") { args.mergeHeadFirstParent = true; continue; } throw new Error(`Unknown argument: ${arg}`); } if (!args.base) { throw new Error("--base is required"); } return args; } if (isDirectRunUrl(process.argv[1], import.meta.url)) { const workflowEventName = process.env.GITHUB_EVENT_NAME ?? ""; try { const args = parseArgs(process.argv.slice(2)); const changedPaths = listChangedPaths( args.base, args.head, process.cwd(), args.mergeHeadFirstParent, ); if (changedPaths.length === 0) { writeGitHubOutput( EMPTY_SCOPE, process.env.GITHUB_OUTPUT, undefined, false, [], workflowEventName, ); process.exit(0); } const allowedGeneratedMixBranch = resolveAllowedGeneratedMixBranch(); assertControlUiGeneratedArtifactsIsolated(changedPaths, allowedGeneratedMixBranch); assertNativeGeneratedArtifactsIsolated(changedPaths, allowedGeneratedMixBranch); writeGitHubOutput( detectChangedScope(changedPaths), process.env.GITHUB_OUTPUT, detectNodeFastScope(changedPaths), shouldRunNativeI18n(changedPaths), changedPaths, workflowEventName, ); } catch (error) { if ( error instanceof ControlUiGeneratedArtifactsMixedError || error instanceof NativeGeneratedArtifactsMixedError ) { console.error(error.message); process.exitCode = 1; } else { writeGitHubOutput( FULL_SCOPE, process.env.GITHUB_OUTPUT, undefined, true, null, workflowEventName, ); } } }