import {test} from 'node:test';import assert from 'node:assert/strict';import {readFileSync,existsSync} from 'node:fs'; const file=new URL('../read-pressure-release.mjs',import.meta.url); test('release patch preserves unrelated production functions and upgrades only owned read paths',async()=>{ assert.ok(existsSync(file),'surgical release builder exists');const {patchReadPressureGateway}=await import(file); const before=`const STORE_OPERATIONS=new Set(['ops/lessons/list']);function untouched(){return 'production-hotfix';}\nasync function operationsScopeVersion(scope,companyId){return 'legacy-custom';}\nasync function handler(request,response){const operation='';if(operation==='ops/lessons/list')return response.json({success:true});}`; const after=patchReadPressureGateway(before,'ops');assert.ok(after.includes("function untouched(){return 'production-hotfix';}"));assert.ok(after.includes("return 'legacy-custom'"));assert.ok(after.includes('ops/lessons/export/create'));assert.ok(after.includes('dispatchReadPressure'));new Function(after); }); test('late hotfixes after the runtime marker and unrelated lesson transfer writes survive',async()=>{ const {patchReadPressureGateway}=await import(file);const {withXiaoshuRuntime}=await import('../lib/xiaoshu-runtime-compat.mjs'); const source=withXiaoshuRuntime(`const STORE_OPERATIONS=new Set(['ops/lessons/list']);async function lessonTransferCommit(){return 'write-hotfix';}async function handler(request,response){const operation='';if(operation==='ops/lessons/list')return response.json({success:true});}`)+"\nfunction memberCreditStatus(){return 'late-critical-hotfix';}"; const patched=patchReadPressureGateway(source,'ops');assert.ok(patched.includes("function memberCreditStatus(){return 'late-critical-hotfix';}"));assert.ok(patched.includes("async function lessonTransferCommit(){return 'write-hotfix';}")); });