Skip to content

Commit 22a6454

Browse files
Merge pull request #1153 from objectstack-ai/copilot/fix-ci-errors-3d6bc093-66e2-46d2-98de-a57c71b95500
fix: resolve CI test failures in MetadataPlugin, auth trustedOrigins, client Hono test, and docs build
2 parents 1f4dabd + 5e0777e commit 22a6454

File tree

5 files changed

+36
-8
lines changed

5 files changed

+36
-8
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2626
- Preserved skill independence — Each skill remains independently installable/referenceable (no global routing required)
2727

2828
### Fixed
29+
- **MetadataPlugin driver bridging fallback** — Fixed `MetadataPlugin.start()` so the driver service scan fallback (`driver.*`) is reached when ObjectQL returns `null` (not just when it throws). Previously, `setDatabaseDriver` was never called in environments where ObjectQL was not loaded.
30+
- **Auth trustedOrigins test alignment** — Updated `plugin-auth` tests to match the auto-default `http://localhost:*` behavior added in PR #1152 for better-auth CORS support. When no `trustedOrigins` are configured, the implementation correctly defaults to trusting all localhost ports for development convenience.
31+
- **Docs build: lucide-react module resolution** — Added Turbopack `resolveAlias` in `apps/docs/next.config.mjs` so MDX content files in `content/docs/` (outside the app directory) can resolve `lucide-react`. Turbopack starts module resolution from the file's directory, which doesn't have access to the app's `node_modules/`.
32+
- **Client Hono integration test timeout** — Fixed `afterAll` hook timeout in `client.hono.test.ts` by racing `kernel.shutdown()` against a 10s deadline. The shutdown can hang when pino's worker-thread flush callback never fires in CI, so the race ensures the hook completes within the 30s vitest limit.
2933
- **CI: Replace `pnpm/action-setup@v6` with corepack** — Switched all GitHub Actions workflows (`ci.yml`, `lint.yml`, `release.yml`, `validate-deps.yml`, `pr-automation.yml`) from `pnpm/action-setup@v6` to `corepack enable` to fix persistent `ERR_PNPM_BROKEN_LOCKFILE` errors. Corepack reads the exact `packageManager` field from `package.json` (including SHA verification), ensuring the correct pnpm version is used in CI. Also bumped pnpm store cache keys to v3 and added a pnpm version verification step.
3034
- **Broken pnpm lockfile** — Regenerated `pnpm-lock.yaml` from scratch to fix `ERR_PNPM_BROKEN_LOCKFILE` ("expected a single document in the stream, but found more") that was causing all CI jobs to fail. The previous merge of PR #1117 only included workflow cache key changes but did not carry over the regenerated lockfile.
3135
- **service-ai: Fix navigation item labels using deprecated i18n object format** — Replaced `{ key, defaultValue }` i18n objects with plain string labels in `AIServicePlugin`'s Setup App navigation contributions, completing the `I18nLabelSchema` migration from [#1054](https://github.com/objectstack-ai/framework/issues/1054).

apps/docs/next.config.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ const config = {
99
typescript: {
1010
ignoreBuildErrors: false,
1111
},
12+
turbopack: {
13+
resolveAlias: {
14+
// MDX content lives in ../../content/docs/ (outside the app directory).
15+
// Turbopack resolves modules starting from the file's directory, so it
16+
// can't find packages installed under this app's node_modules/.
17+
// Alias lucide-react so external MDX files can import it.
18+
'lucide-react': './node_modules/lucide-react',
19+
},
20+
},
1221
images: {
1322
remotePatterns: [
1423
{

packages/client/src/client.hono.test.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,19 @@ describe('ObjectStackClient (with Hono Server)', () => {
107107
baseUrl = `http://localhost:${port}`;
108108

109109
console.log(`Test server running at ${baseUrl}`);
110-
});
110+
}, 30_000);
111111

112112
afterAll(async () => {
113-
if (kernel) await kernel.shutdown();
114-
});
113+
if (kernel) {
114+
// Race shutdown against a hard deadline.
115+
// kernel.shutdown() can hang when pino's flush callback never fires
116+
// in CI (worker-thread transport timing issues), so cap the wait.
117+
await Promise.race([
118+
kernel.shutdown(),
119+
new Promise<void>((resolve) => setTimeout(resolve, 10_000)),
120+
]);
121+
}
122+
}, 30_000);
115123

116124
it('should connect to hono server and discover endpoints', async () => {
117125
const client = new ObjectStackClient({ baseUrl });

packages/metadata/src/plugin.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ export class MetadataPlugin implements Plugin {
107107
// Bridge database driver from kernel service registry to MetadataManager.
108108
// Uses ObjectQL engine's datasource mapping to resolve the correct driver
109109
// for sys_metadata (respects namespace → datasource routing).
110+
// Falls back to the first available driver.* service when ObjectQL is unavailable.
111+
let driverBridged = false;
110112
try {
111113
const ql = ctx.getService<any>('objectql');
112114
if (ql) {
@@ -118,12 +120,17 @@ export class MetadataPlugin implements Plugin {
118120
driver: driver.name,
119121
});
120122
this.manager.setDatabaseDriver(driver);
123+
driverBridged = true;
121124
} else {
122125
ctx.logger.debug('[MetadataPlugin] ObjectQL could not resolve driver for metadata table', { tableName });
123126
}
124127
}
125128
} catch {
126-
// ObjectQL not available — fall back to first available driver service
129+
// ObjectQL not available — will fall through to driver service fallback below
130+
}
131+
132+
// Fallback: scan for driver.* services when ObjectQL didn't provide a driver
133+
if (!driverBridged) {
127134
try {
128135
const services = ctx.getServices();
129136
for (const [serviceName, service] of services) {

packages/plugins/plugin-auth/src/auth-manager.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ describe('AuthManager', () => {
434434
]);
435435
});
436436

437-
it('should NOT include trustedOrigins key when not provided', () => {
437+
it('should default to localhost wildcard when trustedOrigins not provided', () => {
438438
let capturedConfig: any;
439439
(betterAuth as any).mockImplementation((config: any) => {
440440
capturedConfig = config;
@@ -449,10 +449,10 @@ describe('AuthManager', () => {
449449
manager.getAuthInstance();
450450
warnSpy.mockRestore();
451451

452-
expect(capturedConfig).not.toHaveProperty('trustedOrigins');
452+
expect(capturedConfig.trustedOrigins).toEqual(['http://localhost:*']);
453453
});
454454

455-
it('should NOT include trustedOrigins key when array is empty', () => {
455+
it('should default to localhost wildcard when trustedOrigins array is empty', () => {
456456
let capturedConfig: any;
457457
(betterAuth as any).mockImplementation((config: any) => {
458458
capturedConfig = config;
@@ -468,7 +468,7 @@ describe('AuthManager', () => {
468468
manager.getAuthInstance();
469469
warnSpy.mockRestore();
470470

471-
expect(capturedConfig).not.toHaveProperty('trustedOrigins');
471+
expect(capturedConfig.trustedOrigins).toEqual(['http://localhost:*']);
472472
});
473473
});
474474

0 commit comments

Comments
 (0)