diff --git a/packages/webui/src/decision-http.mjs b/packages/webui/src/decision-http.mjs index 98079409c..4d54b1741 100644 --- a/packages/webui/src/decision-http.mjs +++ b/packages/webui/src/decision-http.mjs @@ -42,6 +42,18 @@ const BUS_CODES = { 'decision-closed': 'decision-closed', 'decision-stale': 'decision-stale', 'invalid-choice': 'decision-stale', 'invalid-request': 'invalid-request', 'hire-owner-required':'hire-owner-required','right-required':'right-required','decision-expired':'decision-expired','hire-resolution-required':'hire-resolution-required', }; +// D4 (#1873, P1-2): a hire start the bus definitely refused keeps its own code. The broker can +// refuse before it records the decision (a model route the catalogue does not offer) or after +// (a check or apply that fails), so the message never claims that nothing was recorded. A lost +// or unreadable reply stays outcome-unknown. The model route codes get a next step; any other code is named. +const HIRE_START_REFUSALS = { + 'model-provider-unavailable': [409, 'The model proxy does not offer this model, or its catalogue is not ready. Pick a model it offers, or ask the owner to check Settings > Model proxy. The hire was not applied.'], + 'model-catalogue-unavailable': [503, 'The model catalogue could not be read, so this model could not be checked. Check Settings > Model proxy, then try again. The hire was not applied.'], + 'model-harness-incompatible': [409, 'This model does not run on the chosen harness. Pick another model or harness. The hire was not applied.'], + 'thinking-unsupported': [409, 'The chosen harness does not apply this thinking level. Clear Thinking or pick a level it applies. The hire was not applied.'], +}; +const OPEN = ['outcome-unknown', 'invalid-response', 'response-too-large', 'outcome-unknown-revoked']; +const BUS_CODE = /^[a-z][a-z-]{0,63}$/; const BODY_MAX = 4096; const TOKEN = /^[a-f0-9]{64}$/; const DIGEST = /^[a-f0-9]{64}$/; @@ -136,7 +148,13 @@ export async function decisionHTTP(req, res, { path, decide, session, live, conf if(step==='templates' && !Array.isArray(result?.templates))return refuse('confirmation-unavailable'); line(step==='start'?'hire=recorded':'templates=read'); return json(res,200,step==='start'?{id:result.id,op:result.op,choice:result.choice}:result); - } catch(err) {return refuse(busCode(err,step==='start'?'outcome-unknown':'confirmation-unavailable'));} + } catch(err) { + if(step!=='start' || !(err instanceof BusReadError) || BUS_CODES[err.code] || OPEN.includes(err.code) || !BUS_CODE.test(err.code ?? '')) + return refuse(busCode(err,step==='start'?'outcome-unknown':'confirmation-unavailable')); + const [status,message]=HIRE_START_REFUSALS[err.code] ?? [409, `The bus refused this hire (${err.code}). Refresh the inbox to see whether a hire decision is open before trying again.`]; + line(`error=${err.code}`); + return json(res,status,{error:err.code,message}); + } } if (step === 'confirmation') { if (Object.keys(value).some(k=>!['choice','adjust'].includes(k)) || typeof value.choice !== 'string') return refuse('invalid-request'); diff --git a/packages/webui/src/public/bus.css b/packages/webui/src/public/bus.css index fbd5a703e..0fc519f95 100644 --- a/packages/webui/src/public/bus.css +++ b/packages/webui/src/public/bus.css @@ -60,6 +60,10 @@ table.s1-roles td,table.s1-roles th { overflow-wrap:normal; word-break:normal; } table.s1-roles { min-width: 0; width: 100%; table-layout: fixed; } table.s1-roles td, table.s1-roles th { overflow-wrap: anywhere; } } +/* D4 (#1873): the hire form on the org-mode workspace inbox. */ +html[data-organizations] #hire-start.ws-hire{margin-top:22px} +html[data-organizations] #hire-start.ws-hire h2{margin:0 0 4px;font-size:16px} +html[data-organizations] #hire-start.ws-hire select{min-height:40px;padding:6px 10px;border:1px solid var(--border);border-radius:6px;background:var(--surface);color:var(--text);font:inherit;max-width:100%} /* A4: use the Console's controls for authority proposals and keep grant labels beside their checkboxes. */ #hire-start form,#hire-adjust{max-width:680px} #hire-start form>label,#hire-adjust>label{display:grid;gap:5px;margin:12px 0;color:var(--text)} diff --git a/packages/webui/src/public/bus.js b/packages/webui/src/public/bus.js index 054639e45..e4a871cf0 100644 --- a/packages/webui/src/public/bus.js +++ b/packages/webui/src/public/bus.js @@ -427,20 +427,26 @@ route:{harness:$('hire-route-harness').value.trim(),model:$('hire-route-model').value.trim(),...(thinking?{thinking}:{})}}; } const HIRE_START_LABEL='Record and approve'; - let hireDraft={op:'hire',level:'org'},hireTemplates=[],hireBusy=false,hireStatus=''; + let hireDraft={op:'hire',level:'org'},hireTemplates=[],hireBusy=false,hireStatus='',hireCode=''; + // D4 (#1873, P0-1): an org Console shows this form on the workspace inbox. Its posts go to the + // current organization's bus (display.js), so the organization is that one and is not editable. + const hireOrg=()=>window.MosaicOrg?.id ?? null; function hireStartHtml() { if(!canDecide)return ''; - const d=hireDraft,off=hireBusy?' disabled':''; - const input=(key,label,extra='')=>``; - return `

