Replies: 1 comment
|
Confirmed 1:1 on master (c291e79), including the regression bisect:
Fix direction: mirror the soft-injection pattern this same plugin already uses for its |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
In
dsh-client-connection0.1.5-rc.x (verified on 0.1.5-rc.2),connection.rpc.handle(channel, handler)throwscannot get property "webServer" without injectfor every caller, so any third-party plugin that registers a dedicated RPC channel fails to boot. Declaringinject: ['webServer']in the calling plugin does not help.This worked in 0.1.2-rc.1 and broke in 0.1.5-rc.x.
Root cause
0.1.5-rc.x narrowed the connection plugin's own inject from
["webServer", "credentials"]to["credentials"], mounting only its own/apiroute inside a softctx.inject(["webServer"], ...)child fiber:But
HostConnectionService.register()— the path behindrpc.handle()used by third-party channels — still does:Cordis resolves service property access in the service's own fiber scope (the shadow/receiver mechanism):
ownerhere is the ctx captured byget rpc()(this.ctx), andowner.webServeris resolved against the client-connection fiber — which no longer injectswebServer. The fiber walk climbs to the root fiber and throwscannot get property "webServer" without inject.Because the lookup happens in the connection plugin's scope, nothing on the caller side (including
inject: ['connection', 'webServer']) can satisfy it. Empirically:['connection']['connection', 'webServer']ctx.inject(['connection','webServer'], c => c.connection.rpc.handle(...))Reproduction
Minimal cordis-level repro (cordis 4.0.2 + dsh-client-connection 0.1.5-rc.2):
Real-world impact: community plugins registering settings-page RPC channels (
dsh-pocket,dsh-notify-plugin,dsh-advisors) all crash the web profile boot:Suggested fix
register()should not resolvewebServerthroughowner. Mount channel routes through the connection plugin's own soft-injected webServer scope, e.g. queue channel registrations and flush them inside the existingctx.inject(["webServer"], webCtx => ...)block (which also fixes ordering for registrations that happen before/after webServer appears), keepingowner.effect(...)only for disposal bookkeeping:(Or collect pending routes on the service and have the existing
webCtxblock register/unregister them.)Workaround used by affected plugins meanwhile
Register the prefix route directly on
webServerfrom the plugin's own fiber —ctx.inject(['connection', 'webServer'], c => c.effect(() => c.webServer.register(route)))— keepingconnection.requestRejection(req)as the auth fence and replicating the client-request/server-response envelope bridge. This boots on both 0.1.2 and 0.1.5, but every plugin has to duplicate the envelope logic, so a core fix is still needed.All reactions