subagent-spawn.spec.ts 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  1. import { describe, expect, it } from 'vitest'
  2. import { Context } from 'cordis'
  3. import Loader from '@cordisjs/plugin-loader'
  4. import AgentRegistry from '@deepseek-ai/dsh-agent'
  5. import { SessionId } from '@deepseek-ai/dsh-session'
  6. import AgentLoop from '@deepseek-ai/dsh-agent-loop'
  7. import { mountAgentLoopTestDependencies } from '@deepseek-ai/dsh-agent-loop-testkit'
  8. import InvariantService from '@deepseek-ai/dsh-invariants'
  9. import * as SessionInvariant from '@deepseek-ai/dsh-session/invariant'
  10. import * as AgentInvariant from '@deepseek-ai/dsh-agent/invariant'
  11. import * as AgentLoopInvariant from '@deepseek-ai/dsh-agent-loop/invariant'
  12. import SubagentService, { type SubagentStartRequest } from '@deepseek-ai/dsh-subagent'
  13. import { MockAdapter, maxTokensResponse, textResponse, toolCallResponse } from '../../../core/agent-loop/tests/mock-adapter.ts'
  14. import * as spawn from '../src/index.ts'
  15. import { STRUCTURED_OUTPUT_TOOL } from '@deepseek-ai/dsh-subagent-inprocess'
  16. import { defineContentToolFixture } from '@deepseek-ai/dsh-tools'
  17. type Script = ConstructorParameters<typeof MockAdapter>[0]
  18. async function mountInvariants(ctx: Context): Promise<void> {
  19. await ctx.plugin(InvariantService)
  20. await ctx.plugin(SessionInvariant)
  21. await ctx.plugin(AgentInvariant)
  22. await ctx.plugin(AgentLoopInvariant)
  23. }
  24. /**
  25. * Drives the REAL spawn backend end-to-end: a real agent loop + a scripted mock
  26. * MODEL (the only mocked boundary) + the real SubagentService + the real
  27. * invariant service plus package companions (so a malformed child session log would fail the test).
  28. * The parent is a real config agent; the spawn provider creates a real child
  29. * agent on the same context and we assert its output.
  30. */
  31. async function setup(script: Script) {
  32. const ctx = new Context()
  33. const adapter = new MockAdapter(script)
  34. await mountAgentLoopTestDependencies(ctx)
  35. await mountInvariants(ctx)
  36. await ctx.plugin(AgentLoop, { agents: [] })
  37. await ctx.plugin(SubagentService)
  38. await ctx.plugin(spawn, { providerName: 'spawn' })
  39. ctx.llm.registerAdapter(['mock'], adapter)
  40. const parent = ctx.agentLoop.create(SessionId('parent'), { provider: 'mock', model: 'mock' })
  41. return { ctx, parent, adapter }
  42. }
  43. function text(blocks: { type: string; text?: string }[]): string {
  44. return blocks.filter(b => b.type === 'text').map(b => b.text).join('')
  45. }
  46. function start(ctx: Context, provider: string, request: Omit<SubagentStartRequest, 'signal'> & { signal?: AbortSignal }) {
  47. return ctx.subagents.start(provider, { signal: request.signal ?? new AbortController().signal, ...request })
  48. }
  49. describe('dsh-subagent-spawn', () => {
  50. it('runs a fresh child to completion and returns its final assistant output', async () => {
  51. // One model call for the child: a plain text answer.
  52. const { ctx, parent } = await setup([textResponse('child answer')])
  53. const run = await start(ctx, 'spawn', { prompt: [{ type: 'text', text: 'do X' }], parent })
  54. const result = await run.result
  55. expect(result.stopReason).toBe('completed')
  56. expect(text(result.output)).toBe('child answer')
  57. await run.dispose()
  58. })
  59. it('emits subagent/start only after the fresh child is published', async () => {
  60. const { ctx, parent } = await setup([textResponse('child answer')])
  61. let childAtStart: ReturnType<typeof ctx.agents.get>
  62. ctx.on('subagent/start', (info) => {
  63. if (info.provider === 'spawn') childAtStart = ctx.agents.get(info.id)
  64. })
  65. const starting = start(ctx, 'spawn', { prompt: [{ type: 'text', text: 'do X' }], parent })
  66. // Creation is asynchronous; no lifecycle claim is made while the child is
  67. // still inside its unpublished setup transaction.
  68. expect(childAtStart).toBeUndefined()
  69. const run = await starting
  70. expect(childAtStart).toBe(ctx.agents.get(run.id))
  71. expect(childAtStart?.id).toBe(run.id)
  72. await run.result
  73. await run.dispose()
  74. })
  75. it('gives the child its OWN session (not the parent\'s), with parentSession lineage', async () => {
  76. const { ctx, parent } = await setup([textResponse('hi')])
  77. const run = await start(ctx, 'spawn', { prompt: [{ type: 'text', text: 'p' }], parent })
  78. await run.result
  79. const child = ctx.agents.get(run.id)!
  80. expect(child.session.header.id).not.toBe(parent.session.header.id)
  81. expect(child.session.header.parentSession).toBe(parent.session.header.id)
  82. await run.dispose()
  83. })
  84. it('a fresh child does NOT inherit the parent conversation (its log starts empty before the prompt)', async () => {
  85. // Drive the parent through one real turn so it has history, THEN spawn.
  86. const { ctx, parent } = await setup([textResponse('parent turn'), textResponse('child sees nothing')])
  87. parent.followup([{ type: 'text', text: 'parent prompt' }])
  88. await parent.whenIdle()
  89. const parentEventCount = parent.session.events.length
  90. expect(parentEventCount).toBeGreaterThan(0)
  91. const run = await start(ctx, 'spawn', { prompt: [{ type: 'text', text: 'child prompt' }], parent })
  92. await run.result
  93. const child = ctx.agents.get(run.id)!
  94. // The child's first user/message is its OWN prompt, not the parent's history.
  95. const firstUser = child.session.events.find(e => e.type === 'user/message')
  96. expect(firstUser).toBeDefined()
  97. await run.dispose()
  98. })
  99. it('disposes the child to quiescence (agent removed from the registry)', async () => {
  100. const { ctx, parent } = await setup([textResponse('x')])
  101. const run = await start(ctx, 'spawn', { prompt: [{ type: 'text', text: 'p' }], parent })
  102. await run.result
  103. expect(ctx.agents.get(run.id)).toBeDefined()
  104. await run.dispose()
  105. // After dispose, the child is unregistered (the AgentHandle teardown ran).
  106. expect(ctx.agents.get(run.id)).toBeUndefined()
  107. })
  108. it('stamps child depth = parent depth + 1 (via the merged AgentOptions field)', async () => {
  109. const { ctx, parent } = await setup([textResponse('x')])
  110. expect(parent.options.subagentDepth).toBeUndefined()
  111. const run = await start(ctx, 'spawn', { prompt: [{ type: 'text', text: 'p' }], parent })
  112. await run.result
  113. const child = ctx.agents.get(run.id)!
  114. expect(child.options.subagentDepth).toBe(1)
  115. await run.dispose()
  116. })
  117. it('refuses to spawn past maxDepth (depthLimit capability)', async () => {
  118. const { ctx, parent } = await setup([])
  119. // parent is depth 0, child would be depth 1 — cap at 0 forbids any child.
  120. await expect(start(ctx, 'spawn', { prompt: [{ type: 'text', text: 'p' }], parent, maxDepth: 0 }))
  121. .rejects.toThrow('subagent depth 1 exceeds maxDepth 0')
  122. })
  123. it('maps a child that hit its token ceiling to stopReason "max-tokens"', async () => {
  124. const { ctx, parent } = await setup([maxTokensResponse('cut off')])
  125. const run = await start(ctx, 'spawn', { prompt: [{ type: 'text', text: 'p' }], parent })
  126. const result = await run.result
  127. expect(result.stopReason).toBe('max-tokens')
  128. await run.dispose()
  129. })
  130. it('maps a child whose turn errored (script exhausted) to stopReason "error" with empty output', async () => {
  131. // Empty script: the child's first model call throws "script exhausted", the
  132. // turn ends `error`, and there is no assistant/message → empty output.
  133. const { ctx, parent } = await setup([])
  134. const run = await start(ctx, 'spawn', { prompt: [{ type: 'text', text: 'p' }], parent })
  135. const result = await run.result
  136. expect(result.stopReason).toBe('error')
  137. expect(result.output).toEqual([])
  138. await run.dispose()
  139. })
  140. it('rejects without publishing when the request signal is already aborted', async () => {
  141. // An already-aborted signal emits no future event, so start must check it before listening and
  142. // settle aborted without running the child. The empty model script proves no turn occurs.
  143. const controller = new AbortController()
  144. controller.abort()
  145. const { ctx, parent } = await setup([])
  146. await expect(start(ctx, 'spawn', { prompt: [{ type: 'text', text: 'p' }], parent, signal: controller.signal }))
  147. .rejects.toThrow('aborted before child publication')
  148. })
  149. it('same-tick cancellation rejects start and prevents child publication', async () => {
  150. // Same-tick cancellation must win before async factory publication: no child may become
  151. // visible, `started` must not fulfill, and the empty script proves no model turn occurs.
  152. const { ctx, parent } = await setup([])
  153. const beforeAgents = ctx.agents.list().length
  154. const beforeSessions = ctx.sessions.list().length
  155. const published: string[] = []
  156. ctx.on('session/created', () => void published.push('session/created'))
  157. ctx.on('agent/created', () => void published.push('agent/created'))
  158. ctx.on('agent/session-start', () => void published.push('agent/session-start'))
  159. ctx.on('subagent/start', () => void published.push('subagent/start'))
  160. ctx.on('subagent/end', () => void published.push('subagent/end'))
  161. const controller = new AbortController()
  162. const starting = start(ctx, 'spawn', { prompt: [{ type: 'text', text: 'p' }], parent, signal: controller.signal })
  163. controller.abort('early')
  164. await expect(starting).rejects.toThrow()
  165. await Promise.resolve()
  166. expect(ctx.agents.list()).toHaveLength(beforeAgents)
  167. expect(ctx.sessions.list()).toHaveLength(beforeSessions)
  168. expect(published).toEqual([])
  169. })
  170. it('a cancel from agent/inbox/enqueue maps a no-turn child log to aborted', async () => {
  171. const { ctx, parent } = await setup([])
  172. const controller = new AbortController()
  173. ctx.on('agent/inbox/enqueue', () => { controller.abort('queued-window') })
  174. const run = await start(ctx, 'spawn', { prompt: [{ type: 'text', text: 'p' }], parent, signal: controller.signal })
  175. const result = await run.result
  176. expect(result).toMatchObject({ stopReason: 'aborted', output: [] })
  177. const child = ctx.agents.get(run.id)!
  178. expect(child.session.events.some(event => event.type === 'turn/end')).toBe(false)
  179. await run.dispose()
  180. })
  181. it('cancelling a running child settles the run as aborted (the abort bridge + cancel())', async () => {
  182. // 'hang' makes the child's model stream one chunk then wait until aborted.
  183. const controller = new AbortController()
  184. const { ctx, parent } = await setup(['hang'])
  185. const run = await start(ctx, 'spawn', { prompt: [{ type: 'text', text: 'p' }], parent, signal: controller.signal })
  186. // Let the child's turn start, then abort via the request signal (the
  187. // backend bridges it to child.cancel()).
  188. await new Promise(r => setTimeout(r, 30))
  189. controller.abort()
  190. const result = await run.result
  191. expect(result.stopReason).toBe('aborted')
  192. await run.dispose()
  193. })
  194. it('dispose cancels the child and reaches quiescence', async () => {
  195. const { ctx, parent } = await setup(['hang'])
  196. const run = await start(ctx, 'spawn', { prompt: [{ type: 'text', text: 'p' }], parent })
  197. await new Promise(r => setTimeout(r, 30))
  198. await run.dispose()
  199. const result = await run.result
  200. expect(result.stopReason).toBe('aborted')
  201. })
  202. it('does not expose the optional runtime methods (sendMessage/resume) in this cut', async () => {
  203. const { ctx, parent } = await setup([textResponse('x')])
  204. const run = await start(ctx, 'spawn', { prompt: [{ type: 'text', text: 'p' }], parent })
  205. expect('sendMessage' in run).toBe(false)
  206. expect('resume' in run).toBe(false)
  207. await run.result
  208. await run.dispose()
  209. })
  210. it('inherits the parent cwd into the child session', async () => {
  211. const { ctx } = await setup([textResponse('x')])
  212. // A parent WITH a cwd (config agents have none, so create one explicitly).
  213. const parentHandle = await ctx.agents.create({
  214. sessionId: SessionId('cwd-parent-session'),
  215. meta: { cwd: '/tmp/parent-workspace' },
  216. agentOptions: { provider: 'mock', model: 'mock' },
  217. })
  218. const run = await start(ctx, 'spawn', { prompt: [{ type: 'text', text: 'p' }], parent: parentHandle.agent })
  219. await run.result
  220. const child = ctx.agents.get(run.id)!
  221. expect(child.session.header.cwd).toBe('/tmp/parent-workspace')
  222. await run.dispose()
  223. await parentHandle.dispose()
  224. })
  225. it('uses request.agentOptions.model when the parent has no model of its own', async () => {
  226. const { ctx } = await setup([textResponse('explicit model child')])
  227. // A parent with NO model (its own turns would need one supplied per-request).
  228. const parentHandle = await ctx.agents.create({
  229. sessionId: SessionId('modelless-parent-session'),
  230. agentOptions: {},
  231. })
  232. // The request supplies the child's model explicitly.
  233. const run = await start(ctx, 'spawn', {
  234. prompt: [{ type: 'text', text: 'p' }],
  235. parent: parentHandle.agent,
  236. agentOptions: { provider: 'mock', model: 'mock' },
  237. })
  238. const result = await run.result
  239. expect(result.stopReason).toBe('completed')
  240. expect(text(result.output)).toBe('explicit model child')
  241. await run.dispose()
  242. await parentHandle.dispose()
  243. })
  244. it('advertises every start-time capability (depthLimit, outputSchema, toolFilter, persona)', async () => {
  245. const { ctx } = await setup([])
  246. const provider = ctx.subagents.getProvider('spawn')!
  247. expect(provider.capabilities).toEqual({ outputSchema: true, depthLimit: true, toolFilter: true, persona: true })
  248. })
  249. it('unregisters the provider when its fiber is disposed (HMR safety)', async () => {
  250. const ctx = new Context()
  251. await ctx.plugin(SubagentService)
  252. await ctx.plugin(AgentRegistry)
  253. const fiber = await ctx.plugin(spawn, { providerName: 'spawn' })
  254. expect(ctx.subagents.list()).toEqual(['spawn'])
  255. await fiber.dispose()
  256. expect(ctx.subagents.list()).toEqual([])
  257. })
  258. it('captures structured output through the shipped plugin (driver runtime, plugin wiring)', async () => {
  259. const { ctx, parent } = await setup([
  260. toolCallResponse('c1', STRUCTURED_OUTPUT_TOOL, { answer: 42 }),
  261. ])
  262. const run = await start(ctx, 'spawn', {
  263. prompt: [{ type: 'text', text: 'produce the answer' }],
  264. parent,
  265. outputSchema: { type: 'object', properties: { answer: { type: 'number' } }, required: ['answer'] },
  266. })
  267. const result = await run.result
  268. expect(result.stopReason).toBe('completed')
  269. expect(result.structured).toEqual({ answer: 42 })
  270. // Run-scoped runtime: the settle released the last acquisition.
  271. expect(ctx.tools.get(STRUCTURED_OUTPUT_TOOL)).toBeUndefined()
  272. await run.dispose()
  273. })
  274. it('a backend unload does not revoke an accepted holder-owned run', async () => {
  275. // Rebuild the stack by hand so we hold the backend's fiber.
  276. const ctx = new Context()
  277. const adapter = new MockAdapter(['hang'])
  278. await mountAgentLoopTestDependencies(ctx)
  279. await mountInvariants(ctx)
  280. await ctx.plugin(AgentLoop, { agents: [] })
  281. await ctx.plugin(SubagentService)
  282. const fiber = await ctx.plugin(spawn, { providerName: 'spawn' })
  283. ctx.llm.registerAdapter(['mock'], adapter)
  284. const parent = ctx.agentLoop.create(SessionId('parent'), { provider: 'mock', model: 'mock' })
  285. const controller = new AbortController()
  286. const run = await start(ctx, 'spawn', {
  287. prompt: [{ type: 'text', text: 'q' }],
  288. parent,
  289. signal: controller.signal,
  290. outputSchema: { type: 'object', properties: { a: { type: 'number' } } },
  291. })
  292. // Provider removal prevents new starts but the returned run belongs to its
  293. // holder and remains live.
  294. await new Promise(resolve => setTimeout(resolve, 30))
  295. await fiber.dispose()
  296. expect(ctx.subagents.getProvider('spawn')).toBeUndefined()
  297. expect(ctx.agents.get(run.id)).toBeDefined()
  298. controller.abort('test complete')
  299. const result = await run.result
  300. expect(result.stopReason).toBe('aborted')
  301. expect(ctx.tools.get(STRUCTURED_OUTPUT_TOOL)).toBeUndefined()
  302. await run.dispose()
  303. })
  304. it('a start racing an already-unloading backend cannot begin child creation', async () => {
  305. const ctx = new Context()
  306. await mountAgentLoopTestDependencies(ctx)
  307. await ctx.plugin(AgentLoop, { agents: [] })
  308. await ctx.plugin(SubagentService)
  309. const fiber = await ctx.plugin(spawn, { providerName: 'spawn' })
  310. const parent = ctx.agentLoop.create(SessionId('parent'), { provider: 'mock', model: 'mock' })
  311. const parentEffects = parent.ctx.fiber.getEffects().length
  312. const published: string[] = []
  313. ctx.on('session/created', () => void published.push('session/created'))
  314. ctx.on('agent/created', () => void published.push('agent/created'))
  315. const unloading = fiber.dispose()
  316. await unloading
  317. await expect(start(ctx, 'spawn', {
  318. prompt: [{ type: 'text', text: 'must never start' }], parent,
  319. })).rejects.toThrow(/no subagent provider/)
  320. expect(parent.ctx.fiber.getEffects()).toHaveLength(parentEffects)
  321. expect(published).toEqual([])
  322. })
  323. it('has the namespace-plugin export shape (no stray default)', () => {
  324. expect('default' in spawn).toBe(false)
  325. expect(spawn.name).toBe('subagent-spawn')
  326. expect(spawn.inject).toEqual(['subagents'])
  327. const loader = Object.create(Loader.prototype) as Loader
  328. const unwrapped = loader.unwrapExports(spawn) as Record<string, unknown>
  329. expect(unwrapped).toBe(spawn)
  330. expect(unwrapped.name).toBe('subagent-spawn')
  331. expect(unwrapped.inject).toEqual(['subagents'])
  332. expect(typeof unwrapped.apply).toBe('function')
  333. })
  334. describe('persona and toolFilter (the scoped child world)', () => {
  335. it('a per-child persona shadows the deployment persona in the child request only', async () => {
  336. const { ctx, parent, adapter } = await setup([
  337. textResponse('parent answer'),
  338. textResponse('child answer'),
  339. ])
  340. parent.followup([{ type: 'text', text: 'hi' }])
  341. await parent.whenIdle()
  342. const run = await start(ctx, 'spawn', {
  343. prompt: [{ type: 'text', text: 'do X' }],
  344. parent,
  345. persona: 'You are the tersest test runner.',
  346. })
  347. await run.result
  348. const childRequest = adapter.requests.at(-1)!
  349. expect(childRequest.system).toContain('You are the tersest test runner.')
  350. // The parent's earlier request carried no such persona.
  351. expect(adapter.requests[0]!.system ?? '').not.toContain('tersest test runner')
  352. await run.dispose()
  353. })
  354. it('toolFilter hides denied tools from the child prompt AND refuses their execution', async () => {
  355. const { ctx, parent, adapter } = await setup([
  356. // The child tries the denied tool anyway, then answers.
  357. toolCallResponse('c1', 'forbidden_tool', {}),
  358. textResponse('done'),
  359. ])
  360. ctx.tools.register(defineContentToolFixture({
  361. name: 'forbidden_tool', description: 'global', parameters: {},
  362. execute: () => Promise.resolve([{ type: 'text', text: 'ran' }]),
  363. }))
  364. const run = await start(ctx, 'spawn', {
  365. prompt: [{ type: 'text', text: 'do X' }],
  366. parent,
  367. toolFilter: { deny: ['forbidden_tool'] },
  368. })
  369. const result = await run.result
  370. expect(result.stopReason).toBe('completed')
  371. // Not advertised…
  372. const childRequest = adapter.requests[0]!
  373. expect((childRequest.tools ?? []).map(t => t.name)).not.toContain('forbidden_tool')
  374. // …and the attempted call executed as UNKNOWN_TOOL (visible in the log).
  375. const child = ctx.agents.get(run.id)!
  376. const toolResult = child.session.events.find(e => e.type === 'tool/result')!
  377. expect(JSON.stringify(toolResult.data)).toContain('unknown tool')
  378. await run.dispose()
  379. })
  380. it('an unknown toolFilter name fails the spawn loudly with no orphaned child', async () => {
  381. const { ctx, parent } = await setup([])
  382. const before = ctx.agents.list().length
  383. await expect(start(ctx, 'spawn', {
  384. prompt: [{ type: 'text', text: 'do X' }],
  385. parent,
  386. toolFilter: { deny: ['no_such_tool'] },
  387. })).rejects.toThrow(/unknown global tool "no_such_tool"/)
  388. expect(ctx.agents.list().length).toBe(before)
  389. })
  390. })
  391. it('spawning from a DISPOSING parent fails loud with no orphaned child (INACTIVE_EFFECT teaching error)', async () => {
  392. const { ctx } = await setup([])
  393. // A handle-owned parent we can dispose (config agents dispose with the loop fiber).
  394. const parentHandle = await ctx.agents.create({
  395. sessionId: SessionId('doomed-s'),
  396. agentOptions: { provider: 'mock', model: 'mock' },
  397. })
  398. await parentHandle.dispose()
  399. const before = ctx.agents.list().length
  400. const sessionsBefore = ctx.sessions.list().length
  401. const published: string[] = []
  402. ctx.on('session/created', () => void published.push('session/created'))
  403. ctx.on('agent/created', () => void published.push('agent/created'))
  404. ctx.on('agent/session-start', () => void published.push('agent/session-start'))
  405. await expect(start(ctx, 'spawn', {
  406. prompt: [{ type: 'text', text: 'do X' }],
  407. parent: parentHandle.agent,
  408. })).rejects.toThrow(/inactive context/)
  409. expect(ctx.agents.list().length).toBe(before)
  410. expect(ctx.sessions.list()).toHaveLength(sessionsBefore)
  411. expect(published).toEqual([])
  412. })
  413. it('parent disposal during the child setup transaction prevents every publication notification', async () => {
  414. const { ctx } = await setup([])
  415. const parentHandle = await ctx.agents.create({
  416. sessionId: SessionId('setup-race-parent-session'),
  417. agentOptions: { provider: 'mock', model: 'mock' },
  418. })
  419. const published: string[] = []
  420. ctx.on('session/created', () => void published.push('session/created'))
  421. ctx.on('agent/created', () => void published.push('agent/created'))
  422. ctx.on('agent/session-start', () => void published.push('agent/session-start'))
  423. const starting = start(ctx, 'spawn', {
  424. prompt: [{ type: 'text', text: 'must never run' }],
  425. parent: parentHandle.agent,
  426. })
  427. // The factory has entered its awaited unpublished setup transaction. The
  428. // parent context owns that transaction, so disposal wins without an
  429. // observer ever seeing the child.
  430. await parentHandle.dispose()
  431. await expect(starting).rejects.toThrow(/owner disposed during setup|inactive context/)
  432. expect(published).toEqual([])
  433. })
  434. })