Skip to content

Commit 56066e4

Browse files
authored
Merge pull request #952 from objectstack-ai/copilot/fix-ci-build-test-errors
2 parents 2147c57 + a9ffb71 commit 56066e4

4 files changed

Lines changed: 42 additions & 22 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2323
remains lazy (cold-start only) via `ensureApp()` / `ensureKernel()` in `_kernel.ts`.
2424

2525
### Fixed
26+
- **Service-analytics build error (TS6133)** — Removed unused `measure` variable in
27+
`native-sql-strategy.ts` that caused the DTS build to fail with `noUnusedLocals` enabled,
28+
blocking the entire CI build pipeline.
29+
- **Next.js adapter test failures** — Updated 9 metadata API test assertions to match the
30+
current `dispatch(method, path, body, queryParams, context)` call signature used by the
31+
implementation. Tests were still expecting the old `dispatch(subPath, context, method, body)`
32+
signature.
33+
- **Auth plugin test failures** — Fixed 2 tests in `auth-plugin.test.ts` that referenced the
34+
wrong `AuthManager` instance via `registerService.mock.calls`. Added `mockClear()` before
35+
local plugin init to ensure `mock.calls[0]` points to the correct AuthManager for the test's
36+
plugin instance.
2637
- **SvelteKit adapter test failures** — Updated test mock to include `dispatch()` method and
2738
aligned Metadata, Data, Error handling, and toResponse test assertions with the unified
2839
catch-all dispatch pattern used by the implementation and all other adapters (e.g. Hono).

packages/adapters/nextjs/src/metadata-api.test.ts

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,11 @@ describe('Next.js Metadata API Integration Tests', () => {
127127
expect(res.status).toBe(200);
128128
expect(res.body.data).toHaveLength(2);
129129
expect(mockDispatcher.dispatch).toHaveBeenCalledWith(
130-
'objects',
131-
expect.objectContaining({ request: expect.anything() }),
132130
'GET',
131+
'/meta/objects',
133132
undefined,
133+
{},
134+
expect.objectContaining({ request: expect.anything() }),
134135
);
135136
});
136137
});
@@ -153,10 +154,11 @@ describe('Next.js Metadata API Integration Tests', () => {
153154
expect(res.status).toBe(200);
154155
expect(res.body.data.name).toBe('account');
155156
expect(mockDispatcher.dispatch).toHaveBeenCalledWith(
156-
'objects/account',
157-
expect.objectContaining({ request: expect.anything() }),
158157
'GET',
158+
'/meta/objects/account',
159159
undefined,
160+
{},
161+
expect.objectContaining({ request: expect.anything() }),
160162
);
161163
});
162164
});
@@ -178,10 +180,11 @@ describe('Next.js Metadata API Integration Tests', () => {
178180
const res = await handler(req, { params: { objectstack: ['meta', 'objects'] } });
179181
expect(res.status).toBe(201);
180182
expect(mockDispatcher.dispatch).toHaveBeenCalledWith(
181-
'objects',
182-
expect.objectContaining({ request: expect.anything() }),
183183
'POST',
184+
'/meta/objects',
184185
body,
186+
{},
187+
expect.objectContaining({ request: expect.anything() }),
185188
);
186189
});
187190
});
@@ -199,10 +202,11 @@ describe('Next.js Metadata API Integration Tests', () => {
199202
const res = await handler(req, { params: { objectstack: ['meta', 'objects', 'account'] } });
200203
expect(res.status).toBe(200);
201204
expect(mockDispatcher.dispatch).toHaveBeenCalledWith(
202-
'objects/account',
203-
expect.objectContaining({ request: expect.anything() }),
204205
'PUT',
206+
'/meta/objects/account',
205207
body,
208+
{},
209+
expect.objectContaining({ request: expect.anything() }),
206210
);
207211
});
208212
});
@@ -229,32 +233,35 @@ describe('Next.js Metadata API Integration Tests', () => {
229233
const req = makeReq('http://localhost/api/meta/views');
230234
await handler(req, { params: { objectstack: ['meta', 'views'] } });
231235
expect(mockDispatcher.dispatch).toHaveBeenCalledWith(
232-
'views',
233-
expect.objectContaining({ request: expect.anything() }),
234236
'GET',
237+
'/meta/views',
235238
undefined,
239+
{},
240+
expect.objectContaining({ request: expect.anything() }),
236241
);
237242
});
238243