Hire, fire or change an agent

- ${input('business','Organization','required')} - - + const org=hireOrg(),d=hireDraft,off=hireBusy?' disabled':''; + const input=(key,label,extra='')=>``; + const select=(key,label,options)=>``; + const business=org?`

This hire goes to ${txt(org)}'s bus. Switch organization to hire elsewhere.

`:input('business','Organization','required'); + const status=`${txt(hireStatus)}${hireCode?` (${txt(hireCode)})`:''}`; + return `

Hire, fire or change an agent

+ ${business} + ${select('op','Operation',['hire','fire','change'].map(v=>`${v}`).join(''))} + ${select('level','Level',['org','project','root'].map(v=>`${v}`).join(''))} ${input('project','Project (project level only)')}${input('name','Agent name','required')} - + ${select('template','Role template',`${hireTemplates.map(t=>``).join('')}`)} ${input('harness','Harness')}${input('model','Model')}${input('thinking','Thinking (optional)')}${input('reason','Reason','required')}

Submitting raises and approves one decision. Flagged grants and credentials require the owner; root agents require the instance owner.

-

${txt(hireStatus)}

`; +

${status}

`; } function paintHireStart() {const e=$('hire-start');if(e)e.outerHTML=hireStartHtml();} document.addEventListener('input',e=>{const f=e.target.closest?.('[data-hire-field]');if(f)hireDraft[f.dataset.hireField]=f.value;}); @@ -448,15 +454,15 @@ async function hireSubmit(templatesOnly=false) { if(hireBusy || out() || !canDecide)return; const d={...hireDraft},template=hireTemplates.find(t=>t.name===d.template); - if(!templatesOnly && d.op!=='fire' && !template){hireStatus='Read and choose a role template first.';paintHireStart();return;} + if(!templatesOnly && d.op!=='fire' && !template){hireStatus='Read and choose a role template first.';hireCode='';paintHireStart();return;} const thinking=d.thinking?.trim(),hire={op:d.op,level:d.level,name:d.name,reason:d.reason,...(d.level==='project'?{project:d.project}:{}),...(d.op==='fire'?{}:{role:{template:template?.name,sha256:template?.sha256},route:{harness:d.harness,model:d.model,...(thinking?{thinking}:{})}})}; - hireBusy=true;hireStatus='';paintHireStart(); - const {res,json}=await decidePost(`/api/decisions/hire/${templatesOnly?'templates':'start'}`,{business:d.business,...(templatesOnly?{}:{hire})}); + hireBusy=true;hireStatus='';hireCode='';paintHireStart(); + const {res,json}=await decidePost(`/api/decisions/hire/${templatesOnly?'templates':'start'}`,{business:hireOrg() ?? d.business,...(templatesOnly?{}:{hire})}); hireBusy=false; if(res?.type==='opaqueredirect'){signOut();return;} if(res?.ok && templatesOnly && Array.isArray(json?.templates)){hireTemplates=json.templates;hireStatus=hireTemplates.length?'Templates read.':'No templates available.';} else if(res?.ok && !templatesOnly && json?.op==='resolved'){hireStatus=`Recorded decision ${json.id}.`;} - else hireStatus=decideRefusal(res,json,templatesOnly?'confirmation-unavailable':'outcome-unknown').message; + else {const r=decideRefusal(res,json,templatesOnly?'confirmation-unavailable':'outcome-unknown');hireStatus=r.message;hireCode=r.code;} paintHireStart(); } document.addEventListener('click',e=>{if(e.target.closest?.('[data-hire-load]'))hireSubmit(true);}); @@ -1524,7 +1530,7 @@ if (n === 0 && window.MosaicOrg) return window.MosaicWorkspace.home(); if (a === 'projects' && n === 1 && window.MosaicOrg) return window.MosaicWorkspace.projectsPage(q); if (a === 'organization' && n === 1 && window.MosaicOrg) return window.MosaicWorkspace.dashboard(); - if (a === 'inbox' && n === 1 && window.MosaicOrg) return window.MosaicWorkspace.inboxPage(q); + if (a === 'inbox' && n === 1 && window.MosaicOrg) return configRead.then(() => window.MosaicWorkspace.inboxPage(q, { hire: hireStartHtml() })); if (a === 'tasks' && n === 1 && window.MosaicOrg) return window.MosaicTasksBoard.view(); if (a === 'inbox' && n === 1) return inboxView(get); if (a === 'inbox' && n === 2) return SAFE.test(b) ? decisionView(get, b, current) : notFound(`${txt(b)} is not a decision id.`); diff --git a/packages/webui/src/public/workspace.js b/packages/webui/src/public/workspace.js index 9ac75976e..5e902af71 100644 --- a/packages/webui/src/public/workspace.js +++ b/packages/webui/src/public/workspace.js @@ -663,7 +663,8 @@ } // ---- inbox across organizations (sample 05) ---- - async function inboxPage(q) { + // `opts.hire`: the hire, fire and change form bus.js builds for the current organization (D4, P0-1). + async function inboxPage(q, opts = {}) { const org = listParam(q, 'org', id => ORG_ID.test(id)); const want = String(q?.get?.('d') || ''); let body, all; @@ -722,7 +723,8 @@ ${unread}
${table} ${secH('Answered today', 'kept for 24 hours, then in the trail')} -

Answered and expired items are not built yet.

+

Answered and expired items are not built yet.

+ ${typeof opts?.hire === 'string' ? opts.hire : ''}
${insp} `; diff --git a/packages/webui/tests/decision-http.test.mjs b/packages/webui/tests/decision-http.test.mjs index b9f4e597b..429a1da78 100644 --- a/packages/webui/tests/decision-http.test.mjs +++ b/packages/webui/tests/decision-http.test.mjs @@ -292,3 +292,55 @@ test('A4 confirmation holds the exact human adjustment, so resolve cannot substi const r=await s.resolve({choice:'new/autonomous',confirmation:c.json().confirmation}); assert.equal(r.status,200,r.text);assert.deepEqual(s.calls[1].args.adjust,adjust); }); + +// D4 (#1873, P1-2): a hire start the bus definitely refused keeps its own code and a next step; a +// lost or unreadable reply is still outcome-unknown, and the other steps keep their mapping. +const START_HIRE={op:'hire',level:'org',name:'scout',reason:'Need help',role:{template:'coder',sha256:DIGEST},route:{harness:'pi',model:'gone-model'}}; +const startWith=async err=>{ + const s=setup({resolve:()=>{throw err;}}); + const r=await s.run('/api/decisions/hire/start',request({body:{business:'demo',hire:START_HIRE}})); + assert.equal(s.calls.length,1,'one bus call, never retried'); + return {r,s}; +}; +test('D4 hire start: model-provider-unavailable keeps its code and names Settings > Model proxy',async()=>{ + const {r,s}=await startWith(new BusReadError('model-provider-unavailable')); + assert.equal(r.status,409,r.text); + const body=r.json(); + assert.equal(body.error,'model-provider-unavailable'); + assert.match(body.message,/Settings > Model proxy/); + assert.match(body.message,/not applied/); + assert.equal(r.headers['cache-control'],'no-store'); + assert.match(s.lines.at(-1),/step=start error=model-provider-unavailable$/); +}); +test('D4 hire start: the other model route codes keep their code with a next step',async()=>{ + for(const [code,status] of [['model-catalogue-unavailable',503],['model-harness-incompatible',409],['thinking-unsupported',409]]) { + const {r}=await startWith(new BusReadError(code)); + assert.equal(r.status,status,`${code}: ${r.text}`);assert.equal(r.json().error,code);assert.match(r.json().message,/not applied/); + } +}); +test('D4 hire start: any other definite code is named and never claims nothing was recorded',async()=>{ + const {r}=await startWith(new BusReadError('definition-not-hireable')); + assert.equal(r.status,409,r.text); + assert.deepEqual(r.json(),{error:'definition-not-hireable',message:'The bus refused this hire (definition-not-hireable). Refresh the inbox to see whether a hire decision is open before trying again.'}); +}); +test('D4 hire start: a lost or unreadable reply is still outcome-unknown',async()=>{ + for(const err of [new BusReadError('outcome-unknown'),new BusReadError('invalid-response'),new BusReadError('response-too-large'),new BusReadError('outcome-unknown-revoked'),new BusReadError('Not A Code'),new BusReadError(''),new Error('socket closed'),Object.assign(new Error('x'),{code:'model-provider-unavailable'})]) + refused((await startWith(err)).r,'outcome-unknown'); + // A reply that does not say the hire resolved yes is not a refusal either. + const s=setup({resolve:()=>({id:'new-hire',op:'resolved',choice:'no'})}); + refused(await s.run('/api/decisions/hire/start',request({body:{business:'demo',hire:START_HIRE}})),'outcome-unknown'); +}); +test('D4 hire start: the bus codes the endpoint already names keep their refusal',async()=>{ + refused((await startWith(new BusReadError('unauthenticated'))).r,'human-required'); + refused((await startWith(new BusReadError('right-required'))).r,'right-required'); + refused((await startWith(new BusReadError('hire-owner-required'))).r,'hire-owner-required'); +}); +test('D4 templates, confirmation and resolve keep their open mapping for a definite unnamed code',async()=>{ + const t=setup({resolve:()=>{throw new BusReadError('model-provider-unavailable');}}); + refused(await t.run('/api/decisions/hire/templates',request({body:{business:'demo'}})),'confirmation-unavailable'); + const c=setup({answer:()=>{throw new BusReadError('model-provider-unavailable');}}); + refused(await c.confirm('yes'),'confirmation-unavailable'); + const s=setup({resolve:()=>{throw new BusReadError('model-provider-unavailable');}}); + const ok=await s.confirm('yes');assert.equal(ok.status,200); + refused(await s.resolve({choice:'yes',confirmation:ok.json().confirmation}),'outcome-unknown'); +}); diff --git a/packages/webui/tests/hire-inbox-browser.test.mjs b/packages/webui/tests/hire-inbox-browser.test.mjs new file mode 100644 index 000000000..ddea284a6 --- /dev/null +++ b/packages/webui/tests/hire-inbox-browser.test.mjs @@ -0,0 +1,129 @@ +// D4 (#1873, readiness P0-1 and P1-2): on an org Console the hire, fire and change form is on the +// workspace inbox (#/inbox), posts through the real decision endpoint to the current organization's +// bus, and shows a definite refusal by its own code and next step. A lost reply stays outcome-unknown. +// The bus is a fake decision transport behind the real server, page code and decision endpoint. +import { test } from 'node:test'; +import assert from 'node:assert/strict'; +import { mkdir } from 'node:fs/promises'; +import { join } from 'node:path'; +import { startServer } from '../src/serve.mjs'; +import { createDevOwner } from '../src/dev-owner.mjs'; +import { BusReadError } from '../src/bus.mjs'; +import { browser } from './browser.mjs'; +import { close } from './fixture.mjs'; + +const waitFor = b => expression => b.evaluate(`(async()=>{for(let i=0;i<200;i++){if(${expression})return;await new Promise(r=>setTimeout(r,30))}throw Error(${JSON.stringify(expression)})})()`); +const SHA = 'b'.repeat(64); +const DECISION = 'dec-acme-0001'; + +// One running organization. `decide` gives it the send and decision transports a --send Console has. +function organizations({ decide, calls }) { + const LIST = [{ id: 'acme', label: 'Acme Studio', theme: 'cobalt', busHealthy: true }]; + const inbox = [{ id: DECISION, question: 'Ship the hero?', class: 'gated', blocking: false, raised_by_role: 'coder', at: new Date(Date.now() - 600000).toISOString(), options: [{ key: 'yes', text: 'Ship it' }, { key: 'no', text: 'Hold' }] }]; + const reads = { inbox: async () => inbox, agents: async () => [], 'thread.claims': async () => [], tasks: async () => [], usage: async () => ({}), limits: async () => ({}), decisions: async () => [] }; + // The model name picks the bus answer: a refusal before the decision exists, a lost reply, or a hire. + const decisionWrite = async (verb, args, ctx) => { + calls.push({ verb, args, ctx }); + if (verb === 'hire.templates.console') return { templates: [{ name: 'coder', sha256: SHA }] }; + if (verb !== 'hire.start.console') throw new BusReadError('decision-not-found'); + if (args.route?.model === 'gone-model') throw new BusReadError('model-provider-unavailable'); + if (args.route?.model === 'lost-model') throw new BusReadError('outcome-unknown'); + return { id: 'dec-hire-1', op: 'resolved', choice: 'yes' }; + }; + return { + list: async () => LIST, + members: async () => LIST.map(org => ({ id: org.id, doc: { appearance: { theme: org.theme } }, status: async () => ({ healthy: true, pid: 4242, boot: null }), options: () => ({ bus: reads, chat: { threads: async () => [], projects: async () => [] } }) })), + resolve: async id => id !== 'acme' ? null : { + busHealthy: true, + reads: { business: async () => ({ business: { id, human: 'jason', projects: [] } }), settings: async () => ({}), queue: async () => ({ rows: [] }), busStatus: async () => ({}) }, + bus: { messages: async () => ({ messages: [], unread: 0 }), agents: async () => [], 'thread.claims': async () => [], inbox: async () => inbox.map(d => ({ ...d, business: id, raised_by_run: 'run', routed_to: 'human' })), tasks: async () => [], instances: async () => ({ business: id, instances: {} }) }, + chat: { projects: async () => [], threads: async () => [] }, + ...(decide ? { send: async () => ({}), decisionWrite } : {}), + }, + }; +} + +async function setup(t, { decide = true, viewport = [1440, 900] } = {}) { + const calls = []; + const server = await startServer({ port: 0, sso: createDevOwner(), organizations: organizations({ decide, calls }), log: () => {} }); + t.after(() => close(server)); + const b = await browser({ machine: false }); t.after(() => b.close()); + await b.viewport(...viewport); + const base = `http://127.0.0.1:${server.address().port}`; + await b.navigate(`${base}/#/orgs/acme/inbox`); + return { b, calls, wait: waitFor(b), text: sel => b.evaluate(`document.querySelector(${JSON.stringify(sel)})?.innerText ?? null`) }; +} +// MOSAIC_UX_SHOTS= also saves light and dark shots; `at` is the element centred in view. +const shots = async (b, name, width, at) => { + const dir = process.env.MOSAIC_UX_SHOTS; + if (!dir) return; + await mkdir(dir, { recursive: true }); + for (const mode of ['light', 'dark']) { + await b.evaluate(`document.documentElement.dataset.mode=${JSON.stringify(mode)};document.querySelector(${JSON.stringify(at)}).scrollIntoView({block:'center'})`); + await b.screenshot(join(dir, `inbox-hire-${name}-${width}-${mode}.png`)); + } +}; +const fill = (b, values) => b.evaluate(`for (const [k, v] of Object.entries(${JSON.stringify(values)})) { const e = document.querySelector('[data-hire-field="' + k + '"]'); e.value = v; e.dispatchEvent(new Event('input', { bubbles: true })); }`); + +for (const [width, height] of [[1440, 900], [390, 844]]) test(`D4 the org-mode inbox at ${width}px starts a hire on the current organization's bus, and a definite refusal keeps its code`, { timeout: 120000 }, async t => { + const { b, calls, wait, text } = await setup(t, { viewport: [width, height] }); + await wait('document.querySelector("[data-ws-inbox] [data-ws-item]")'); + // P0-1: the form is on the workspace inbox, beside the cross-organization list, not a separate page. + await wait('document.querySelector("[data-ws-inbox] #hire-start #hire-start-form")'); + assert.match(await text('#hire-start h2'), /Hire, fire or change an agent/); + // The organization is the current one and is not editable: the posts go to its bus. + assert.equal(await b.evaluate('document.querySelector("[data-hire-field=business]")'), null); + assert.deepEqual(await b.evaluate('(e => [e.value, e.readOnly])(document.querySelector("#hire-start input[readonly]"))'), ['acme', true]); + assert.match(await text('#hire-start-org'), /acme's bus/); + await b.evaluate('document.querySelector("[data-hire-load]").click()'); + await wait('document.querySelector("[data-hire-field=template] option[value=coder]")'); + assert.deepEqual(calls.map(c => [c.verb, c.ctx.business]), [['hire.templates.console', 'acme']]); + assert.equal(await b.evaluate('document.documentElement.scrollWidth <= innerWidth'), true); + await shots(b, 'form', width, '#hire-start h2'); + + // P1-2: the bus refuses before it records anything; the page shows that code and its next step. + await fill(b, { name: 'scout', template: 'coder', harness: 'pi', model: 'gone-model', reason: 'Need a coder' }); + await b.evaluate('document.querySelector("#hire-start-form").requestSubmit()'); + await wait('document.querySelector("#hire-start-status code")'); + assert.equal(await text('#hire-start-status code'), 'model-provider-unavailable'); + assert.match(await text('#hire-start-status'), /Settings > Model proxy/); + assert.doesNotMatch(await text('#hire-start-status'), /may have reached the bus/); + const start = calls.filter(c => c.verb === 'hire.start.console'); + assert.equal(start.length, 1, 'one start, never retried'); + assert.equal(start[0].ctx.business, 'acme'); + assert.deepEqual(start[0].args, { op: 'hire', level: 'org', name: 'scout', reason: 'Need a coder', role: { template: 'coder', sha256: SHA }, route: { harness: 'pi', model: 'gone-model' } }); + assert.equal(await b.evaluate('document.documentElement.scrollWidth <= innerWidth'), true); + await shots(b, 'refused', width, '#hire-start-status'); + + // A lost reply is still outcome-unknown. + await fill(b, { model: 'lost-model' }); + await b.evaluate('document.querySelector("#hire-start-form").requestSubmit()'); + await wait('document.querySelector("#hire-start-status code")?.textContent === "outcome-unknown"'); + assert.match(await text('#hire-start-status'), /may have reached the bus/); + + // And a hire the bus records. + await fill(b, { model: 'fixture-model' }); + await b.evaluate('document.querySelector("#hire-start-form").requestSubmit()'); + await wait('document.querySelector("#hire-start-status")?.textContent.includes("Recorded decision dec-hire-1")'); + assert.equal(await b.evaluate('document.querySelector("#hire-start-status code")'), null); + assert.equal(calls.filter(c => c.verb === 'hire.start.console').length, 3); +}); + +test('D4 a poll repaint of the inbox keeps the hire draft, focus and caret', { timeout: 120000 }, async t => { + const { b, wait } = await setup(t); + await wait('document.querySelector("#hire-start-form")'); + await fill(b, { name: 'scout', reason: 'Need a coder' }); + await b.evaluate('(e => { e.focus(); e.setSelectionRange(2, 2); })(document.querySelector("[data-hire-field=name]"))'); + await b.evaluate('window.__marker = document.querySelector("[data-ws-inbox]"); document.dispatchEvent(new CustomEvent("mosaic-workspace-render"))'); + await wait('document.querySelector("[data-ws-inbox]") && document.querySelector("[data-ws-inbox]") !== window.__marker'); + assert.equal(await b.evaluate('document.activeElement?.dataset.focusKey'), 'hire:name'); + assert.deepEqual(await b.evaluate('[document.activeElement.value, document.activeElement.selectionStart]'), ['scout', 2]); + assert.equal(await b.evaluate('document.querySelector("[data-hire-field=reason]").value'), 'Need a coder'); +}); + +test('D4 without decision answers (no --send) the org-mode inbox shows no hire form', { timeout: 120000 }, async t => { + const { b, calls, wait } = await setup(t, { decide: false }); + await wait('document.querySelector("[data-ws-inbox] [data-ws-item]")'); + assert.equal(await b.evaluate('document.querySelector("#hire-start")'), null); + assert.equal(calls.length, 0); +});