From 9df9d7765ed4990362bcb13daed10fa2da0c490d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Apr 2026 05:43:03 +0000 Subject: [PATCH 1/4] Initial plan From da8db470ed62e80e9229c2b283199a4d6ca8e664 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Apr 2026 06:01:29 +0000 Subject: [PATCH 2/4] fix: add missing '/api' prefix arg to dispatch assertions in adapter tests Add the 6th 'prefix' argument ('/api') to all toHaveBeenCalledWith assertions for dispatcher.dispatch() in fastify, nextjs, and sveltekit adapter test files. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> --- packages/adapters/fastify/src/fastify.test.ts | 2 ++ packages/adapters/nextjs/src/metadata-api.test.ts | 9 +++++++++ packages/adapters/nextjs/src/nextjs.test.ts | 6 ++++++ packages/adapters/sveltekit/src/sveltekit.test.ts | 3 +++ 4 files changed, 20 insertions(+) diff --git a/packages/adapters/fastify/src/fastify.test.ts b/packages/adapters/fastify/src/fastify.test.ts index 3032fb0b9f..fecf0b68d4 100644 --- a/packages/adapters/fastify/src/fastify.test.ts +++ b/packages/adapters/fastify/src/fastify.test.ts @@ -96,6 +96,7 @@ describe('objectStackPlugin', () => { undefined, expect.any(Object), expect.objectContaining({ request: expect.anything() }), + '/api', ); }); @@ -112,6 +113,7 @@ describe('objectStackPlugin', () => { undefined, expect.any(Object), expect.objectContaining({ request: expect.anything() }), + '/api', ); }); diff --git a/packages/adapters/nextjs/src/metadata-api.test.ts b/packages/adapters/nextjs/src/metadata-api.test.ts index 2853084a3d..bf69b14837 100644 --- a/packages/adapters/nextjs/src/metadata-api.test.ts +++ b/packages/adapters/nextjs/src/metadata-api.test.ts @@ -132,6 +132,7 @@ describe('Next.js Metadata API Integration Tests', () => { undefined, {}, expect.objectContaining({ request: expect.anything() }), + '/api', ); }); }); @@ -159,6 +160,7 @@ describe('Next.js Metadata API Integration Tests', () => { undefined, {}, expect.objectContaining({ request: expect.anything() }), + '/api', ); }); }); @@ -185,6 +187,7 @@ describe('Next.js Metadata API Integration Tests', () => { body, {}, expect.objectContaining({ request: expect.anything() }), + '/api', ); }); }); @@ -207,6 +210,7 @@ describe('Next.js Metadata API Integration Tests', () => { body, {}, expect.objectContaining({ request: expect.anything() }), + '/api', ); }); }); @@ -238,6 +242,7 @@ describe('Next.js Metadata API Integration Tests', () => { undefined, {}, expect.objectContaining({ request: expect.anything() }), + '/api', ); }); @@ -250,6 +255,7 @@ describe('Next.js Metadata API Integration Tests', () => { undefined, {}, expect.objectContaining({ request: expect.anything() }), + '/api', ); }); @@ -262,6 +268,7 @@ describe('Next.js Metadata API Integration Tests', () => { undefined, {}, expect.objectContaining({ request: expect.anything() }), + '/api', ); }); }); @@ -696,6 +703,7 @@ describe('Next.js Metadata API Integration Tests', () => { undefined, {}, expect.objectContaining({ request: expect.anything() }), + '/api', ); }); @@ -709,6 +717,7 @@ describe('Next.js Metadata API Integration Tests', () => { undefined, {}, expect.objectContaining({ request: expect.anything() }), + '/api', ); }); }); diff --git a/packages/adapters/nextjs/src/nextjs.test.ts b/packages/adapters/nextjs/src/nextjs.test.ts index 024c09960f..b7e0a5b236 100644 --- a/packages/adapters/nextjs/src/nextjs.test.ts +++ b/packages/adapters/nextjs/src/nextjs.test.ts @@ -284,6 +284,7 @@ describe('createRouteHandler', () => { undefined, expect.any(Object), expect.objectContaining({ request: expect.anything() }), + '/api', ); }); @@ -299,6 +300,7 @@ describe('createRouteHandler', () => { body, expect.any(Object), expect.objectContaining({ request: expect.anything() }), + '/api', ); }); @@ -314,6 +316,7 @@ describe('createRouteHandler', () => { body, expect.any(Object), expect.objectContaining({ request: expect.anything() }), + '/api', ); }); }); @@ -330,6 +333,7 @@ describe('createRouteHandler', () => { undefined, expect.any(Object), expect.objectContaining({ request: expect.anything() }), + '/api', ); }); @@ -345,6 +349,7 @@ describe('createRouteHandler', () => { body, expect.any(Object), expect.objectContaining({ request: expect.anything() }), + '/api', ); }); @@ -360,6 +365,7 @@ describe('createRouteHandler', () => { body, expect.any(Object), expect.objectContaining({ request: expect.anything() }), + '/api', ); }); diff --git a/packages/adapters/sveltekit/src/sveltekit.test.ts b/packages/adapters/sveltekit/src/sveltekit.test.ts index 086e2ddb6c..7593fc798d 100644 --- a/packages/adapters/sveltekit/src/sveltekit.test.ts +++ b/packages/adapters/sveltekit/src/sveltekit.test.ts @@ -176,6 +176,7 @@ describe('createRequestHandler', () => { undefined, expect.any(Object), expect.objectContaining({ request: expect.anything() }), + '/api', ); }); }); @@ -191,6 +192,7 @@ describe('createRequestHandler', () => { undefined, expect.any(Object), expect.objectContaining({ request: expect.anything() }), + '/api', ); }); @@ -205,6 +207,7 @@ describe('createRequestHandler', () => { body, expect.any(Object), expect.objectContaining({ request: expect.anything() }), + '/api', ); }); From 088209ae02be3b8784ae20c70a73becdf225fad4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Apr 2026 06:06:14 +0000 Subject: [PATCH 3/4] fix: resolve CI test failures in service-ai, nuxt, nextjs, fastify, sveltekit, and plugin-auth - service-ai: mock @ai-sdk/openai dynamic import for SDK fallback test - nuxt, nextjs, fastify, sveltekit: add missing prefix arg to dispatch assertions - plugin-auth: update dependencies assertion and mock manifest service Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/faa63a9f-127e-42d7-8e7f-a2a058ddde10 Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> --- packages/adapters/nuxt/src/nuxt.test.ts | 2 ++ .../plugins/plugin-auth/src/auth-plugin.test.ts | 8 ++++++-- .../service-ai/src/__tests__/ai-service.test.ts | 14 +++++++++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/packages/adapters/nuxt/src/nuxt.test.ts b/packages/adapters/nuxt/src/nuxt.test.ts index 8ca9cc387e..d4efb3b733 100644 --- a/packages/adapters/nuxt/src/nuxt.test.ts +++ b/packages/adapters/nuxt/src/nuxt.test.ts @@ -106,6 +106,7 @@ describe('createH3Router', () => { undefined, expect.any(Object), expect.objectContaining({ request: expect.anything() }), + '/api', ); }); @@ -119,6 +120,7 @@ describe('createH3Router', () => { undefined, expect.any(Object), expect.objectContaining({ request: expect.anything() }), + '/api', ); }); diff --git a/packages/plugins/plugin-auth/src/auth-plugin.test.ts b/packages/plugins/plugin-auth/src/auth-plugin.test.ts index bf05513681..cd9855fc00 100644 --- a/packages/plugins/plugin-auth/src/auth-plugin.test.ts +++ b/packages/plugins/plugin-auth/src/auth-plugin.test.ts @@ -24,7 +24,11 @@ describe('AuthPlugin', () => { beforeEach(() => { mockContext = { registerService: vi.fn(), - getService: vi.fn(), + getService: vi.fn((name: string) => { + if (name === 'manifest') return { register: vi.fn() }; + if (name === 'data') return undefined; + return undefined; + }), getServices: vi.fn(() => new Map()), hook: vi.fn(), trigger: vi.fn(), @@ -47,7 +51,7 @@ describe('AuthPlugin', () => { expect(authPlugin.name).toBe('com.objectstack.auth'); expect(authPlugin.type).toBe('standard'); expect(authPlugin.version).toBe('1.0.0'); - expect(authPlugin.dependencies).toEqual([]); + expect(authPlugin.dependencies).toEqual(['com.objectstack.engine.objectql']); }); }); diff --git a/packages/services/service-ai/src/__tests__/ai-service.test.ts b/packages/services/service-ai/src/__tests__/ai-service.test.ts index 4ba88c2007..c61803fe0d 100644 --- a/packages/services/service-ai/src/__tests__/ai-service.test.ts +++ b/packages/services/service-ai/src/__tests__/ai-service.test.ts @@ -868,7 +868,16 @@ describe('AIServicePlugin', () => { }); it('should fallback to MemoryLLMAdapter when provider SDK is not installed', async () => { - const plugin = new AIServicePlugin(); + // Mock all provider SDKs to simulate them not being installed. + // In the workspace @ai-sdk/openai may be resolvable as a transitive + // dependency, so we must explicitly make the dynamic import fail. + vi.doMock('@ai-sdk/openai', () => { throw new Error('Cannot find module \'@ai-sdk/openai\''); }); + vi.doMock('@ai-sdk/anthropic', () => { throw new Error('Cannot find module \'@ai-sdk/anthropic\''); }); + vi.doMock('@ai-sdk/google', () => { throw new Error('Cannot find module \'@ai-sdk/google\''); }); + + // Re-import the plugin module so it picks up the mocked imports + const { AIServicePlugin: FreshPlugin } = await import('../plugin.js'); + const plugin = new FreshPlugin(); const ctx = createMockContext(); const oldEnv = { ...process.env }; @@ -897,6 +906,9 @@ describe('AIServicePlugin', () => { ); } finally { process.env = oldEnv; + vi.doUnmock('@ai-sdk/openai'); + vi.doUnmock('@ai-sdk/anthropic'); + vi.doUnmock('@ai-sdk/google'); } }); From b98cac240c2ed455b4c1af7ae5d5bcdfdb720093 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Apr 2026 06:13:20 +0000 Subject: [PATCH 4/4] docs: update CHANGELOG.md with CI test fix details Agent-Logs-Url: https://github.com/objectstack-ai/framework/sessions/faa63a9f-127e-42d7-8e7f-a2a058ddde10 Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b9e64934a..405f32b142 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed +- **CI Test Failures** — Resolved test failures across multiple packages: + - `@objectstack/service-ai`: Fixed SDK fallback test by mocking `@ai-sdk/openai` dynamic import + (SDK now available as transitive workspace dependency) + - `@objectstack/nuxt`, `@objectstack/nextjs`, `@objectstack/fastify`, `@objectstack/sveltekit`: + Added missing `prefix` argument to `dispatch()` assertion calls in adapter tests + - `@objectstack/plugin-auth`: Updated `dependencies` assertion and added `manifest` service mock + to match current plugin implementation + ### Added - **AIServicePlugin Auto-Detection** — AIServicePlugin now automatically detects and initializes LLM providers based on environment variables, eliminating the need for manual adapter configuration