refactor(realtime, systemNotices, addons, airports, audit, categories, permissions, query-helpers, tags, transit, trip-membership): async DB-touching methods; transactions through UnitOfWork

This commit is contained in:
jubnl
2026-09-21 20:48:03 +02:00
parent 27d044f9e8
commit 0cf99a9939
306 changed files with 3656 additions and 3189 deletions
@@ -36,10 +36,10 @@ describe('parseDependencies', () => {
});
describe('disabledRequiredAddons', () => {
it('lists only the disabled required addons', () => {
it('lists only the disabled required addons', async () => {
const deps = parseDependencies(JSON.stringify({ requiredAddons: ['budget', 'journey'], pluginDependencies: [] }));
expect(disabledRequiredAddons(deps, (a) => a === 'budget')).toEqual(['journey']);
expect(disabledRequiredAddons(deps, () => true)).toEqual([]);
expect(await disabledRequiredAddons(deps, (a) => Promise.resolve(a === 'budget'))).toEqual(['journey']);
expect(await disabledRequiredAddons(deps, () => Promise.resolve(true))).toEqual([]);
});
});
+5 -5
View File
@@ -75,7 +75,7 @@ import type { RpcError, RpcResponse } from '../../../src/nest/plugins/protocol/e
// Typed from the real method rather than from the always-true body below, so a case that
// swaps in an implementation reading the action key (HOSTRPC-015) still type-checks.
const checkPermission = vi.fn<PermissionsService['checkPermission']>(() => true);
const checkPermission = vi.fn<PermissionsService['checkPermission']>(() => Promise.resolve(true));
const permissions = { checkPermission } as unknown as PermissionsService;
const addons = { isAddonEnabled: vi.fn(() => true) } as unknown as AddonsService;
const notifications = { send: notifySend } as unknown as NotificationsService;
@@ -255,7 +255,7 @@ describe('DbRpc — the unconditional three', () => {
describe('MetaRpc — namespaced entity metadata', () => {
beforeEach(() => {
checkPermission.mockReset();
checkPermission.mockReturnValue(true);
checkPermission.mockResolvedValue(true);
});
afterAll(() => closePluginDataDb('meta'));
@@ -315,7 +315,7 @@ describe('MetaRpc — namespaced entity metadata', () => {
const seen: string[] = [];
checkPermission.mockImplementation((action) => {
seen.push(action);
return true;
return Promise.resolve(true);
});
for (const [entityType, entityId] of [['trip', 1], ['place', 7], ['day', 3], ['reservation', 40], ['accommodation', 11]] as const) {
expect((await call(host, 'meta.set', { entityType, entityId, key: 'k', value: 1 })).ok).toBe(true);
@@ -323,7 +323,7 @@ describe('MetaRpc — namespaced entity metadata', () => {
// Accommodations deliberately ride on day_edit, like the accommodation write path.
expect(seen).toEqual(['trip_edit', 'place_edit', 'day_edit', 'reservation_edit', 'day_edit']);
checkPermission.mockReturnValue(false);
checkPermission.mockResolvedValue(false);
const write = await call(host, 'meta.set', { entityType: 'trip', entityId: 1, key: 'k', value: 2 });
expect(write.error?.code).toBe('RESOURCE_FORBIDDEN');
// …but a READ is only access-gated, so it still works for the same user.
@@ -359,7 +359,7 @@ describe('MetaRpc — namespaced entity metadata', () => {
describe('HostSurfaceRpc — users, broadcasts, notify, ai, oauth, scheduler', () => {
beforeEach(() => {
checkPermission.mockReset();
checkPermission.mockReturnValue(true);
checkPermission.mockResolvedValue(true);
notifySend.mockClear();
llmExtract.mockClear();
broadcast.mockClear();
@@ -47,30 +47,30 @@ describe('setPluginMcpToolSource', () => {
});
describe('registerTools wiring', () => {
it('MCPSINK-003: passes no dynamic source when none is registered', () => {
it('MCPSINK-003: passes no dynamic source when none is registered', async () => {
const { attach, registry } = spyRegistry();
registerTools(registry, new McpServer({ name: 't', version: '1' }), 1, null);
await registerTools(registry, new McpServer({ name: 't', version: '1' }), 1, null);
expect(attach.mock.calls[0][2]).toEqual({ onInvoke: undefined, dynamicTools: undefined });
});
it('MCPSINK-004: passes the registered source through to attach', () => {
it('MCPSINK-004: passes the registered source through to attach', async () => {
const source = (_ctx: McpContext) => [echo];
setPluginMcpToolSource(source);
const { attach, registry } = spyRegistry();
registerTools(registry, new McpServer({ name: 't', version: '1' }), 1, null);
await registerTools(registry, new McpServer({ name: 't', version: '1' }), 1, null);
expect(attach.mock.calls[0][2].dynamicTools).toBe(source);
});
it('MCPSINK-005: an explicit argument wins over the process-level source', () => {
it('MCPSINK-005: an explicit argument wins over the process-level source', async () => {
setPluginMcpToolSource(() => [echo]);
const explicit = () => [];
const { attach, registry } = spyRegistry();
registerTools(registry, new McpServer({ name: 't', version: '1' }), 1, null, false, undefined, undefined, explicit);
await registerTools(registry, new McpServer({ name: 't', version: '1' }), 1, null, false, undefined, undefined, explicit);
expect(attach.mock.calls[0][2].dynamicTools).toBe(explicit);
});
@@ -42,11 +42,11 @@ function install(id: string, operatorEgress: boolean, perms: string[] = ['http:o
let rt: PluginRuntimeService;
beforeAll(() => { createTables(testDb); runMigrations(testDb); });
beforeEach(() => {
beforeEach(async () => {
testDb.prepare('DELETE FROM plugins').run();
testDb.prepare('DELETE FROM plugin_egress_hosts').run();
testDb.prepare('DELETE FROM plugin_actions').run();
rt = createPluginRuntime(new DatabaseService(dbConn));
rt = await createPluginRuntime(new DatabaseService(dbConn));
});
describe('operator-supplied egress hosts', () => {
@@ -172,18 +172,18 @@ describe('the admin list surfaces operator egress (so the chip can be shown)', (
// list() resolves required-addon dependencies through AddonsService, so it gets a real
// one over the same DB. These fixtures declare no dependencies, so it is never consulted.
const listPlugins = () => {
const listPlugins = async () => {
const dbs = new DatabaseService(dbConn);
return new PluginsService(dbs, new AddonsService(dbs)).list().plugins;
return (await new PluginsService(dbs, new AddonsService(dbs)).list()).plugins;
};
const before = listPlugins();
const before = await listPlugins();
expect(before.find(p => p.id === 'gotify')).toMatchObject({ operatorEgress: true, egressHostCount: 0 });
// A plugin that never asked for it must never invite the admin to add hosts.
expect(before.find(p => p.id === 'plain')).toMatchObject({ operatorEgress: false, egressHostCount: 0 });
await rt.setOperatorEgressHosts('gotify', ['a.example.com', 'b.example.com']);
const after = listPlugins();
const after = await listPlugins();
expect(after.find(p => p.id === 'gotify')!.egressHostCount).toBe(2);
delete process.env.TREK_PLUGINS_ENABLED;
});
+18 -24
View File
@@ -96,61 +96,55 @@ describe('PluginGuards — requireActor', () => {
});
describe('PluginGuards — requireTripEdit and canEditAs', () => {
it('PGUARD-008 passes when the user may access and edit', () => {
it('PGUARD-008 passes when the user may access and edit', async () => {
const { guards, permissions } = build({ allow: true });
expect(() => guards.requireTripEdit(1, 42, 'trip_edit')).not.toThrow();
await expect(guards.requireTripEdit(1, 42, 'trip_edit')).resolves.not.toThrow();
expect(permissions.checkPermission).toHaveBeenCalledWith('trip_edit', 'user', 42, 42, false);
});
it('PGUARD-009 no access wins over no permission, and names the trip', () => {
it('PGUARD-009 no access wins over no permission, and names the trip', async () => {
const { guards } = build({ allow: false });
expect(() => guards.requireTripEdit(2, 42, 'trip_edit')).toThrow(
new ForbiddenResource('no access to trip 2'),
);
await expect(guards.requireTripEdit(2, 42, 'trip_edit')).rejects.toThrow(new ForbiddenResource('no access to trip 2'));
});
it('PGUARD-010 access without the edit permission is a different message', () => {
it('PGUARD-010 access without the edit permission is a different message', async () => {
const { guards } = build({ allow: false });
expect(() => guards.requireTripEdit(1, 42, 'trip_edit')).toThrow(
new ForbiddenResource('no permission to edit trip 1'),
);
await expect(guards.requireTripEdit(1, 42, 'trip_edit')).rejects.toThrow(new ForbiddenResource('no permission to edit trip 1'));
});
it('PGUARD-011 canEditAs returns false rather than throwing when there is no access', () => {
expect(build().guards.canEditAs('trip_edit', 2, 42)).toBe(false);
it('PGUARD-011 canEditAs returns false rather than throwing when there is no access', async () => {
expect(await build().guards.canEditAs('trip_edit', 2, 42)).toBe(false);
});
it('PGUARD-012 canEditAs returns false when the user row is gone', () => {
expect(build({ role: undefined }).guards.canEditAs('trip_edit', 1, 42)).toBe(false);
it('PGUARD-012 canEditAs returns false when the user row is gone', async () => {
expect(await build({ role: undefined }).guards.canEditAs('trip_edit', 1, 42)).toBe(false);
});
it('PGUARD-013 a missing role column falls back to "user"', () => {
it('PGUARD-013 a missing role column falls back to "user"', async () => {
const { guards, permissions } = build({ role: null as unknown as string });
guards.canEditAs('trip_edit', 1, 42);
await guards.canEditAs('trip_edit', 1, 42);
expect(permissions.checkPermission).toHaveBeenCalledWith('trip_edit', 'user', 42, 42, false);
});
it('PGUARD-014 a non-owner member is flagged as shared', () => {
it('PGUARD-014 a non-owner member is flagged as shared', async () => {
const db = {
canAccessTrip: vi.fn(() => ({ id: 1, user_id: 7 })),
prepare: vi.fn(() => ({ get: () => ({ role: 'user' }) })),
} as unknown as DatabaseService;
const permissions = { checkPermission: vi.fn(() => true) } as unknown as PermissionsService;
const guards = new PluginGuards(db, permissions, {} as AddonsService);
guards.canEditAs('trip_edit', 1, 42);
await guards.canEditAs('trip_edit', 1, 42);
expect(permissions.checkPermission).toHaveBeenCalledWith('trip_edit', 'user', 7, 42, true);
});
});
describe('PluginGuards — requireAddon', () => {
it('PGUARD-015 an enabled addon passes', () => {
expect(() => build({ addonOn: true }).guards.requireAddon('budget', 'costs')).not.toThrow();
it('PGUARD-015 an enabled addon passes', async () => {
await expect(build({ addonOn: true }).guards.requireAddon('budget', 'costs')).resolves.not.toThrow();
});
it('PGUARD-016 a disabled addon is refused with the noun in the message', () => {
expect(() => build({ addonOn: false }).guards.requireAddon('budget', 'costs')).toThrow(
new ForbiddenResource('the costs addon is disabled'),
);
it('PGUARD-016 a disabled addon is refused with the noun in the message', async () => {
await expect(build({ addonOn: false }).guards.requireAddon('budget', 'costs')).rejects.toThrow(new ForbiddenResource('the costs addon is disabled'));
});
});
@@ -109,19 +109,19 @@ describe('instance settings fields', () => {
expect(svc().instanceSettingsFields('p')[0].options).toEqual(['fast', 'slow']);
});
it('INS-003 — the admin list carries the instance-field count (gates the menu item)', () => {
it('INS-003 — the admin list carries the instance-field count (gates the menu item)', async () => {
install('with-fields');
install('plain');
declareField('with-fields', 'apiKey', 'instance', { secret: true });
declareField('with-fields', 'apiUrl', 'instance');
declareField('with-fields', 'units', 'user'); // user fields must not count
const plugins = svc().list().plugins;
const plugins = (await svc().list()).plugins;
expect(plugins.find((p) => p.id === 'with-fields')).toMatchObject({ instanceSettingsCount: 2 });
expect(plugins.find((p) => p.id === 'plain')).toMatchObject({ instanceSettingsCount: 0 });
});
it('INS-004 — the admin list carries the instance-action count (gates the menu item even with no settings fields)', () => {
it('INS-004 — the admin list carries the instance-action count (gates the menu item even with no settings fields)', async () => {
install('with-action');
install('plain');
testDb
@@ -131,7 +131,7 @@ describe('instance settings fields', () => {
.prepare('INSERT INTO plugin_actions (plugin_id, action_key, label, hint, danger, scope, sort_order) VALUES (?, ?, ?, NULL, 0, ?, 0)')
.run('with-action', 'notify', 'Notify', 'user'); // user-scope actions must not count
const plugins = svc().list().plugins;
const plugins = (await svc().list()).plugins;
expect(plugins.find((p) => p.id === 'with-action')).toMatchObject({ instanceSettingsCount: 0, instanceActionsCount: 1 });
expect(plugins.find((p) => p.id === 'plain')).toMatchObject({ instanceSettingsCount: 0, instanceActionsCount: 0 });
testDb.prepare("DELETE FROM plugin_actions WHERE plugin_id = 'with-action'").run();
@@ -212,13 +212,13 @@ describe('required settings are enforced on save', () => {
describe('respawn on save (runtime)', () => {
it('INS-004 — an inactive plugin is left alone (no respawn, reports false)', async () => {
install('p');
const rt = createPluginRuntime(new DatabaseService(dbConn));
const rt = await createPluginRuntime(new DatabaseService(dbConn));
await expect(rt.respawnIfActive('p')).resolves.toBe(false);
});
it('INS-005 — an active plugin is stopped and re-activated so the child re-reads config', async () => {
install('p');
const rt = createPluginRuntime(new DatabaseService(dbConn));
const rt = await createPluginRuntime(new DatabaseService(dbConn));
const calls: string[] = [];
vi.spyOn(rt, 'isActive').mockReturnValue(true);
vi.spyOn(rt, 'activate').mockImplementation(async () => { calls.push('activate'); });
@@ -334,7 +334,7 @@ describe('defaults reach the child at spawn', () => {
const s = svc();
s.updateInstanceConfig('fixture-id', { api_url: 'https://mine.example' });
const rt = createPluginRuntime(new DatabaseService(dbConn));
const rt = await createPluginRuntime(new DatabaseService(dbConn));
const sup = (rt as unknown as { supervisor: { activate: (...a: unknown[]) => Promise<void> } }).supervisor;
const activate = vi.spyOn(sup, 'activate').mockResolvedValue(undefined);
@@ -36,13 +36,13 @@ afterEach(() => {
});
describe('PluginsService.list', () => {
it('returns the installed plugins and the runtime-enabled flag', () => {
it('returns the installed plugins and the runtime-enabled flag', async () => {
testDb
.prepare('INSERT INTO plugins (id, name, description, type, status, version) VALUES (?,?,?,?,?,?)')
.run('flight', 'Flight', 'desc', 'widget', 'inactive', '1.0.0');
process.env.TREK_PLUGINS_ENABLED = 'true';
const out = new PluginsService(new DatabaseService(dbConn), new AddonsService(new DatabaseService(dbConn))).list();
const out = await new PluginsService(new DatabaseService(dbConn), new AddonsService(new DatabaseService(dbConn))).list();
expect(out.enabled).toBe(true);
expect(out.plugins).toHaveLength(1);
expect(out.plugins[0]).toMatchObject({ id: 'flight', name: 'Flight', status: 'inactive' });
@@ -60,19 +60,19 @@ describe('PluginsService.list', () => {
.prepare("INSERT INTO plugins (id, name, type, status, version, trek_range) VALUES ('old','Old','widget','inactive','1.0.0','>=3.0.0 <4.0.0')")
.run();
it('reports the switch off and an outgrown plugin as hostIncompatible by default', () => {
it('reports the switch off and an outgrown plugin as hostIncompatible by default', async () => {
process.env.APP_VERSION = '4.1.0';
seed();
const out = new PluginsService(new DatabaseService(dbConn), new AddonsService(new DatabaseService(dbConn))).list();
const out = await new PluginsService(new DatabaseService(dbConn), new AddonsService(new DatabaseService(dbConn))).list();
expect(out.ignoreTrekRange).toBe(false);
expect(out.plugins[0]).toMatchObject({ dependencyStatus: 'hostIncompatible', trekRangeBypassed: null });
});
it('with the switch on, the plugin may activate but the row still says it is outside its range', () => {
it('with the switch on, the plugin may activate but the row still says it is outside its range', async () => {
process.env.APP_VERSION = '4.1.0';
process.env.TREK_PLUGINS_IGNORE_TREK_RANGE = '1';
seed();
const out = new PluginsService(new DatabaseService(dbConn), new AddonsService(new DatabaseService(dbConn))).list();
const out = await new PluginsService(new DatabaseService(dbConn), new AddonsService(new DatabaseService(dbConn))).list();
expect(out.ignoreTrekRange).toBe(true);
expect(out.plugins[0]).toMatchObject({
dependencyStatus: 'ok',
@@ -80,16 +80,16 @@ describe('PluginsService.list', () => {
});
});
it('a plugin inside its range carries no marker even with the switch on', () => {
it('a plugin inside its range carries no marker even with the switch on', async () => {
process.env.APP_VERSION = '3.5.0';
process.env.TREK_PLUGINS_IGNORE_TREK_RANGE = '1';
seed();
const out = new PluginsService(new DatabaseService(dbConn), new AddonsService(new DatabaseService(dbConn))).list();
const out = await new PluginsService(new DatabaseService(dbConn), new AddonsService(new DatabaseService(dbConn))).list();
expect(out.plugins[0]).toMatchObject({ dependencyStatus: 'ok', trekRangeBypassed: null });
});
});
it('surfaces updateHold as a boolean (held plugins leave the update banner)', () => {
it('surfaces updateHold as a boolean (held plugins leave the update banner)', async () => {
testDb
.prepare("INSERT INTO plugins (id, name, type, status, version, update_hold) VALUES ('held','Held','widget','inactive','1.0.0',1)")
.run();
@@ -97,7 +97,7 @@ describe('PluginsService.list', () => {
.prepare("INSERT INTO plugins (id, name, type, status, version) VALUES ('free','Free','widget','inactive','1.0.0')")
.run();
const out = new PluginsService(new DatabaseService(dbConn), new AddonsService(new DatabaseService(dbConn))).list();
const out = await new PluginsService(new DatabaseService(dbConn), new AddonsService(new DatabaseService(dbConn))).list();
expect(out.plugins.find((p) => p.id === 'held')).toMatchObject({ updateHold: true });
expect(out.plugins.find((p) => p.id === 'free')).toMatchObject({ updateHold: false });
});
@@ -113,19 +113,19 @@ describe('PluginsService.list', () => {
expect(svc.resumeUpdates('ghost')).toBe(false);
});
it('reports enabled by default (no kill switch set)', () => {
it('reports enabled by default (no kill switch set)', async () => {
testDb
.prepare('INSERT INTO plugins (id, name, description, type, status, version) VALUES (?,?,?,?,?,?)')
.run('flight', 'Flight', 'desc', 'widget', 'inactive', '1.0.0');
const out = new PluginsService(new DatabaseService(dbConn), new AddonsService(new DatabaseService(dbConn))).list();
const out = await new PluginsService(new DatabaseService(dbConn), new AddonsService(new DatabaseService(dbConn))).list();
expect(out.enabled).toBe(true);
expect(out.plugins).toHaveLength(1);
});
it('reports disabled when the kill switch is off (TREK_PLUGINS_ENABLED=false)', () => {
it('reports disabled when the kill switch is off (TREK_PLUGINS_ENABLED=false)', async () => {
process.env.TREK_PLUGINS_ENABLED = 'false';
const out = new PluginsService(new DatabaseService(dbConn), new AddonsService(new DatabaseService(dbConn))).list();
const out = await new PluginsService(new DatabaseService(dbConn), new AddonsService(new DatabaseService(dbConn))).list();
expect(out.enabled).toBe(false);
expect(out.plugins).toEqual([]);
});
@@ -141,11 +141,11 @@ describe('PluginsService.list', () => {
.prepare('INSERT INTO plugins (id, name, type, status, version, source_repo, author_pubkey) VALUES (?,?,?,?,?,?,?)')
.run(id, id, 'widget', 'inactive', '1.0.0', sourceRepo, pubkey);
it('reports signed + a display fingerprint for a registry plugin with a pinned key', () => {
it('reports signed + a display fingerprint for a registry plugin with a pinned key', async () => {
const key = 'RWTvBn0aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789abcd';
insert('signed-one', 'acme/signed-one', key);
const p = new PluginsService(new DatabaseService(dbConn), new AddonsService(new DatabaseService(dbConn))).list().plugins[0];
const p = (await new PluginsService(new DatabaseService(dbConn), new AddonsService(new DatabaseService(dbConn))).list()).plugins[0];
expect(p.signed).toBe(true);
// Short head…tail, for eyeballing against what the author reads out over the
// phone. NOT a confidentiality measure — the key is public, and the re-trust
@@ -153,41 +153,41 @@ describe('PluginsService.list', () => {
expect(p.keyFingerprint).toBe(`${key.slice(0, 8)}…${key.slice(-8)}`);
});
it('reports unsigned for a registry plugin with no pinned key', () => {
it('reports unsigned for a registry plugin with no pinned key', async () => {
insert('plain', 'acme/plain', null);
const p = new PluginsService(new DatabaseService(dbConn), new AddonsService(new DatabaseService(dbConn))).list().plugins[0];
const p = (await new PluginsService(new DatabaseService(dbConn), new AddonsService(new DatabaseService(dbConn))).list()).plugins[0];
expect(p.signed).toBe(false);
expect(p.keyFingerprint).toBeNull();
});
it('reports unsigned for a sideloaded and a dev-linked plugin (they carry no key)', () => {
it('reports unsigned for a sideloaded and a dev-linked plugin (they carry no key)', async () => {
insert('uploaded', 'local:upload', null);
insert('linked', 'local:link', null);
const plugins = new PluginsService(new DatabaseService(dbConn), new AddonsService(new DatabaseService(dbConn))).list().plugins;
const plugins = (await new PluginsService(new DatabaseService(dbConn), new AddonsService(new DatabaseService(dbConn))).list()).plugins;
expect(plugins.map((p) => [p.id, p.signed, p.source_repo])).toEqual([
['linked', false, 'local:link'],
['uploaded', false, 'local:upload'],
]);
});
it('surfaces a recorded update block, and reports none when there is none', () => {
it('surfaces a recorded update block, and reports none when there is none', async () => {
insert('blocked', 'acme/blocked', 'RWTvBn0aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789abcd');
insert('fine', 'acme/fine', null);
testDb
.prepare('UPDATE plugins SET update_block_code = ?, update_block_detail = ?, update_block_version = ? WHERE id = ?')
.run('SIGNATURE_KEY_CHANGED', 'the key changed', '2.0.0', 'blocked');
const byId = Object.fromEntries(new PluginsService(new DatabaseService(dbConn), new AddonsService(new DatabaseService(dbConn))).list().plugins.map((p) => [p.id, p]));
const byId = Object.fromEntries((await new PluginsService(new DatabaseService(dbConn), new AddonsService(new DatabaseService(dbConn))).list()).plugins.map((p) => [p.id, p]));
expect(byId.blocked.updateBlock).toEqual({ code: 'SIGNATURE_KEY_CHANGED', detail: 'the key changed', version: '2.0.0' });
expect(byId.fine.updateBlock).toBeNull();
});
it('never leaks the raw pinned key into the list response (only the fingerprint)', () => {
it('never leaks the raw pinned key into the list response (only the fingerprint)', async () => {
insert('signed-one', 'acme/signed-one', 'RWTvBn0aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789abcd');
// PluginListItem is an interface, so it has no implicit index signature and cannot
// be narrowed to a record directly. Widening through unknown is what lets this case
// probe for a key the contract deliberately does not declare.
const p = new PluginsService(new DatabaseService(dbConn), new AddonsService(new DatabaseService(dbConn))).list()
const p = (await new PluginsService(new DatabaseService(dbConn), new AddonsService(new DatabaseService(dbConn))).list())
.plugins[0] as unknown as Record<string, unknown>;
expect(p.author_pubkey).toBeUndefined();
});
@@ -101,7 +101,7 @@ describe('providersOf enforces the hook:* grant', () => {
describe('runtime.invokeHook defense-in-depth', () => {
it('refuses a plugin id that is not a granted provider of the hook, even if passed directly', async () => {
const rt = createPluginRuntime(new DatabaseService(db));
const rt = await createPluginRuntime(new DatabaseService(db));
// one legitimate granted provider exists, so providersOf('placeDetailProvider') = ['ok']
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(rt as any).supervisor.running.set('ok', { id: 'ok', status: 'active', hooks: ['placeDetailProvider'], events: [], granted: new Set(['hook:place-detail-provider']) });