chore(tooling): enforce no-floating-promises and drop DOM globals from Node-side typechecking (#104422)

* chore(lint): enforce no-floating-promises repo-wide

* feat(tooling): split DOM globals out of the Node-side typecheck program

tsconfig.core.json now compiles src/ + packages/ with lib ES2023; new
tsconfig.ui.json owns ui/ with DOM. Web-global names used by Node code
alias to canonical undici/stream-web types; highlight.js loads through a
validated narrow API because its d.ts force-includes lib.dom. Boundary,
sparse-guard, changed-lane routing, and profile lanes cover the new ui
graph.

* chore(deps): declare undici-types and teach knip about the highlight.js runtime require

* ci: retrigger dropped pull_request synchronize event

* refactor(types): derive web-global aliases from @types/node fetch globals, drop undici-types dep

* ci: retrigger after dependency guard cleared

* fix(scripts): add ui lane to changed-lanes declaration union
This commit is contained in:
Peter Steinberger
2026-07-11 07:28:20 -07:00
committed by GitHub
parent 13817a6108
commit ae12413ee2
20 changed files with 182 additions and 25 deletions

View File

@@ -1,6 +1,7 @@
export type ChangedLane =
| "core"
| "coreTests"
| "ui"
| "extensions"
| "extensionTests"
| "scripts"

View File

@@ -12,7 +12,8 @@ const RAW_SYNC_CHANGED_LANES_ENV = "OPENCLAW_CHANGED_LANES_RAW_SYNC";
const DOCS_PATH_RE = /^(?:docs\/|README\.md$|AGENTS\.md$|.*\.mdx?$)/u;
const APP_PATH_RE = /^(?:apps\/|Swabble\/|appcast\.xml$)/u;
const EXTENSION_PATH_RE = /^extensions\/[^/]+(?:\/|$)/u;
const CORE_PATH_RE = /^(?:src\/|ui\/|packages\/)/u;
const CORE_PATH_RE = /^(?:src\/|packages\/)/u;
const UI_PATH_RE = /^(?:ui\/|tsconfig\.ui\.json$)/u;
const SCRIPTS_TYPECHECK_PATH_RE =
/^(?:scripts\/.*\.(?:[cm]?ts|[cm]?tsx)|tsconfig\.scripts\.json)$/u;
const TEST_ROOT_TYPECHECK_PATH_RE =
@@ -58,7 +59,7 @@ export const RELEASE_METADATA_PATHS = new Set([
"package.json",
]);
/** @typedef {"core" | "coreTests" | "extensions" | "extensionTests" | "scripts" | "testRoot" | "apps" | "docs" | "tooling" | "liveDockerTooling" | "releaseMetadata" | "all"} ChangedLane */
/** @typedef {"core" | "coreTests" | "ui" | "extensions" | "extensionTests" | "scripts" | "testRoot" | "apps" | "docs" | "tooling" | "liveDockerTooling" | "releaseMetadata" | "all"} ChangedLane */
/**
* @typedef {{
@@ -87,6 +88,7 @@ export function createEmptyChangedLanes() {
return {
core: false,
coreTests: false,
ui: false,
extensions: false,
extensionTests: false,
scripts: false,
@@ -218,6 +220,18 @@ export function detectChangedLanes(changedPaths, options = {}) {
continue;
}
if (UI_PATH_RE.test(changedPath)) {
if (isChangedLaneTestPath(changedPath)) {
lanes.coreTests = true;
reasons.push(`${changedPath}: UI test`);
} else {
lanes.ui = true;
lanes.coreTests = true;
reasons.push(`${changedPath}: UI production`);
}
continue;
}
if (APP_PATH_RE.test(changedPath)) {
lanes.apps = true;
reasons.push(`${changedPath}: app surface`);

View File

@@ -385,6 +385,9 @@ export function createChangedCheckPlan(result, options = {}) {
if (lanes.coreTests) {
addTypecheck("typecheck core tests", ["tsgo:core:test"]);
}
if (lanes.ui) {
addTypecheck("typecheck UI", ["tsgo:ui"]);
}
if (lanes.extensions) {
addTypecheck("typecheck extensions", ["tsgo:extensions"]);
}
@@ -398,7 +401,7 @@ export function createChangedCheckPlan(result, options = {}) {
addTypecheck("typecheck test root", ["tsgo:test:root"]);
}
if (lanes.core || lanes.coreTests) {
if (lanes.core || lanes.coreTests || lanes.ui) {
const coreLintCommand = createTargetedCoreLintCommand(result.paths, baseEnv);
if (coreLintCommand) {
addCommand(

View File

@@ -10,6 +10,7 @@ const tsgoPath = path.join(repoRoot, "node_modules", ".bin", "tsgo");
const coreGraphs = [
{ name: "core", config: "tsconfig.core.json" },
{ name: "ui", config: "tsconfig.ui.json" },
{ name: "core-test", config: "test/tsconfig/tsconfig.core.test.json" },
{ name: "core-test-agents", config: "test/tsconfig/tsconfig.core.test.agents.json" },
{ name: "core-test-non-agents", config: "test/tsconfig/tsconfig.core.test.non-agents.json" },

View File

@@ -12,14 +12,13 @@ const CORE_TEST_CONFIGS = new Set([
]);
const CORE_PROD_CONFIGS = new Set(["tsconfig.core.json"]);
const UI_PROD_CONFIGS = new Set(["tsconfig.ui.json"]);
const TSGO_SPARSE_SKIP_ENV_KEY = "OPENCLAW_TSGO_SPARSE_SKIP";
const CORE_SPARSE_ROOTS = ["packages", "ui/config", "ui/src"];
const CORE_PROD_SPARSE_ROOTS = ["packages"];
const UI_PROD_SPARSE_ROOTS = ["packages", "src", "ui/config", "ui/src"];
const CORE_TEST_SPARSE_ROOTS = ["packages", "ui/config", "ui/src"];
const CORE_PROD_REQUIRED_PATHS = [
{
path: "apps/shared/OpenClawKit/Sources/OpenClawKit/Resources/tool-display.json",
whenPresent: "ui/src/ui/tool-display.ts",
},
{
path: "scripts/lib/bundled-runtime-sidecar-paths.json",
whenPresent: "src/plugins/runtime-sidecar-paths.ts",
@@ -42,6 +41,13 @@ const CORE_PROD_REQUIRED_PATHS = [
},
];
const UI_PROD_REQUIRED_PATHS = [
{
path: "apps/shared/OpenClawKit/Sources/OpenClawKit/Resources/tool-display.json",
whenPresent: "ui/src/lib/chat/tool-display.ts",
},
];
const CORE_TEST_REQUIRED_PATHS = [
"packages/plugin-package-contract/src/index.ts",
"ui/config/control-ui-chunking.ts",
@@ -85,7 +91,9 @@ export function getSparseTsgoGuardError(
const projectName = projectPath ? path.basename(projectPath) : null;
if (
!projectName ||
(!CORE_PROD_CONFIGS.has(projectName) && !CORE_TEST_CONFIGS.has(projectName)) ||
(!CORE_PROD_CONFIGS.has(projectName) &&
!UI_PROD_CONFIGS.has(projectName) &&
!CORE_TEST_CONFIGS.has(projectName)) ||
isMetadataOnlyCommand(args)
) {
return null;
@@ -118,8 +126,14 @@ export function getSparseTsgoGuardError(
}
function getRequiredSparseRootsForProject(projectName) {
if (CORE_PROD_CONFIGS.has(projectName) || CORE_TEST_CONFIGS.has(projectName)) {
return CORE_SPARSE_ROOTS;
if (CORE_PROD_CONFIGS.has(projectName)) {
return CORE_PROD_SPARSE_ROOTS;
}
if (UI_PROD_CONFIGS.has(projectName)) {
return UI_PROD_SPARSE_ROOTS;
}
if (CORE_TEST_CONFIGS.has(projectName)) {
return CORE_TEST_SPARSE_ROOTS;
}
return [];
}
@@ -129,6 +143,9 @@ function getRequiredPathsForProject(projectName, cwd, fileExists) {
if (CORE_PROD_CONFIGS.has(projectName)) {
requiredPaths.push(...conditionalRequiredPaths(CORE_PROD_REQUIRED_PATHS, cwd, fileExists));
}
if (UI_PROD_CONFIGS.has(projectName)) {
requiredPaths.push(...conditionalRequiredPaths(UI_PROD_REQUIRED_PATHS, cwd, fileExists));
}
if (CORE_TEST_CONFIGS.has(projectName)) {
requiredPaths.push(...CORE_TEST_REQUIRED_PATHS);
}

View File

@@ -21,6 +21,10 @@ const GRAPH_DEFINITIONS = {
config: "tsconfig.core.json",
description: "core production graph",
},
ui: {
config: "tsconfig.ui.json",
description: "UI production graph",
},
"core-test": {
config: "test/tsconfig/tsconfig.core.test.json",
description: "core colocated test graph",