239244
it('dispatches for flows', async () => {
240245
const req = makeReq('http://localhost/api/meta/flows');
241246
await handler(req, { params: { objectstack: ['meta', 'flows'] } });
242247
expect(mockDispatcher.dispatch).toHaveBeenCalledWith(
243-
'flows',
244-
expect.objectContaining({ request: expect.anything() }),
245248
'GET',
249+
'/meta/flows',
246250
undefined,
251+
{},
252+
expect.objectContaining({ request: expect.anything() }),
247253
);
248254
});
249255

250256
it('dispatches for agents', async () => {
251257
const req = makeReq('http://localhost/api/meta/agents');
252258
await handler(req, { params: { objectstack: ['meta', 'agents'] } });
253259
expect(mockDispatcher.dispatch).toHaveBeenCalledWith(
254-
'agents',
255-
expect.objectContaining({ request: expect.anything() }),
256260
'GET',
261+
'/meta/agents',
257262
undefined,
263+
{},
264+
expect.objectContaining({ request: expect.anything() }),
258265
);
259266
});
260267
});
@@ -684,10 +691,11 @@ describe('Next.js Metadata API Integration Tests', () => {
684691
const req = makeReq('http://localhost/api/meta/objects/account/fields/name');
685692
await handler(req, { params: { objectstack: ['meta', 'objects', 'account', 'fields', 'name'] } });
686693
expect(mockDispatcher.dispatch).toHaveBeenCalledWith(
687-
'objects/account/fields/name',
688-
expect.any(Object),
689694
'GET',
695+
'/meta/objects/account/fields/name',
690696
undefined,
697+
{},
698+
expect.objectContaining({ request: expect.anything() }),
691699
);
692700
});
693701

@@ -696,10 +704,11 @@ describe('Next.js Metadata API Integration Tests', () => {
696704
// With just ['meta'], subPath becomes empty after slice(1)
697705
await handler(req, { params: { objectstack: ['meta'] } });
698706
expect(mockDispatcher.dispatch).toHaveBeenCalledWith(
699-
'',
700-
expect.any(Object),
701707
'GET',
708+
'/meta',
702709
undefined,
710+
{},
711+
expect.objectContaining({ request: expect.anything() }),
703712
);
704713
});
705714
});

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ describe('AuthPlugin', () => {
299299
baseUrl: 'http://localhost:3000',
300300
});
301301
mockContext.hook = localHookCapture.hookFn;
302+
(mockContext.registerService as any).mockClear();
302303
await localPlugin.init(mockContext);
303304

304305
const mockRawApp = { all: vi.fn() };
@@ -314,7 +315,7 @@ describe('AuthPlugin', () => {
314315
throw new Error(`Service not found: ${name}`);
315316
});
316317

317-
const registeredAuthManager = (mockContext.registerService as any).mock.calls.at(-1)[1];
318+
const registeredAuthManager = (mockContext.registerService as any).mock.calls[0][1];
318319
const setRuntimeSpy = vi.spyOn(registeredAuthManager, 'setRuntimeBaseUrl');
319320

320321
await localPlugin.start(mockContext);
@@ -330,6 +331,7 @@ describe('AuthPlugin', () => {
330331
secret: 'test-secret-at-least-32-chars-long',
331332
});
332333
mockContext.hook = localHookCapture.hookFn;
334+
(mockContext.registerService as any).mockClear();
333335
await localPlugin.init(mockContext);
334336

335337
const mockRawApp = { all: vi.fn() };
@@ -345,7 +347,7 @@ describe('AuthPlugin', () => {
345347
throw new Error(`Service not found: ${name}`);
346348
});
347349

348-
const registeredAuthManager = (mockContext.registerService as any).mock.calls.at(-1)[1];
350+
const registeredAuthManager = (mockContext.registerService as any).mock.calls[0][1];
349351
const setRuntimeSpy = vi.spyOn(registeredAuthManager, 'setRuntimeBaseUrl');
350352

351353
await localPlugin.start(mockContext);

packages/services/service-analytics/src/strategies/native-sql-strategy.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,6 @@ export class NativeSQLStrategy implements AnalyticsStrategy {
176176
}
177177
if (query.measures) {
178178
for (const m of query.measures) {
179-
const fieldName = m.includes('.') ? m.split('.')[1] : m;
180-
const measure = cube.measures[fieldName];
181179
fields.push({ name: m, type: 'number' });
182180
}
183181
}

0 commit comments

Comments
 (0)