const test=require('node:test'),assert=require('node:assert/strict'),fs=require('node:fs'),path=require('node:path'); const R=path.dirname(__dirname),load=p=>JSON.parse(fs.readFileSync(path.join(R,p),'utf8')); const p=load('delivery_blocks/source.json'),copy=load('delivery_blocks/copy.json'); test('whole project scope has three blocks, no new live authority or forecast',()=>{ assert.equal(p.scope,'whole_project_not_only_ai');assert.equal(p.blocks.length,3); assert.equal(p.approvedForLiveUse,false);assert.equal(p.forecastChanged,false);assert.equal(p.budgetReallocated,false); assert.deepEqual(p.milestones,{alphaMonth:3,controlledPilotMonth:5,limitedLaunchMonth:9,paidActivationMonth:10}); assert.equal(p.monthOneGate.actualReceivedUSD,1000000);assert.equal(p.monthOneGate.actualReceiptDate,null); }); test('85 unique screens mapped, not 85 initial full product deliveries',()=>{ const screens=p.groups.flatMap(g=>g.screens);assert.equal(screens.length,85);assert.equal(new Set(screens).size,85); assert.equal(p.groups.find(g=>g.key==='references').block,null); assert.ok(p.groups.some(g=>g.block===1));assert.ok(p.groups.some(g=>g.block===2)); for(const key of ['monitor','ecosystem','retail','advanced_ai'])assert.equal(p.groups.find(g=>g.key===key).block,3); }); test('first launch preserves qualified buyer route and minimum own-rail BI',()=>{ assert.match(p.groups.find(g=>g.key==='retail').boundary,/qualified individuals/); assert.match(p.groups.find(g=>g.key==='reporting').firstLaunchSlice,/own approved records/); assert.match(p.groups.find(g=>g.key==='reporting').deferredSlice,/Block 3/); }); test('points bookkeeping does not activate GO or promise airdrop',()=>{ const points=p.groups.find(g=>g.key==='points');assert.equal(points.block,2); assert.match(points.firstLaunchSlice,/No GO claim, conversion or guaranteed airdrop/); const g=p.blocks[2].goLaunchGates;assert.equal(g.seedCloseRequired,true);assert.equal(g.targetMonthsAfterSeed,3);assert.equal(g.eligibleMonthlyVolumeUSD,10000000); assert.equal(g.actualSeedDate,null);assert.equal(g.actualEligibleMonthlyVolumeUSD,null); }); test('security and exact external reconciliation are not deferred with automation',()=>{ const controls=p.blocks[0].cannotDefer; for(const s of ['authorization_and_tenant_isolation','evidence_provenance','exact_amounts','deterministic_permissions','audit_history','human_decisions','cost_metering_and_limits_for_any_active_agent'])assert.ok(controls.includes(s)); assert.ok(p.blocks[1].exitGates.includes('independent_reconciliation_and_exception_handling')); assert.equal(p.blocks[1].constraints.custodyOrTokenIssuanceByGlemo,false); }); test('tech phase arithmetic is an existing allocation, not a new quote',()=>{ const b=p.budgetBoundary;assert.equal(b.existingModelTechnologyM1ToM3USD+b.existingModelTechnologyM4ToM9USD+b.existingModelTechnologyM10ToM24USD,b.technology24MonthsUSD); assert.equal(b.technology24MonthsUSD,650000);assert.equal(b.postLaunchUnallocatedTechnologyUSD,null);assert.equal(b.incrementalMonitorBudgetApproved,false); assert.equal(p.blocks[2].seedRequiredForEveryPostLaunchFeature,false); }); test('proposed AI stages cover 13 core agents exactly, exclude Monitor workers',()=>{ const a=p.agentPhasing,all=[...a.m3,...a.pilotAdditions,...a.launchAdditions,...a.postLaunch]; assert.equal(a.status,'founder_confirmed_product_direction_cto_capacity_acceptance_pending'); assert.equal(a.m3.length,5);assert.equal(a.m3.length+a.pilotAdditions.length,8);assert.equal(a.m3.length+a.pilotAdditions.length+a.launchAdditions.length,10); assert.equal(all.length,13);assert.equal(new Set(all).size,13);assert.equal(a.actualRunningCoreAgents,0);assert.equal(a.actualRunningMonitorAgents,0); assert.equal(a.monitorWorkersIncludedInM3OrM9Count,false);assert.equal(a.meteringAndPermissionControlsMayBeDeferred,false); const cat=load('ai_native/catalog.json'),registry=load('ai_native/contracts/registry.json'); for(const agent of cat.agents){assert.ok(all.includes(agent.id));assert.equal(agent.rolloutApproved,false);assert.equal(agent.rollout,registry.agents.find(x=>x.id===agent.id).rollout);} }); test('Monitor is explicitly post-launch in both implementation contracts',()=>{ for(const name of ['implementation-contract.json','implementation-plan.json']){ const d=load('monitor_data_center/'+name);assert.equal(d.deliveryBlock,3);assert.equal(d.coreLaunchDependency,false);assert.equal(d.approvedStartMonth,null); } }); for(const l of ['en','pt','es','fr','ar','zh'])test('complete scope translation and text download: '+l,()=>{ const c=copy[l];assert.deepEqual(Object.keys(c).sort(),Object.keys(copy.en).sort()); assert.equal(c.blockNames.length,3);assert.equal(c.blockBullets.length,3);assert.ok(c.blockBullets.every(b=>b.length===5)); for(const g of p.groups)assert.ok(c.groupNames[g.key]); const text=fs.readFileSync(path.join(R,`delivery_blocks/index_${l}.txt`),'utf8'); for(const s of p.groups.flatMap(g=>g.screens))assert.ok(text.includes(s)); assert.ok(text.includes(c.startGate));assert.ok(text.includes(c.agentsStatus));assert.ok(text.includes(c.budget)); assert.ok(fs.existsSync(path.join(R,`dev_toolkit/docs/${l}/19_THREE_BLOCK_DELIVERY.html`))); });