Skip to content

fix: resolve CI test failures across 6 packages - #1077

Merged
hotlong merged 4 commits into
mainfrom
copilot/fix-ci-build-test-errors-another-one
Apr 7, 2026
Merged

hotlong merged 4 commits into
mainfrom
copilot/fix-ci-build-test-errors-another-one

Conversation

Copilot AI commented Apr 7, 2026 •

Copy link
Copy Markdown
Contributor

Tests were out of sync with production code after recent changes to HttpDispatcher.dispatch() signature, AuthPlugin dependencies, and workspace dependency graph.

dispatch() prefix argument — nuxt, nextjs, fastify, sveltekit

HttpDispatcher.dispatch() now takes a 6th prefix argument, but adapter test assertions only checked 5 args. Added '/api' to all toHaveBeenCalledWith calls:

expect(mockDispatcher.dispatch).toHaveBeenCalledWith(
  'GET', '/meta/objects', undefined,
  expect.any(Object),
  expect.objectContaining({ request: expect.anything() }),
  '/api',  // ← was missing
);

service-ai SDK fallback test

@ai-sdk/openai is now resolvable as a transitive workspace dependency (via apps/studio), so the "SDK not installed" fallback test was hitting the success path instead. Fixed by mocking the dynamic imports with vi.doMock().

plugin-auth mock context

  • AuthPlugin.dependencies changed to ['com.objectstack.engine.objectql'] — updated assertion
  • AuthPlugin.init() now calls ctx.getService('manifest').register() — added mock manifest service to test context

@vercel

vercel Bot commented Apr 7, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
objectstack-play Ready Ready Preview, Comment Apr 7, 2026 6:20am
spec Ready Ready Preview, Comment Apr 7, 2026 6:20am

Request Review

Copilot AI and others added 2 commits April 7, 2026 06:01
…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>
…veltekit, 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>
Copilot AI changed the title [WIP] Fix all CI build and test errors fix: resolve CI test failures across 6 packages Apr 7, 2026
Copilot AI requested a review from hotlong April 7, 2026 06:14
@hotlong
hotlong marked this pull request as ready for review April 7, 2026 06:24
Copilot AI review requested due to automatic review settings April 7, 2026 06:24
@hotlong
hotlong merged commit db30cd1 into main Apr 7, 2026
3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes CI test failures by aligning multiple package test suites with recent runtime/plugin changes (notably HttpDispatcher.dispatch()’s 6th prefix arg, AuthPlugin dependency updates, and service-ai provider SDK fallback behavior) to keep the monorepo’s adapter/plugin/service tests consistent with production code.

Changes:

  • Updated adapter tests (Nuxt/Next.js/Fastify/SvelteKit) to assert the new 6th dispatch() argument (prefix, e.g. '/api').
  • Adjusted service-ai SDK-missing fallback test to reliably simulate missing provider SDKs using vi.doMock() and cleanup via vi.doUnmock().
  • Updated plugin-auth tests to reflect new dependencies and to provide a manifest service mock for init().

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/services/service-ai/src/tests/ai-service.test.ts Mocks provider SDK modules to force the “SDK missing” fallback path in auto-detection tests.
packages/plugins/plugin-auth/src/auth-plugin.test.ts Updates expected dependencies and adds manifest service mocking in the test context.
packages/adapters/sveltekit/src/sveltekit.test.ts Adds '/api' prefix argument to dispatch() assertion expectations.
packages/adapters/nuxt/src/nuxt.test.ts Adds '/api' prefix argument to dispatch() assertion expectations.
packages/adapters/nextjs/src/nextjs.test.ts Adds '/api' prefix argument to dispatch() assertion expectations.
packages/adapters/nextjs/src/metadata-api.test.ts Adds '/api' prefix argument to dispatch() assertion expectations across integration cases.
packages/adapters/fastify/src/fastify.test.ts Adds '/api' prefix argument to dispatch() assertion expectations.
CHANGELOG.md Documents the CI test fixes under “Unreleased → Fixed”.

Comment on lines +27 to +31
getService: vi.fn((name: string) => {
if (name === 'manifest') return { register: vi.fn() };
if (name === 'data') return undefined;
return undefined;
}),

Copilot AI Apr 7, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PluginContext.getService() is specified to throw when a service is missing (and the real kernel implementations do). This mock currently returns undefined for unknown services (including 'data'), which can mask incorrect service lookups and makes the test context diverge from production behavior. Consider having the mock throw by default and explicitly return only the services this test intends to provide (e.g. manifest), and if AuthPlugin is meant to support “no data engine” mode, simulate that by throwing for 'data' (and update the implementation accordingly).

Copilot uses AI. Check for mistakes.
Comment on lines +878 to +880
// Re-import the plugin module so it picks up the mocked imports
const { AIServicePlugin: FreshPlugin } = await import('../plugin.js');
const plugin = new FreshPlugin();

Copilot AI Apr 7, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says the module is re-imported “so it picks up the mocked imports”, but import('../plugin.js') will still return the cached module unless vi.resetModules() (or similar) is used. Either reset the module graph before re-importing, or drop the “fresh import” and just instantiate AIServicePlugin after setting vi.doMock(...) (the dynamic provider imports are what need mocking, not the plugin module load).

Suggested change
// Re-import the plugin module so it picks up the mocked imports
const { AIServicePlugin: FreshPlugin } = await import('../plugin.js');
const plugin = new FreshPlugin();
// The provider SDKs are dynamically imported during plugin initialization,
// so mocking those modules is sufficient; the plugin module itself does
// not need to be re-imported here.
const plugin = new AIServicePlugin();

Copilot uses AI. Check for mistakes.

This branch was successfully deployed

2 active deployments
Preview – spec — b98cac24 Deployed Apr 7, 2026 by vercel[bot]
Preview – objectstack-play — b98cac24 Deployed Apr 7, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants