Skip to content

fix: resolve CI test failures in MetadataPlugin, auth trustedOrigins, client Hono test, and docs build#1153

Merged
xuyushun441-sys merged 4 commits intomainfrom
copilot/fix-ci-errors-3d6bc093-66e2-46d2-98de-a57c71b95500
Apr 15, 2026
Merged

fix: resolve CI test failures in MetadataPlugin, auth trustedOrigins, client Hono test, and docs build#1153
xuyushun441-sys merged 4 commits intomainfrom
copilot/fix-ci-errors-3d6bc093-66e2-46d2-98de-a57c71b95500

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 15, 2026

CI failures across four packages — fixes all test/build errors introduced or exposed by the better-auth CORS support merge (PR #1152).

MetadataPlugin driver bridging (packages/metadata/src/plugin.ts)

The driver.* service fallback was nested inside a catch block, only reached when ctx.getService('objectql') threw. When ObjectQL returned null (the common case when ObjectQL isn't loaded), execution fell through without ever scanning for driver services.

Restructured to use a driverBridged flag so the fallback runs whenever ObjectQL doesn't provide a driver — whether it returns null, doesn't resolve, or throws:

let driverBridged = false;
try {
    const ql = ctx.getService<any>('objectql');
    if (ql) {
        const driver = ql.getDriverForObject?.(tableName);
        if (driver) { this.manager.setDatabaseDriver(driver); driverBridged = true; }
    }
} catch { /* ObjectQL unavailable */ }

if (!driverBridged) {
    // scan for driver.* services
}

Auth trustedOrigins tests (packages/plugins/plugin-auth/src/auth-manager.test.ts)

PR #1152 added auto-default http://localhost:* to trustedOrigins when none are configured (development convenience for CSRF protection). Two tests still expected trustedOrigins to be absent in this case, causing AssertionError: expected { …(11) } to not have property "trustedOrigins".

Updated both tests to verify the new default ["http://localhost:*"] value is correctly set when trustedOrigins is not provided or is empty.

Docs build: lucide-react module resolution (apps/docs/next.config.mjs)

MDX content files in content/docs/ (at the monorepo root) import lucide-react icons, but Turbopack resolves modules starting from the file's directory. Since lucide-react is only installed in apps/docs/node_modules/, it's unreachable from the content directory, causing 33 Module not found: Can't resolve 'lucide-react' errors.

Added turbopack.resolveAlias in next.config.mjs to alias lucide-react to the app's local ./node_modules/lucide-react, allowing Turbopack to resolve the import from any file location.

Client Hono test timeout (packages/client/src/client.hono.test.ts)

The afterAll hook was hanging in CI because kernel.shutdown() awaits pinoLogger.flush(callback) internally, and pino's worker-thread transport callback may never fire in CI environments, causing the promise to hang indefinitely.

Fixed by racing kernel.shutdown() against a 10-second hard deadline using Promise.race(). The afterAll hook now always completes well within the 30s vitest limit, even when the pino flush hangs:

afterAll(async () => {
    if (kernel) {
        await Promise.race([
            kernel.shutdown(),
            new Promise<void>((resolve) => setTimeout(resolve, 10_000)),
        ]);
    }
}, 30_000);

… client test timeouts

Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/0c89186e-7d01-4390-b9c7-0e874e5dba72

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectstack-demo Ready Ready Preview, Comment Apr 15, 2026 0:02am
spec Ready Ready Preview, Comment Apr 15, 2026 0:02am

Request Review

@github-actions github-actions bot added size/s documentation Improvements or additions to documentation tests and removed size/s labels Apr 15, 2026
@xuyushun441-sys
Copy link
Copy Markdown
Contributor

@copilot ci test 还有很多报错。AssertionError: expected { …(11) } to not have property "trustedOrigins"

…ost wildcard behavior

Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/1b8ff0d3-1dc6-4600-93f4-466e46d2bc56

Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 15, 2026

@copilot ci test 还有很多报错。AssertionError: expected { …(11) } to not have property "trustedOrigins"

Fixed in 3042cf5. The trustedOrigins tests were out of sync with the auto-default http://localhost:* behavior added in PR #1152. Updated both tests to verify the expected default value instead of asserting the property is absent. All 77 plugin-auth tests pass now.

Note: @objectstack/studio#test has pre-existing failures on the main branch (CRUD pagination counts, metadata type expectations) — those are unrelated to this PR.

Copilot AI changed the title fix: MetadataPlugin driver bridging fallback + client test timeout fix: resolve CI test failures in MetadataPlugin, auth trustedOrigins, and client Hono test Apr 15, 2026
Copilot AI requested a review from xuyushun441-sys April 15, 2026 11:10
@xuyushun441-sys
Copy link
Copy Markdown
Contributor

fix ./content/docs/getting-started/architecture.mdx.js:410:1
Module not found: Can't resolve 'lucide-react'

@copilot

…ocs app directory

Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/03ea1b05-404b-40c7-a907-706e31be7a1c

Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 15, 2026

fix ./content/docs/getting-started/architecture.mdx.js:410:1
Module not found: Can't resolve 'lucide-react'

...

Fixed in 8ea42ee. The MDX content files in content/docs/ import lucide-react icons, but Turbopack resolves modules starting from the file's directory — which can't reach apps/docs/node_modules/. Added turbopack.resolveAlias in apps/docs/next.config.mjs to alias lucide-react to the app's local installation. Docs build now compiles successfully.

Copilot AI changed the title fix: resolve CI test failures in MetadataPlugin, auth trustedOrigins, and client Hono test fix: resolve CI test failures in MetadataPlugin, auth trustedOrigins, client Hono test, and docs build Apr 15, 2026
@xuyushun441-sys xuyushun441-sys marked this pull request as ready for review April 15, 2026 11:42
@xuyushun441-sys
Copy link
Copy Markdown
Contributor

@copilot src/client.hono.test.ts (3 tests) 30253ms
✓ should connect to hono server and discover endpoints 71ms
✓ should create and retrieve data via hono 63ms
✓ should find data via hono 23ms

⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯

FAIL src/client.hono.test.ts > ObjectStackClient (with Hono Server)
Error: Hook timed out in 30000ms.
If this is a long-running hook, pass a timeout value as the last argument or configure it globally with "hookTimeout".

…hang in CI

Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/3f029c4b-ebf6-4b3d-8bbc-00f3c9cb400e

Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 15, 2026

@copilot src/client.hono.test.ts (3 tests) 30253ms
✓ should connect to hono server and discover endpoints 71ms
✓ should create and retrieve data via hono 63ms
...

Fixed in 5e0777e. The afterAll hook was hanging because kernel.shutdown() awaits pinoLogger.flush(), whose callback may never fire in CI (worker-thread transport timing). Changed to race the shutdown against a 10s deadline so the hook always completes within the 30s vitest limit.

@xuyushun441-sys xuyushun441-sys merged commit 22a6454 into main Apr 15, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants