fix(ci): cache dist alongside tsbuildinfo and use workflow-logger in catch blocks

- Include dist/ and packages/*/dist/ in the TypeScript incremental cache
  so that when tsbuildinfo indicates no changes, the compiled output files
  are still present. Without this, tsc with incremental:true skips emission
  when tsbuildinfo exists but dist/ is absent (fresh checkout + cache restore),
  causing downstream packages like @gsd/pi-tui to fail resolving @gsd/native
  subpath exports.
- Also hash source files in the cache key so dist is invalidated on code changes.
- Replace process.stderr.write with logWarning("bootstrap", ...) in catch blocks
  to satisfy the workflow-logger coverage test (#3348).
- Update extension-bootstrap-isolation tests to match the new logWarning pattern.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Nils Reeh 2026-04-14 18:49:08 +02:00
parent 517e7cf0fe
commit 563a1e1b21
4 changed files with 29 additions and 15 deletions

View file

@ -155,7 +155,9 @@ jobs:
path: |
*.tsbuildinfo
packages/*/*.tsbuildinfo
key: tsbuild-${{ runner.os }}-${{ hashFiles('package-lock.json', 'tsconfig*.json', 'packages/*/tsconfig.json') }}
dist
packages/*/dist
key: tsbuild-${{ runner.os }}-${{ hashFiles('package-lock.json', 'tsconfig*.json', 'packages/*/tsconfig.json', 'src/**/*.ts', 'packages/*/src/**/*.ts') }}
restore-keys: |
tsbuild-${{ runner.os }}-
@ -222,7 +224,9 @@ jobs:
path: |
*.tsbuildinfo
packages/*/*.tsbuildinfo
key: tsbuild-${{ runner.os }}-${{ hashFiles('package-lock.json', 'tsconfig*.json', 'packages/*/tsconfig.json') }}
dist
packages/*/dist
key: tsbuild-${{ runner.os }}-${{ hashFiles('package-lock.json', 'tsconfig*.json', 'packages/*/tsconfig.json', 'src/**/*.ts', 'packages/*/src/**/*.ts') }}
restore-keys: |
tsbuild-${{ runner.os }}-
@ -259,7 +263,9 @@ jobs:
path: |
*.tsbuildinfo
packages/*/*.tsbuildinfo
key: tsbuild-${{ runner.os }}-${{ hashFiles('package-lock.json', 'tsconfig*.json', 'packages/*/tsconfig.json') }}
dist
packages/*/dist
key: tsbuild-${{ runner.os }}-${{ hashFiles('package-lock.json', 'tsconfig*.json', 'packages/*/tsconfig.json', 'src/**/*.ts', 'packages/*/src/**/*.ts') }}
restore-keys: |
tsbuild-${{ runner.os }}-

View file

@ -11,6 +11,7 @@ import { registerQueryTools } from "./query-tools.js";
import { registerHooks } from "./register-hooks.js";
import { registerShortcuts } from "./register-shortcuts.js";
import { writeCrashLog } from "./crash-log.js";
import { logWarning } from "../workflow-logger.js";
export { writeCrashLog } from "./crash-log.js";
@ -86,8 +87,9 @@ export function registerGsdExtension(pi: ExtensionAPI): void {
try {
register();
} catch (err) {
process.stderr.write(
`[gsd] Failed to register ${name}: ${err instanceof Error ? err.message : String(err)}\n`,
logWarning(
"bootstrap",
`Failed to register ${name}: ${err instanceof Error ? err.message : String(err)}`,
);
}
}

View file

@ -28,8 +28,10 @@ export default async function registerExtension(pi: ExtensionAPI) {
const { registerGsdExtension } = await import("./bootstrap/register-extension.js");
registerGsdExtension(pi);
} catch (err) {
process.stderr.write(
`[gsd] Extension setup partially failed — /gsd commands are available but shortcuts/tools may be missing: ${err instanceof Error ? err.message : String(err)}\n`,
const { logWarning } = await import("./workflow-logger.js");
logWarning(
"bootstrap",
`Extension setup partially failed — /gsd commands are available but shortcuts/tools may be missing: ${err instanceof Error ? err.message : String(err)}`,
);
}
}

View file

@ -58,14 +58,14 @@ describe("index.ts bootstrap isolation", () => {
);
});
test("writes to stderr on bootstrap failure", () => {
test("logs warning on bootstrap failure via workflow-logger", () => {
assert.ok(
indexSrc.includes("process.stderr.write"),
"must write to stderr when bootstrap fails",
indexSrc.includes("logWarning"),
"must use logWarning when bootstrap fails",
);
assert.ok(
indexSrc.includes("[gsd] Extension setup partially failed"),
"stderr message must indicate partial failure with /gsd still available",
indexSrc.includes("Extension setup partially failed"),
"warning message must indicate partial failure with /gsd still available",
);
});
});
@ -141,10 +141,14 @@ describe("register-extension.ts defensive registration", () => {
);
});
test("writes to stderr when a non-critical registration fails", () => {
test("logs warning when a non-critical registration fails", () => {
assert.ok(
registerExtSrc.includes("[gsd] Failed to register"),
"must write descriptive error to stderr for individual registration failures",
registerExtSrc.includes("Failed to register"),
"must log descriptive warning for individual registration failures",
);
assert.ok(
registerExtSrc.includes("logWarning"),
"must use logWarning from workflow-logger",
);
});
});