@@ -235,7 +235,7 @@ describe("memory runtime handles", () => {
235235 expect ( mocks . loadPluginRegistryHandle ) . not . toHaveBeenCalled ( ) ;
236236 } ) ;
237237
238- it ( "normalizes legacy missing reads once while preserving manager lifecycle" , async ( ) => {
238+ it ( "preserves statusless reads as successful while preserving manager lifecycle" , async ( ) => {
239239 const canonicalEmpty = {
240240 status : "ok" ,
241241 text : "" ,
@@ -262,14 +262,18 @@ describe("memory runtime handles", () => {
262262 } ) : Promise < LegacyMemoryReadResult | MemoryReadResult > {
263263 this . #readCalls += 1 ;
264264 switch ( relPath ) {
265- case "memory/legacy-empty.md" :
265+ case "memory/legacy-bare-empty.md" :
266+ return { text : "" , path : relPath } ;
267+ case "memory/legacy-ranged-empty.md" :
266268 return { text : "" , path : relPath , from : 1 , lines : 0 } ;
269+ case "memory/legacy-nonempty.md" :
270+ return { text : "legacy" , path : relPath } ;
267271 case canonicalEmpty . path :
268272 return canonicalEmpty ;
269273 case canonicalMissing . path :
270274 return canonicalMissing ;
271275 default :
272- return { text : "" , path : relPath } ;
276+ throw new Error ( `unexpected read path: ${ relPath } ` ) ;
273277 }
274278 }
275279
@@ -313,18 +317,29 @@ describe("memory runtime handles", () => {
313317 expect ( Reflect . get ( second . manager ?? { } , "readFile" ) ) . toBe (
314318 Reflect . get ( first . manager ?? { } , "readFile" ) ,
315319 ) ;
316- await expect ( first . manager ?. readFile ( { relPath : "memory/missing.md" } ) ) . resolves . toEqual ( {
317- status : "not_found" ,
320+ await expect (
321+ first . manager ?. readFile ( { relPath : "memory/legacy-bare-empty.md" } ) ,
322+ ) . resolves . toEqual ( {
323+ status : "ok" ,
318324 text : "" ,
319- path : "memory/missing .md" ,
325+ path : "memory/legacy-bare-empty .md" ,
320326 } ) ;
321- await expect ( first . manager ?. readFile ( { relPath : "memory/legacy-empty.md" } ) ) . resolves . toEqual ( {
327+ await expect (
328+ first . manager ?. readFile ( { relPath : "memory/legacy-ranged-empty.md" } ) ,
329+ ) . resolves . toEqual ( {
322330 status : "ok" ,
323331 text : "" ,
324- path : "memory/legacy-empty.md" ,
332+ path : "memory/legacy-ranged- empty.md" ,
325333 from : 1 ,
326334 lines : 0 ,
327335 } ) ;
336+ await expect (
337+ first . manager ?. readFile ( { relPath : "memory/legacy-nonempty.md" } ) ,
338+ ) . resolves . toEqual ( {
339+ status : "ok" ,
340+ text : "legacy" ,
341+ path : "memory/legacy-nonempty.md" ,
342+ } ) ;
328343 await expect ( first . manager ?. readFile ( { relPath : canonicalEmpty . path } ) ) . resolves . toBe (
329344 canonicalEmpty ,
330345 ) ;
@@ -333,7 +348,7 @@ describe("memory runtime handles", () => {
333348 ) ;
334349 await first . manager ?. close ?.( ) ;
335350 expect ( manager . isClosed ( ) ) . toBe ( true ) ;
336- expect ( manager . readCalls ( ) ) . toBe ( 4 ) ;
351+ expect ( manager . readCalls ( ) ) . toBe ( 5 ) ;
337352 } ) ;
338353
339354 it ( "authorizes raw hits inside the selected plugin runtime scope" , async ( ) => {
0 commit comments