Skip to content

Fix TypeScript compilation errors in adapters - add AuthService type parameter - #592

Merged
hotlong merged 2 commits into
mainfrom
copilot/fix-build-and-test
Feb 10, 2026
Merged

Fix TypeScript compilation errors in adapters - add AuthService type parameter#592
hotlong merged 2 commits into
mainfrom
copilot/fix-build-and-test

Conversation

CopilotAI commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

TypeScript compilation failed in Hono, Next.js, and NestJS adapters because kernel.getService('auth') returned {} without a type parameter, preventing access to handleRequest().

Changes

  • Added AuthService interface defining handleRequest(request: Request): Promise<Response>
  • Updated getService() calls to use type parameter: getService<AuthService>('auth')

Example

// Before - TypeScript error: Property 'handleRequest' does not exist on type '{}'constauthService=kernel.getService('auth');if(authService&&typeofauthService.handleRequest==='function'){constresponse=awaitauthService.handleRequest(req);}// After - properly typedconstauthService=kernel.getService<AuthService>('auth');if(authService&&typeofauthService.handleRequest==='function'){constresponse=awaitauthService.handleRequest(req);}

Note

The AuthService interface is currently duplicated across the three adapters. Consider extracting to a shared types package in a follow-up.

Original prompt

fix build and test

The user has attached the following file paths as relevant context:

  • .github/copilot-instructions.md

Created from VS Code.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@vercel

vercelBot commented Feb 10, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
objectstack-playCanceledCanceledFeb 10, 2026 2:56pm
specCanceledCanceledFeb 10, 2026 2:56pm

Request Review

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
CopilotAI changed the title [WIP] Fix build and test issuesFix TypeScript compilation errors in adapters - add AuthService type parameterFeb 10, 2026
CopilotAI requested a review from hotlongFebruary 10, 2026 14:52
@hotlong
hotlong marked this pull request as ready for review February 10, 2026 15:01
CopilotAI review requested due to automatic review settings February 10, 2026 15:01
@hotlong
hotlong merged commit 5270146 into mainFeb 10, 2026
5 checks passed

CopilotAI 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

This PR fixes TypeScript compilation issues in the Hono, Next.js, and NestJS adapters by adding a local AuthService interface and using it as the type parameter to kernel.getService<AuthService>('auth'), enabling type-safe access to handleRequest().

Changes:

  • Added an AuthService interface (per adapter) defining handleRequest(request: Request): Promise<Response>.
  • Updated auth service lookups to getService<AuthService>('auth') in all three adapters.

Reviewed changes

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

FileDescription
packages/adapters/nextjs/src/index.tsAdds local AuthService type and uses typed getService<AuthService>('auth') for auth handling.
packages/adapters/nestjs/src/index.tsAdds local AuthService type and uses typed getService<AuthService>('auth') in the controller auth route.
packages/adapters/hono/src/index.tsAdds local AuthService type and uses typed getService<AuthService>('auth') in the auth route.

Comment on lines 71 to 74
// Try AuthPlugin service first (preferred path)
const authService = typeof options.kernel.getService === 'function'
? options.kernel.getService('auth')
? options.kernel.getService<AuthService>('auth')
: null;

CopilotAIFeb 10, 2026

Copy link

Choose a reason for hiding this comment

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

ObjectKernel.getService() throws when a service is missing (it does not return null/undefined). As written, calling getService<AuthService>('auth') will throw when the auth plugin/service isn’t registered, and the code will jump to the outer catch and return a 500, never reaching the legacy dispatcher fallback. Consider wrapping the getService call in a try/catch that treats the specific "service not found" error as a null authService so the fallback path can run.

Copilot uses AI. Check for mistakes.
Comment on lines 117 to 120
const kernel = this.service.getKernel();
const authService = typeof kernel.getService === 'function'
? kernel.getService('auth')
? kernel.getService<AuthService>('auth')
: null;

CopilotAIFeb 10, 2026

Copy link

Choose a reason for hiding this comment

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

ObjectKernel.getService() throws when a service is missing. If the auth plugin/service isn’t registered, getService<AuthService>('auth') will throw and the handler will return a 500 from the catch block, never reaching the legacy dispatcher.handleAuth(...) fallback. Wrap the getService lookup in a try/catch and treat the "service not found" case as null so the fallback can execute.

Copilot uses AI. Check for mistakes.
Comment on lines 76 to 80
// Try AuthPlugin service first (preferred path)
const authService = typeof options.kernel.getService === 'function'
? options.kernel.getService('auth')
? options.kernel.getService<AuthService>('auth')
: null;

CopilotAIFeb 10, 2026

Copy link

Choose a reason for hiding this comment

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

ObjectKernel.getService() throws when a service is missing. If the auth plugin/service isn’t registered, getService<AuthService>('auth') will throw and the route will return a 500 from the catch block, never reaching the legacy dispatcher.handleAuth(...) fallback. Wrap the getService call in a try/catch and treat the "service not found" case as null so fallback behavior works.

Copilot uses AI. Check for mistakes.
akarma-synetal pushed a commit to akarma-synetal/framework that referenced this pull request Aug 6, 2026
…e name (objectstack-ai#5510) (objectstack-ai#5531)
`naming/namespace-prefix` deduplicated every `PREFIXED_TYPES` entry on
`items[i].name` alone. For actions that is not the key they occupy: the
engine registers under `objectName:name` (`ObjectQLPlugin.actionObjectKey`,
falling back to the canonical object-less key `global`, objectstack-ai#3913), so one
package declaring one `log_call` per object holds one distinct key per
object and nothing shadows anything.
The bare-name dedup flagged that shape as an intra-package duplicate, with
noise growing linearly in the object count — 12 fixed warnings per
`objectstack lint` run on HotCRM (5 objects x 3 activity actions) — and its
"rename one" prescription would have broken the shared i18n keys the objectstack-ai#592
shape depends on.
Actions now dedup on `objectName:name`; the other six types keep bare-name
dedup and their message text byte-for-byte. Only `objectName` is read:
`ActionSchema` rejects `object`/`entity` outright with a rename
prescription, so a `??` chain here would only fossilize a spelling the
contract already refuses (Prime Directive objectstack-ai#12).
Genuine shadowing still warns — same `objectName`, two object-less actions,
and an action on an object literally named `global` meeting an object-less
one (which is why the fallback is the real `global` literal rather than an
inert sentinel). The action remedy now offers separating by `objectName`
before renaming.
Claude-Session: https://claude.ai/code/session_016FNvXhtSdnEGEfLEsMmvxh
Co-authored-by: Claude <noreply@anthropic.com>
Sign up for freeto 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

@hotlong