Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions packages/plugins/driver-memory/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.

import { defineConfig } from 'vitest/config';
import path from 'path';

export default defineConfig({
test: {
globals: true,
environment: 'node',
},
resolve: {
alias: {
'@objectstack/core': path.resolve(__dirname, '../../core/src/index.ts'),
'@objectstack/spec/api': path.resolve(__dirname, '../../spec/src/api/index.ts'),
'@objectstack/spec/contracts': path.resolve(__dirname, '../../spec/src/contracts/index.ts'),
'@objectstack/spec/data': path.resolve(__dirname, '../../spec/src/data/index.ts'),
'@objectstack/spec/kernel': path.resolve(__dirname, '../../spec/src/kernel/index.ts'),
'@objectstack/spec/system': path.resolve(__dirname, '../../spec/src/system/index.ts'),
'@objectstack/spec': path.resolve(__dirname, '../../spec/src/index.ts'),
},
},
});
9 changes: 6 additions & 3 deletions packages/plugins/plugin-auth/src/auth-plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ describe('AuthPlugin', () => {
it('should register routes with HTTP server on kernel:ready', async () => {
const mockRawApp = {
all: vi.fn(),
get: vi.fn(),
};

const mockHttpServer = {
Expand Down Expand Up @@ -173,6 +174,7 @@ describe('AuthPlugin', () => {
it('should log via ctx.logger when better-auth returns a 500 response', async () => {
const mockRawApp = {
all: vi.fn(),
get: vi.fn(),
};

const mockHttpServer = {
Expand Down Expand Up @@ -270,7 +272,7 @@ describe('AuthPlugin', () => {
});

it('should auto-detect baseUrl from http-server port when port differs', async () => {
const mockRawApp = { all: vi.fn() };
const mockRawApp = { all: vi.fn(), get: vi.fn() };
const mockHttpServer = {
post: vi.fn(), get: vi.fn(), put: vi.fn(), delete: vi.fn(),
patch: vi.fn(), use: vi.fn(),
Expand Down Expand Up @@ -306,7 +308,7 @@ describe('AuthPlugin', () => {
(mockContext.registerService as any).mockClear();
await localPlugin.init(mockContext);

const mockRawApp = { all: vi.fn() };
const mockRawApp = { all: vi.fn(), get: vi.fn() };
const mockHttpServer = {
post: vi.fn(), get: vi.fn(), put: vi.fn(), delete: vi.fn(),
patch: vi.fn(), use: vi.fn(),
Expand Down Expand Up @@ -338,7 +340,7 @@ describe('AuthPlugin', () => {
(mockContext.registerService as any).mockClear();
await localPlugin.init(mockContext);

const mockRawApp = { all: vi.fn() };
const mockRawApp = { all: vi.fn(), get: vi.fn() };
const mockHttpServer = {
post: vi.fn(), get: vi.fn(), put: vi.fn(), delete: vi.fn(),
patch: vi.fn(), use: vi.fn(),
Expand Down Expand Up @@ -400,6 +402,7 @@ describe('AuthPlugin', () => {

const mockRawApp = {
all: vi.fn(),
get: vi.fn(),
};

const mockHttpServer = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ vi.mock('./adapter', () => ({
close: vi.fn(),
getRawApp: vi.fn().mockReturnValue({
get: vi.fn(),
use: vi.fn(),
})
};
})
Expand Down
22 changes: 22 additions & 0 deletions packages/plugins/plugin-hono-server/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.

import { defineConfig } from 'vitest/config';
import path from 'path';

export default defineConfig({
test: {
globals: true,
environment: 'node',
},
resolve: {
alias: {
'@objectstack/core': path.resolve(__dirname, '../../core/src/index.ts'),
'@objectstack/spec/api': path.resolve(__dirname, '../../spec/src/api/index.ts'),
'@objectstack/spec/contracts': path.resolve(__dirname, '../../spec/src/contracts/index.ts'),
'@objectstack/spec/data': path.resolve(__dirname, '../../spec/src/data/index.ts'),
'@objectstack/spec/kernel': path.resolve(__dirname, '../../spec/src/kernel/index.ts'),
'@objectstack/spec/system': path.resolve(__dirname, '../../spec/src/system/index.ts'),
'@objectstack/spec': path.resolve(__dirname, '../../spec/src/index.ts'),
},
},
});
23 changes: 23 additions & 0 deletions packages/services/service-ai/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.

import { defineConfig } from 'vitest/config';
import path from 'path';

export default defineConfig({
test: {
globals: true,
environment: 'node',
},
resolve: {
alias: {
'@objectstack/core': path.resolve(__dirname, '../../core/src/index.ts'),
'@objectstack/spec/ai': path.resolve(__dirname, '../../spec/src/ai/index.ts'),
'@objectstack/spec/api': path.resolve(__dirname, '../../spec/src/api/index.ts'),
'@objectstack/spec/contracts': path.resolve(__dirname, '../../spec/src/contracts/index.ts'),
'@objectstack/spec/data': path.resolve(__dirname, '../../spec/src/data/index.ts'),
'@objectstack/spec/kernel': path.resolve(__dirname, '../../spec/src/kernel/index.ts'),
'@objectstack/spec/system': path.resolve(__dirname, '../../spec/src/system/index.ts'),
'@objectstack/spec': path.resolve(__dirname, '../../spec/src/index.ts'),
},
},
});
32 changes: 29 additions & 3 deletions packages/spec/scripts/build-schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,36 @@ function writeFileWithRetry(filePath: string, content: string, retries = MAX_RET
// Clean output directory ensures no stale files remain
if (fs.existsSync(OUT_DIR)) {
console.log(`Cleaning output directory: ${OUT_DIR}`);
fs.rmSync(OUT_DIR, { recursive: true, force: true, maxRetries: MAX_RETRIES, retryDelay: RETRY_DELAY_BASE_MS });


// Use a more robust cleanup with multiple retries and longer delays
// to handle filesystem race conditions in CI environments
for (let attempt = 0; attempt < MAX_RETRIES * 2; attempt++) {
try {
// Try removing with native Node.js rmSync
if (fs.existsSync(OUT_DIR)) {
fs.rmSync(OUT_DIR, { recursive: true, force: true, maxRetries: 5, retryDelay: RETRY_DELAY_BASE_MS * 2 });
}

// Verify the directory is actually gone
if (!fs.existsSync(OUT_DIR)) {
break;
}

// If still exists, wait before retrying with exponential backoff
sleepSync(RETRY_DELAY_BASE_MS * (attempt + 1));
} catch (error) {
// If this is the last attempt, log but continue (we'll try to work with what's there)
if (attempt === (MAX_RETRIES * 2 - 1)) {
console.warn(`Warning: Failed to fully clean directory after ${attempt + 1} attempts:`, error);
// Try to continue anyway - ensureDir will create missing parts
break;
}
// Wait before retry with exponential backoff
sleepSync(RETRY_DELAY_BASE_MS * (attempt + 1));
}
Comment on lines +107 to +109
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

The retry delays here are described as “exponential backoff”, but the current implementation is linear (100 * (attempt + 1)). Either adjust the delay calculation to be truly exponential (and preferably reuse RETRY_DELAY_BASE_MS instead of hard-coded 100/200/5), or update the comments/PR intent so the behavior matches what’s implemented.

Copilot uses AI. Check for mistakes.
}

// Wait a bit to ensure file system has synced
// This prevents ENOENT errors on some file systems, particularly in CI environments
sleepSync(FS_SYNC_DELAY_MS);
}

Expand Down
Loading