Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Remove unused 'measure' variable in native-sql-strategy.ts (TS6133) - Update nextjs adapter tests to match current dispatch() signature - Fix auth-plugin tests to reference correct AuthManager instance Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> Agent-Logs-Url: https://github.com/objectstack-ai/spec/sessions/39b2f206-d4bb-4357-98ac-f5f9e1466455
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com> Agent-Logs-Url: https://github.com/objectstack-ai/spec/sessions/39b2f206-d4bb-4357-98ac-f5f9e1466455
There was a problem hiding this comment.
Pull request overview
Fixes CI breakages on main by addressing a TypeScript unused-local build failure and updating failing tests to match current runtime behavior (notably the HttpDispatcher.dispatch() signature).
Changes:
- Removed an unused variable in
service-analyticsthat causedTS6133undernoUnusedLocals. - Updated Next.js adapter metadata API tests to assert against the current
dispatch(method, path, body, queryParams, context)call shape. - Stabilized
plugin-authtests by clearingregisterServicemock call history before re-initializing a local plugin instance. - Documented the fixes in
CHANGELOG.md.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 11 comments.
| File | Description |
|---|---|
| packages/services/service-analytics/src/strategies/native-sql-strategy.ts | Removes unused locals to unblock TypeScript build with strict unused checks. |
| packages/plugins/plugin-auth/src/auth-plugin.test.ts | Fixes stale assertions by ensuring registerService mock calls reference the intended plugin instance. |
| packages/adapters/nextjs/src/metadata-api.test.ts | Updates assertions to match current Next.js adapter → dispatcher call signature. |
| CHANGELOG.md | Records CI build/test fixes for traceability. |
| '/meta/views', | ||
| undefined, | ||
| {}, | ||
| expect.objectContaining({ request: expect.anything() }), | ||
| ); |
There was a problem hiding this comment.
This assertion hard-codes the query params arg to {}. Consider loosening it to expect.any(Object) / expect.objectContaining({}) to avoid brittleness if the adapter later adds default query keys.
| '/meta/agents', | ||
| undefined, | ||
| {}, | ||
| expect.objectContaining({ request: expect.anything() }), | ||
| ); |
There was a problem hiding this comment.
Query params are asserted as a literal {} here; consider expect.any(Object) / expect.objectContaining({}) to keep this test less coupled to internal query parsing details and aligned with other Next.js adapter tests.
| '/meta/objects/account/fields/name', | ||
| undefined, | ||
| {}, | ||
| expect.objectContaining({ request: expect.anything() }), | ||
| ); |
There was a problem hiding this comment.
This assertion fixes the dispatch signature, but it also hard-codes query params to {}. Using expect.any(Object) (as in packages/adapters/nextjs/src/nextjs.test.ts) makes the test more resilient if query parsing behavior changes.
| '/meta', | ||
| undefined, | ||
| {}, | ||
| expect.objectContaining({ request: expect.anything() }), | ||
| ); |
There was a problem hiding this comment.
Same as the other dispatch assertions: the query params argument is asserted as {}. Consider loosening this to expect.any(Object) / expect.objectContaining({}) to avoid test brittleness and keep consistency with other adapter tests.
| const registeredAuthManager = (mockContext.registerService as any).mock.calls[0][1]; | ||
| const setRuntimeSpy = vi.spyOn(registeredAuthManager, 'setRuntimeBaseUrl'); | ||
|
|
There was a problem hiding this comment.
Same as above: relying on registerService.mock.calls[0] assumes init() always registers the AuthManager first. Consider selecting the call where the first argument is 'auth' to keep this test resilient if service registration order changes.
| '/meta/flows', | ||
| undefined, | ||
| {}, | ||
| expect.objectContaining({ request: expect.anything() }), | ||
| ); |
There was a problem hiding this comment.
This test asserts the query params argument is exactly {}. For consistency with nextjs.test.ts and to reduce brittleness, prefer expect.any(Object) / expect.objectContaining({}).
| const registeredAuthManager = (mockContext.registerService as any).mock.calls[0][1]; | ||
| const setRuntimeSpy = vi.spyOn(registeredAuthManager, 'setRuntimeBaseUrl'); | ||
|
|
There was a problem hiding this comment.
Indexing into registerService.mock.calls[0][1] still relies on the ordering of init() registrations (currently auth first, then app.com.objectstack.system). To make the test more robust against future ordering changes, consider locating the call by service name (first arg === 'auth') rather than relying on [0].
| '/meta/objects/account', | ||
| undefined, | ||
| {}, | ||
| expect.objectContaining({ request: expect.anything() }), | ||
| ); |
There was a problem hiding this comment.
The 4th arg to dispatch() is the query params object; asserting a literal {} is brittle and differs from the pattern in packages/adapters/nextjs/src/nextjs.test.ts (uses expect.any(Object)). Consider loosening this assertion to avoid future failures if query parsing adds defaults.
| '/meta/objects', | ||
| body, | ||
| {}, | ||
| expect.objectContaining({ request: expect.anything() }), | ||
| ); |
There was a problem hiding this comment.
Same as above: using a literal {} for the query params arg makes the assertion more fragile than necessary. Prefer expect.any(Object) / expect.objectContaining({}) like other Next.js adapter tests.
| '/meta/objects/account', | ||
| body, | ||
| {}, | ||
| expect.objectContaining({ request: expect.anything() }), | ||
| ); |
There was a problem hiding this comment.
Same concern: the query params argument is asserted as {}. Using expect.any(Object) would keep this test consistent with other adapter tests and less sensitive to internal query parsing changes.
CI pipeline broken on
main— build fails in service-analytics (TS6133), tests fail in nextjs adapter and plugin-auth due to stale test assertions.Build fix
service-analytics/native-sql-strategy.ts: Remove unusedmeasurevariable that failsnoUnusedLocals: true. The variable was a leftover from copy-pasting the dimensions block — measures always hardcode type'number'.Test fixes
nextjs/metadata-api.test.ts(9 tests): Assertions used olddispatch(subPath, context, method, body)signature. Updated to match current implementation:plugin-auth/auth-plugin.test.ts(2 tests):.mock.calls.at(-1)[1]resolved to theapp.com.objectstack.systemservice object (secondregisterServicecall), not the AuthManager. AddedmockClear()beforelocalPlugin.init()somock.calls[0][1]reliably references the correct AuthManager instance.💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.