mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-16 19:01:42 +00:00
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:
committed by
GitHub
parent
13817a6108
commit
ae12413ee2
@@ -598,6 +598,31 @@ describe("scripts/changed-lanes", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("routes UI production changes to UI prod and core test lanes", () => {
|
||||
const result = detectChangedLanes(["ui/src/app.ts"]);
|
||||
const plan = createChangedCheckPlan(result, { env: { PATH: "/usr/bin" } });
|
||||
|
||||
expectLanes(result.lanes, {
|
||||
coreTests: true,
|
||||
ui: true,
|
||||
});
|
||||
expect(plan.commands.map((command) => command.args[0])).toContain("tsgo:ui");
|
||||
expect(plan.commands.map((command) => command.args[0])).toContain("tsgo:core:test");
|
||||
expect(plan.commands.map((command) => command.args[0])).not.toContain("tsgo:core");
|
||||
});
|
||||
|
||||
it("routes the UI production config to UI prod and core test lanes", () => {
|
||||
const result = detectChangedLanes(["tsconfig.ui.json"]);
|
||||
const plan = createChangedCheckPlan(result, { env: { PATH: "/usr/bin" } });
|
||||
|
||||
expectLanes(result.lanes, {
|
||||
coreTests: true,
|
||||
ui: true,
|
||||
});
|
||||
expect(plan.commands.map((command) => command.args[0])).toContain("tsgo:ui");
|
||||
expect(plan.commands.map((command) => command.args[0])).toContain("tsgo:core:test");
|
||||
});
|
||||
|
||||
it.each([
|
||||
"scripts/control-ui-i18n.ts",
|
||||
"scripts/lib/example.ts",
|
||||
@@ -1851,6 +1876,7 @@ describe("scripts/changed-lanes", () => {
|
||||
expect(result.lanes).toEqual({
|
||||
core: false,
|
||||
coreTests: false,
|
||||
ui: false,
|
||||
extensions: false,
|
||||
extensionTests: false,
|
||||
scripts: false,
|
||||
|
||||
@@ -140,15 +140,14 @@ describe("oxlint config", () => {
|
||||
"dist/",
|
||||
"dist-runtime/",
|
||||
"docs/_layouts/",
|
||||
"**/a2ui.bundle.js",
|
||||
"extensions/diffs/assets/viewer-runtime.js",
|
||||
"extensions/diffs-language-pack/assets/viewer-runtime.js",
|
||||
"extensions/canvas/src/host/a2ui/a2ui.bundle.js",
|
||||
"node_modules/",
|
||||
"patches/",
|
||||
"pnpm-lock.yaml",
|
||||
"skills/**",
|
||||
"src/auto-reply/reply/export-html/template.js",
|
||||
"src/canvas-host/a2ui/a2ui.bundle.js",
|
||||
"vendor/",
|
||||
"**/.cache/**",
|
||||
"**/.openclaw-runtime-deps-copy-*/**",
|
||||
|
||||
@@ -111,24 +111,41 @@ describe("run-tsgo sparse guard", () => {
|
||||
`);
|
||||
});
|
||||
|
||||
it("returns a helpful message for sparse core worktrees missing transitive project files", () => {
|
||||
it("returns a helpful message for sparse UI worktrees missing transitive project files", () => {
|
||||
const cwd = createTempDir("openclaw-run-tsgo-");
|
||||
const uiToolDisplay = path.join(cwd, "ui/src/ui/tool-display.ts");
|
||||
const uiToolDisplay = path.join(cwd, "ui/src/lib/chat/tool-display.ts");
|
||||
fs.mkdirSync(path.dirname(uiToolDisplay), { recursive: true });
|
||||
fs.writeFileSync(uiToolDisplay, "", "utf8");
|
||||
|
||||
expect(
|
||||
getSparseTsgoGuardError(["-p", "tsconfig.core.json"], {
|
||||
getSparseTsgoGuardError(["-p", "tsconfig.ui.json"], {
|
||||
cwd,
|
||||
isSparseCheckoutEnabled: () => true,
|
||||
}),
|
||||
).toMatchInlineSnapshot(`
|
||||
"tsconfig.core.json cannot be typechecked from this sparse checkout because tracked project inputs are missing or only partially included:
|
||||
"tsconfig.ui.json cannot be typechecked from this sparse checkout because tracked project inputs are missing or only partially included:
|
||||
- apps/shared/OpenClawKit/Sources/OpenClawKit/Resources/tool-display.json
|
||||
Expand this worktree's sparse checkout to include those paths, or rerun in a full worktree."
|
||||
`);
|
||||
});
|
||||
|
||||
it("rejects sparse UI worktrees missing the transitive src root", () => {
|
||||
const cwd = createTempDir("openclaw-run-tsgo-");
|
||||
|
||||
expect(
|
||||
getSparseTsgoGuardError(["-p", "tsconfig.ui.json"], {
|
||||
cwd,
|
||||
fileExists: () => true,
|
||||
isSparseCheckoutEnabled: () => true,
|
||||
sparseCheckoutPatterns: ["/packages/", "/ui/config/", "/ui/src/"],
|
||||
}),
|
||||
).toMatchInlineSnapshot(`
|
||||
"tsconfig.ui.json cannot be typechecked from this sparse checkout because tracked project inputs are missing or only partially included:
|
||||
- src
|
||||
Expand this worktree's sparse checkout to include those paths, or rerun in a full worktree."
|
||||
`);
|
||||
});
|
||||
|
||||
it("returns a helpful message for sparse core-test worktrees missing ui and packages files", () => {
|
||||
const cwd = createTempDir("openclaw-run-tsgo-");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user