Allow audited Owner Home Block release and one free registration

This commit is contained in:
unimatrixgit 2026-11-29 23:04:00 +01:00
commit 46d13ea03e
7 changed files with 149 additions and 3 deletions

View file

@ -17,6 +17,7 @@ import {boardingOpen,gameHomeLocation,transportDestination,gameOrganisationError
import {expandRegisteredClaim,registeredClaimChunks,CLAIM_DIRECTIONS} from './game-claim-expansion.mjs';
import {claimTariffs} from '../control-panel/public/cp-v2/cp-v2-claim-tariffs.mjs';
import {entityId} from './postbank-authority.mjs';
import {releasedHomeBlockInstruction} from './homeblock-release-proof.mjs';
export const GAME_ORGANISATION_SCHEMA=`CREATE TABLE IF NOT EXISTS jarvis_game_organisation_actions(request_id CHAR(36) PRIMARY KEY,key_id CHAR(36) NOT NULL,account_id CHAR(36) NOT NULL,minecraft_uuid CHAR(36) NOT NULL,action_id VARCHAR(32) NOT NULL,input_hash CHAR(64) NOT NULL,result_json TEXT NOT NULL,state VARCHAR(16) NOT NULL,expires_at BIGINT NOT NULL,created_at BIGINT NOT NULL,INDEX game_arrival(minecraft_uuid,state,expires_at)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4`;
const arrays={clan:'clans',company:'companies',protected:'offices'};
@ -80,7 +81,8 @@ export function createGameOrganisations(db,keys,{clock=Date.now,readState=()=>re
if(existing?.source==='minecraft'&&existing.homeBlock&&['x','y','z'].some(k=>existing.homeBlock.position[k]!==location.position[k])&&!move)throw fail('Confirm a paid Home Block relocation on the website first.');
if(existing?.homeBlock&&nativeServer(existing.homeBlock.worldName)!==location.server)throw fail('The registered Home Block belongs to another world.');
// Never silently rewrite upgraded estates or their WorldEdit geometry.
if(existing&&!move&&(existing.usedChunks!==1||existing.estates?.length!==1))throw fail('This estate needs a scoped relocation; its existing claims were preserved.');
const staffRelease=existing&&!existing.homeBlock&&!move?await releasedHomeBlockInstruction(tx,input.kind,input.id,old):null;
if(existing&&!move&&!staffRelease&&(existing.usedChunks!==1||existing.estates?.length!==1))throw fail('This estate needs a scoped relocation; its existing claims were preserved.');
const active=await currentWars(tx);if(active.some(w=>(w.active||w.reserved)&&(w.attackerId===input.id||w.defenderId===input.id)))throw fail('A Home Block cannot be moved while a war is scheduled or active.');
if((await extraHomeReservations(tx)).some(w=>w.attackerId===input.id||w.defenderId===input.id))throw fail('A Home Block cannot be moved while a paid Imperial raid is pending or active.');
const homes=await tx.query('SELECT organisation_kind,organisation_id,snapshot_json FROM site_claim_registry ORDER BY organisation_kind,organisation_id FOR UPDATE');

View file

@ -0,0 +1,14 @@
import {createHash} from 'node:crypto';
// A consumed staff release authorises exactly the next registration revision.
// The original estate remains in that immutable instruction, not in live claims.
export async function releasedHomeBlockInstruction(tx,kind,id,row){
const snapshot=JSON.parse(row.snapshot_json);
if(snapshot.homeBlock)return null;
const digest=createHash('sha256').update(row.snapshot_json).digest('hex');
const rows=await tx.query("SELECT i.key_id,i.fields_json,i.manifest_json FROM jarvis_generated_instructions i JOIN organisation_keys k ON k.id=i.key_id WHERE i.action_id='claims.remove-homeblock' AND i.state='applied' AND k.key_type='staff-claim' AND k.target_id=? AND k.used_at IS NOT NULL ORDER BY i.created_at DESC LIMIT 50",[id]);
for(const record of rows){
const fields=JSON.parse(record.fields_json),manifest=JSON.parse(record.manifest_json),receipt=manifest.receipt;
if(fields.kind===kind&&fields.id===id&&fields.expectedRevision+1===Number(row.revision)&&receipt?.keyId===record.key_id&&receipt.kind===kind&&receipt.id===id&&receipt.revision===Number(row.revision)&&receipt.releasedSnapshotHash===digest)return record.key_id;
}
return null;
}

View file

@ -0,0 +1,36 @@
import {createHash} from 'node:crypto';
import {OFFICIAL_ACCOUNT} from './official-account.mjs';
import {createStaffHomeBlockKeys} from './staff-homeblock-keys.mjs';
const first=async(db,sql,args=[])=>db.first?db.first(sql,args):(await db.query(sql,args))[0]||null;
const digest=value=>createHash('sha256').update(value).digest('hex');
export async function ownerHomeBlockAuthority(db,clanId=null){
const actor=await first(db,"SELECT a.id,a.username FROM site_accounts a JOIN org_control_principals p ON p.user_id=a.id WHERE a.id=? AND a.username='unimatrix999' AND a.password_hash NOT LIKE '!%' AND p.principal_kind='owner'",[OFFICIAL_ACCOUNT.ownerId]);
if(!actor)throw Error('Existing protected Owner authority required');
const clans=await db.query('SELECT id,name FROM site_clans WHERE owner_id=? AND active=1',[actor.id]);
if(clans.length!==1||clanId&&clans[0].id!==clanId)throw Error('Exactly one matching active owned clan required');
return {actor,clan:clans[0]};
}
export async function ownerHomeBlockPlan(db){
const {actor,clan}=await ownerHomeBlockAuthority(db);
const row=await first(db,"SELECT snapshot_json,revision FROM site_claim_registry WHERE organisation_kind='clan' AND organisation_id=?",[clan.id]);
if(!row||!JSON.parse(row.snapshot_json).homeBlock)throw Error('The clan has no Home Block to release');
return {actorId:actor.id,clanId:clan.id,clanName:clan.name,revision:Number(row.revision),snapshotHash:digest(row.snapshot_json),homeBlockId:JSON.parse(row.snapshot_json).homeBlock.id};
}
export async function applyOwnerHomeBlockRelease(db,keys,plan,{requestId}={}){
const {actor}=await ownerHomeBlockAuthority(db,plan.clanId);
if(plan.actorId!==actor.id)throw Error('Owner release plan identity mismatch');
const prior=await first(db,"SELECT fields_json,manifest_json,state FROM jarvis_generated_instructions WHERE request_id=? AND action_id='claims.remove-homeblock'",[requestId]);
if(prior){const fields=JSON.parse(prior.fields_json),manifest=JSON.parse(prior.manifest_json);if(fields.kind!=='clan'||fields.id!==plan.clanId||fields.expectedRevision!==plan.revision||manifest.actorId!==actor.id||manifest.snapshotHash!==plan.snapshotHash)throw Error('Release reference belongs to another instruction');}
else{const current=await ownerHomeBlockPlan(db);if(JSON.stringify(current)!==JSON.stringify(plan))throw Error('Home Block changed; review a fresh release plan');}
const service=createStaffHomeBlockKeys(db,keys,{authorizeStaff:async(user,tx)=>{
await tx.query('SELECT id FROM site_accounts WHERE id=? FOR UPDATE',[actor.id]);
await tx.query('SELECT user_id FROM org_control_principals WHERE user_id=? FOR SHARE',[actor.id]);
await tx.query('SELECT id FROM site_clans WHERE id=? FOR UPDATE',[plan.clanId]);
if(!prior){const current=await first(tx,"SELECT snapshot_json,revision FROM site_claim_registry WHERE organisation_kind='clan' AND organisation_id=?",[plan.clanId]);if(!current||Number(current.revision)!==plan.revision||digest(current.snapshot_json)!==plan.snapshotHash)throw Error('Home Block changed; review a fresh release plan');}
return user.id===(await ownerHomeBlockAuthority(tx,plan.clanId)).actor.id;
}});
const key=await service.issue(actor,{kind:'clan',id:plan.clanId,expectedRevision:plan.revision,ticketId:'owner-home-reset',reason:'Owner requested a free Home Block reset',requestId});
await service.apply(actor,{keyId:key.keyId,requestId});
const saved=await first(db,'SELECT manifest_json FROM jarvis_generated_instructions WHERE key_id=?',[key.keyId]);
return {released:true,...JSON.parse(saved.manifest_json).receipt};
}

View file

@ -16,7 +16,7 @@ export function createStaffHomeBlockKeys(db,keys,{authorizeStaff,clock=Date.now}
const grant=await keys.issue({accountId:STAFF_OFFICE_ACCOUNT_ID,keyType:'staff-claim',scopeId:scope,authorize:async(tx,{keyId})=>{
await allowed(actor,tx);const prior=await tx.first('SELECT fields_json,manifest_json FROM jarvis_generated_instructions WHERE request_id=?',[input.requestId]);if(prior){if(prior.fields_json!==JSON.stringify(fields)||JSON.parse(prior.manifest_json).actorId!==actor.id)fail('Staff Home Block reference conflict');return;}
const row=await tx.first('SELECT * FROM site_claim_registry WHERE organisation_kind=? AND organisation_id=? FOR UPDATE',[input.kind,input.id]);if(!row||Number(row.revision)!==input.expectedRevision||!JSON.parse(row.snapshot_json).homeBlock)fail('Current Home Block revision required');
const manifest={actorId:actor.id,snapshotHash:hash(row.snapshot_json),previousHomeBlock:JSON.parse(row.snapshot_json).homeBlock};
const manifest={actorId:actor.id,snapshotHash:hash(row.snapshot_json),previousHomeBlock:JSON.parse(row.snapshot_json).homeBlock,previousSnapshot:JSON.parse(row.snapshot_json)};
await tx.query("INSERT INTO jarvis_generated_instructions(key_id,request_id,account_id,action_id,template_version,fields_json,manifest_json,state,created_at) VALUES(?,?,?,?,1,?,?,'issued',?)",[keyId,input.requestId,actor.id,action,JSON.stringify(fields),JSON.stringify(manifest),clock()]);
}});return {keyId:grant.id,created:grant.created};
},
@ -29,7 +29,7 @@ export function createStaffHomeBlockKeys(db,keys,{authorizeStaff,clock=Date.now}
const locked=await tx.first('SELECT * FROM site_claim_registry WHERE organisation_kind=? AND organisation_id=? FOR UPDATE',[fields.kind,fields.id]);if(!locked||Number(locked.revision)!==fields.expectedRevision||hash(locked.snapshot_json)!==manifest.snapshotHash)fail('The Home Block changed; review the staff instruction');
const snapshot=JSON.parse(locked.snapshot_json);snapshot.homeBlock=null;
await tx.query('UPDATE site_claim_registry SET snapshot_json=?,revision=revision+1,updated_at=? WHERE organisation_kind=? AND organisation_id=?',[JSON.stringify(snapshot),clock(),fields.kind,fields.id]);
manifest.receipt={keyId,requestId,kind:fields.kind,id:fields.id,revision:fields.expectedRevision+1,actorId:actor.id,appliedAt:clock()};
manifest.receipt={keyId,requestId,kind:fields.kind,id:fields.id,revision:fields.expectedRevision+1,actorId:actor.id,appliedAt:clock(),releasedSnapshotHash:hash(JSON.stringify(snapshot))};
await tx.query("UPDATE jarvis_generated_instructions SET state='applied',manifest_json=? WHERE key_id=?",[JSON.stringify(manifest),keyId]);
await tx.query('INSERT INTO account_audit(id,actor_id,action,details,created_at) VALUES(?,?,?,?,?)',[randomUUID(),actor.id,'staff-homeblock-removed',JSON.stringify({...fields,keyId,requestId}),clock()]);
}});

View file

@ -0,0 +1,14 @@
# Owner Home Block release
Run only the committed helper from the exact reviewed immutable production release:
```
node ops/release-owner-homeblock.mjs --source=FULL_COMMIT --request-id=STABLE_UUID
node ops/release-owner-homeblock.mjs --source=FULL_COMMIT --request-id=STABLE_UUID --apply
```
The first call is read-only. Apply requires the existing protected Owner account and its one active owned clan, locks current authority, and uses the original staff Home Block key issue/consume service. No public endpoint, role grant, financial operation, schema initialisation or secret creation is added. The operation journal contains only its source, IDs and reviewed revision/hash; it is not a world/database backup. Reuse that same source and request ID after an uncertain outcome.
Release clears only the marker and records the prior estate snapshot in the immutable staff instruction. Native claim protection pauses while no marker is registered. The next ordinary in-game registration can place a fresh one-chunk estate without the relocation fee, but only when its current revision and full released snapshot hash match that consumed staff instruction. The purchased claim tier remains, so its capacity can be expanded again through the existing flow. Old geometry remains in the original instruction rather than continuing to protect the old site. Existing management, planet, overlapping-claim, war and paid-raid restrictions still apply. Subsequent moves require the usual relocation flow.
Verify the issued key/instruction receipt, marker removal, retained clan/member/tier records and native projection separately. Do not simulate a player's next placement or debit money to test this operation.

View file

@ -0,0 +1,33 @@
import {readFile,writeFile,mkdir,realpath,lstat} from 'node:fs/promises';
import {fileURLToPath,pathToFileURL} from 'node:url';
import {resolve} from 'node:path';
import mysql from 'mysql2/promise';
import {ownerHomeBlockPlan,applyOwnerHomeBlockRelease} from '../node/owner-homeblock-release.mjs';
import {createOrganisationKeys} from '../node/organisation-keys.mjs';
import {createCodexEditions} from '../node/codex-editions.mjs';
import {currentCodexEdition} from '../node/organisation-key-service.mjs';
async function main(){
const args=process.argv.slice(2),value=name=>args.find(a=>a.startsWith('--'+name+'='))?.slice(name.length+3),source=value('source'),requestId=value('request-id');
if(!/^[a-f0-9]{40}$/.test(source||'')||!/^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/i.test(requestId||'')||args.some(a=>a!=='--apply'&&!/^--(?:source|request-id)=/.test(a)))throw Error('Reviewed source and stable operation UUID required');
const release=await realpath(fileURLToPath(new URL('..',import.meta.url)));if(!release.endsWith('/releases/ci-'+source))throw Error('Run the exact immutable reviewed release helper');
process.loadEnvFile('/home/dunerealms/.config/dunerealms.env');const e=process.env;
const c=await mysql.createConnection({host:e.DB_HOST||'127.0.0.1',port:Number(e.DB_PORT||3306),user:e.DB_USER,password:e.DB_PASSWORD,database:e.DB_NAME,multipleStatements:false});let active=false;
const db={query:async(sql,v=[])=> (await c.execute(sql,v))[0],async first(sql,v=[]){return (await this.query(sql,v))[0]||null;},async transaction(work){if(active)throw Error('Nested key transaction refused');await c.beginTransaction();active=true;try{const result=await work(db);await c.commit();return result;}catch(error){await c.rollback();throw error;}finally{active=false;}}};
db.prepare=sql=>{let values=[];return {bind(...v){values=v;return this;},first:()=>db.first(sql,values),all:async()=>({results:await db.query(sql,values)})};};
try{
const directory=resolve('/var/lib/dunerealms-operations/owner-homeblock'),state=resolve(directory,requestId+'.json');let prior;
try{const st=await lstat(state);if(!st.isFile()||st.isSymbolicLink())throw Error('Invalid operation journal');prior=JSON.parse(await readFile(state,'utf8'));}catch(error){if(error.code!=='ENOENT')throw error;}
const plan=prior?.plan||await ownerHomeBlockPlan(db);
if(prior&&(prior.requestId!==requestId||prior.source!==source))throw Error('Operation journal binding mismatch');
const summary={source,requestId,clan:plan.clanName,revision:plan.revision,feeMinor:0,financialWrites:false};
if(!args.includes('--apply')){console.log(JSON.stringify({applied:false,...summary}));return;}
await mkdir(directory,{recursive:true,mode:0o700});if(await realpath(directory)!==directory)throw Error('Noncanonical operation directory');
if(!prior)await writeFile(state,JSON.stringify({source,requestId,plan}),{flag:'wx',mode:0o600});
let secret=e.ORGANISATION_KEY_SECRET;
if(!secret){const path=e.ORGANISATION_KEY_FILE||'/home/dunerealms/.config/organisation-keys.key',st=await lstat(path);if(!st.isFile()||st.isSymbolicLink()||(st.mode&0o077)!==0)throw Error('Existing private key file required');secret=(await readFile(path,'utf8')).trim();}
const edition=await currentCodexEdition(db,e),editions=createCodexEditions(db,{edition});
const keys=createOrganisationKeys(db,{secret,editions,foundingScope:edition.stage==='beta'?'beta-1':'original'});
const result=await applyOwnerHomeBlockRelease(db,keys,plan,{requestId});console.log(JSON.stringify({...summary,...result,applied:true}));
}finally{await c.end();}
}
if(process.argv[1]&&import.meta.url===pathToFileURL(await realpath(resolve(process.argv[1]))).href)await main();

View file

@ -0,0 +1,47 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import {randomUUID} from 'node:crypto';
import {companyFixture} from './company-deed-fixture.mjs';
import {GENERATOR_SCHEMA} from '../node/jarvis-master-generator.mjs';
import {OFFICIAL_ACCOUNT} from '../node/official-account.mjs';
import {ownerHomeBlockPlan,applyOwnerHomeBlockRelease} from '../node/owner-homeblock-release.mjs';
import {createStaffHomeBlockKeys} from '../node/staff-homeblock-keys.mjs';
import {createGameOrganisations,GAME_ORGANISATION_SCHEMA} from '../node/game-organisations.mjs';
async function schema(f){
await f.db.query(GENERATOR_SCHEMA.replace(/ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4/g,''));
f.db.sqlite.exec('CREATE TABLE account_audit(id TEXT PRIMARY KEY,actor_id TEXT,action TEXT,details TEXT CHECK(length(details)<=500),created_at INT);CREATE TABLE org_control_principals(user_id TEXT PRIMARY KEY,principal_kind TEXT);');
}
async function ownerFixture(){
const f=await companyFixture();await schema(f);const id=OFFICIAL_ACCOUNT.ownerId,clan=randomUUID();
await f.db.query("INSERT INTO site_accounts(id,username,role) VALUES(?,'unimatrix999','user')",[id]);await f.db.query("INSERT INTO org_control_principals VALUES(?,'owner')",[id]);await f.db.query("INSERT INTO site_clans VALUES(?,'Artreides',?,1)",[clan,id]);
const snapshot={organisationId:clan,source:'minecraft',tier:'KC_T4',usedChunks:16,homeBlock:{id:randomUUID(),worldUuid:randomUUID(),worldName:'arrakis',position:{x:594,y:58,z:-2053}},estates:[{id:randomUUID(),chunks:16,worldguard:{regionId:'old-region'}}]};
await f.db.query("INSERT INTO site_claim_registry VALUES('clan',?,?,4,1)",[clan,JSON.stringify(snapshot)]);return {...f,clan,snapshot};
}
test('Owner free release consumes original staff key, preserves estate and tier, bounds audit, and replays without clearing a later Home Block',async()=>{
const f=await ownerFixture();try{
const p=await ownerHomeBlockPlan(f.db),requestId=randomUUID(),r=await applyOwnerHomeBlockRelease(f.db,f.keys,p,{requestId});assert.equal(r.released,true);
const row=await f.db.first('SELECT * FROM site_claim_registry WHERE organisation_id=?',[f.clan]);assert.deepEqual(JSON.parse(row.snapshot_json),{...f.snapshot,homeBlock:null});assert.equal(row.revision,5);
const instruction=await f.db.first('SELECT * FROM jarvis_generated_instructions WHERE request_id=?',[requestId]);assert.equal(instruction.state,'applied');assert.deepEqual(JSON.parse(instruction.manifest_json).previousSnapshot,f.snapshot);
assert.equal((await f.db.first('SELECT used_at FROM organisation_keys WHERE id=?',[r.keyId])).used_at>0,true);assert.equal((await f.db.first('SELECT COUNT(*) n FROM pb_orders')).n,0);
const newer={...f.snapshot,homeBlock:{...f.snapshot.homeBlock,id:randomUUID()}};await f.db.query('UPDATE site_claim_registry SET snapshot_json=?,revision=6 WHERE organisation_id=?',[JSON.stringify(newer),f.clan]);await applyOwnerHomeBlockRelease(f.db,f.keys,p,{requestId});
assert.deepEqual(JSON.parse((await f.db.first('SELECT snapshot_json FROM site_claim_registry WHERE organisation_id=?',[f.clan])).snapshot_json),newer);assert.equal((await f.db.first('SELECT COUNT(*) n FROM account_audit')).n,1);
}finally{f.db.close();}
});
for(const mode of ['authority','owner','revision','same-revision-snapshot'])test('release refuses changed '+mode+' without removing the marker',async()=>{
const f=await ownerFixture();try{const p=await ownerHomeBlockPlan(f.db);if(mode==='authority')await f.db.query('DELETE FROM org_control_principals');if(mode==='owner')await f.db.query('UPDATE site_clans SET owner_id=?',[randomUUID()]);if(mode==='revision')await f.db.query('UPDATE site_claim_registry SET revision=5');if(mode==='same-revision-snapshot')await f.db.query('UPDATE site_claim_registry SET snapshot_json=?',[JSON.stringify({...f.snapshot,usedChunks:17})]);await assert.rejects(applyOwnerHomeBlockRelease(f.db,f.keys,p,{requestId:randomUUID()}));assert.ok(JSON.parse((await f.db.first('SELECT snapshot_json FROM site_claim_registry')).snapshot_json).homeBlock);assert.equal((await f.db.first('SELECT COUNT(*) n FROM organisation_keys')).n,0);}finally{f.db.close();}
});
test('consumed staff release authorises one free upgraded-estate re-registration, retains purchased tier and cannot bypass another relocation',async()=>{
const f=await companyFixture();try{
await schema(f);await f.db.query(GAME_ORGANISATION_SCHEMA);const id=await f.create(),uuid=randomUUID();await f.db.query('UPDATE site_game_links SET minecraft_uuid=? WHERE user_id=?',[uuid,f.people.Owner.id]);
const snapshot={organisationId:id,source:'minecraft',tier:'RCO_T3',usedChunks:16,homeBlock:{id:randomUUID(),worldUuid:randomUUID(),worldName:'caladan',position:{x:8,y:64,z:8}},estates:[{id:randomUUID(),chunks:16}]};await f.db.query("INSERT INTO site_claim_registry VALUES('company',?,?,1,1)",[id,JSON.stringify(snapshot)]);
const service=createGameOrganisations(f.db,f.keys),input={action:'set-home',kind:'company',id,uuid,requestId:randomUUID(),authorityVersion:1,expectedRevision:1,confirmed:true,location:{server:'caladan',worldName:'caladan',worldUuid:snapshot.homeBlock.worldUuid,position:{x:1000,y:64,z:1000}}};
await assert.rejects(service.execute(input),/paid Home Block relocation/);
// A manually absent marker is insufficient authority.
await f.db.query('UPDATE site_claim_registry SET snapshot_json=? WHERE organisation_id=?',[JSON.stringify({...snapshot,homeBlock:null}),id]);await assert.rejects(service.execute({...input,requestId:randomUUID()}),/scoped relocation/);await f.db.query('UPDATE site_claim_registry SET snapshot_json=? WHERE organisation_id=?',[JSON.stringify(snapshot),id]);
const staff=createStaffHomeBlockKeys(f.db,f.keys,{authorizeStaff:async()=>true}),key=await staff.issue(f.people.Owner,{kind:'company',id,expectedRevision:1,ticketId:'owner-test',reason:'Owner requested a free Home Block reset',requestId:randomUUID()});await staff.apply(f.people.Owner,{keyId:key.keyId,requestId:randomUUID()});
const released=(await f.db.first('SELECT snapshot_json FROM site_claim_registry WHERE organisation_id=?',[id])).snapshot_json;
await f.db.query('UPDATE site_claim_registry SET snapshot_json=? WHERE organisation_id=?',[JSON.stringify({...JSON.parse(released),usedChunks:17}),id]);await assert.rejects(service.execute({...input,requestId:randomUUID(),expectedRevision:2}),/scoped relocation/);await f.db.query('UPDATE site_claim_registry SET snapshot_json=? WHERE organisation_id=?',[released,id]);
const r=await service.execute({...input,requestId:randomUUID(),expectedRevision:2});assert.equal(r.homeBlock.revision,3);const saved=JSON.parse((await f.db.first('SELECT snapshot_json FROM site_claim_registry WHERE organisation_id=?',[id])).snapshot_json);assert.equal(saved.usedChunks,1);assert.equal(saved.tier,'RCO_T3');assert.equal(saved.estates.length,1);assert.deepEqual(saved.homeBlock.position,input.location.position);assert.equal((await f.db.first('SELECT COUNT(*) n FROM pb_orders')).n,0);
await assert.rejects(service.execute({...input,requestId:randomUUID(),expectedRevision:3,location:{...input.location,position:{x:2000,y:64,z:2000}}}),/paid Home Block relocation/);
}finally{f.db.close();}
});