Skip to content

Commit 6c336ba

Browse files
committed
fix(service-automation): read an absent objectql as no registry, the plugin's other optional reads' way
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibzCo6pa7SSUFmosQD8
1 parent cca7404 commit 6c336ba

1 file changed

Lines changed: 17 additions & 16 deletions

File tree

  • packages/services/service-automation/src

‎packages/services/service-automation/src/plugin.ts‎

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,23 @@ export function nonHostDeclaringPackageOf(
581581
return declaresSameProviderBinding(entry, declaration, stamp) ? undefined : { packageId: stamp, why: 'stored' };
582582
}
583583

584+
/**
585+
* The package registry ObjectQL serves, read where it is used, or `undefined`
586+
* when the host serves no ObjectQL: the installed manifests the customization
587+
* pair lookup reads (`installedManifestsOf`). Without one, no package is
588+
* installed, and every package is its own App. Absent is read the way this
589+
* plugin's other optional `objectql` reads it (`flowHistoryReader`, the
590+
* suspended-run store): a `getService` that throws is no service, whichever
591+
* kernel spelled the refusal.
592+
*/
593+
function objectqlRegistryOf(ctx: PluginContext): InstalledPackageSource | undefined {
594+
try {
595+
return ctx.getService<{ registry?: InstalledPackageSource }>('objectql')?.registry;
596+
} catch {
597+
return undefined;
598+
}
599+
}
600+
584601
/**
585602
* [#28713] Whether the kernel this plugin runs on dispatches its boot-phase
586603
* hooks (`kernel:bootstrapped` among them) once every plugin has started —
@@ -592,22 +609,6 @@ export function nonHostDeclaringPackageOf(
592609
* `start()` reconcile keeps every stored entry, so none waits for a pass that
593610
* never comes.
594611
*/
595-
/**
596-
* The package registry ObjectQL serves, read where it is used, or `undefined`
597-
* when no ObjectQL service is registered: the installed manifests the
598-
* customization pair lookup reads (`installedManifestsOf`). Without one, no
599-
* package is installed, and every package is its own App.
600-
*/
601-
function objectqlRegistryOf(ctx: PluginContext): InstalledPackageSource | undefined {
602-
try {
603-
return ctx.getService<{ registry?: InstalledPackageSource }>('objectql')?.registry;
604-
} catch (error) {
605-
// `getService` refuses a service no plugin registered: no registry.
606-
if (isServiceNotRegisteredError(error)) return undefined;
607-
throw error;
608-
}
609-
}
610-
611612
function kernelDispatchesBootPhaseHooks(ctx: PluginContext): boolean {
612613
let kernel: unknown;
613614
try {

0 commit comments

Comments
 (0)