@@ -141,6 +141,7 @@ const FILE_ROW = {
141141 displayName : 'note.txt' ,
142142 contentType : 'text/plain' ,
143143 size : 5 ,
144+ sizeBytes : 5 ,
144145 deletedAt : null ,
145146 uploadedAt : new Date ( '2026-07-01T00:00:00.000Z' ) ,
146147 updatedAt : new Date ( '2026-07-01T00:00:00.000Z' ) ,
@@ -666,12 +667,13 @@ describe('workspace file metadata and storage accounting', () => {
666667 } )
667668
668669 it ( 'uploads an overwrite before atomically swapping the locked row and exact delta' , async ( ) => {
669- const concurrentFile = { ...FILE_ROW , size : 7 }
670+ const concurrentFile = { ...FILE_ROW , size : 7 , sizeBytes : 7 }
670671 const replacementKey = `${ FILE_ROW . key } -replacement`
671672 const updatedFile = {
672673 ...concurrentFile ,
673674 key : replacementKey ,
674675 size : 10 ,
676+ sizeBytes : 10 ,
675677 updatedAt : new Date ( '2026-07-03T00:00:00.000Z' ) ,
676678 }
677679 dbChainMockFns . limit . mockResolvedValueOnce ( [ FILE_ROW ] ) . mockResolvedValueOnce ( [ concurrentFile ] )
@@ -715,7 +717,7 @@ describe('workspace file metadata and storage accounting', () => {
715717
716718 it ( 'cleans up only the new overwrite object when atomic finalization fails' , async ( ) => {
717719 const replacementKey = `${ FILE_ROW . key } -replacement`
718- const updatedFile = { ...FILE_ROW , key : replacementKey , size : 10 }
720+ const updatedFile = { ...FILE_ROW , key : replacementKey , size : 10 , sizeBytes : 10 }
719721 dbChainMockFns . limit . mockResolvedValueOnce ( [ FILE_ROW ] ) . mockResolvedValueOnce ( [ FILE_ROW ] )
720722 dbChainMockFns . returning . mockResolvedValueOnce ( [ updatedFile ] )
721723 mockUploadFile . mockResolvedValueOnce ( { key : replacementKey } )
@@ -744,6 +746,7 @@ describe('workspace file metadata and storage accounting', () => {
744746 const updatedFile = {
745747 ...MD_ROW ,
746748 size : 12 ,
749+ sizeBytes : 12 ,
747750 updatedAt : new Date ( '2026-07-05T00:00:00.000Z' ) ,
748751 contentUpdatedAt : new Date ( '2026-07-04T00:00:00.000Z' ) ,
749752 }
@@ -764,7 +767,7 @@ describe('workspace file metadata and storage accounting', () => {
764767 } )
765768
766769 it ( 'does NOT merge when syncLiveDoc is false (the relay persist / empty-shell opt-out)' , async ( ) => {
767- const updatedFile = { ...MD_ROW , size : 12 }
770+ const updatedFile = { ...MD_ROW , size : 12 , sizeBytes : 12 }
768771 dbChainMockFns . limit . mockResolvedValueOnce ( [ MD_ROW ] ) . mockResolvedValueOnce ( [ MD_ROW ] )
769772 dbChainMockFns . returning . mockResolvedValueOnce ( [ updatedFile ] )
770773 mockUploadFile . mockResolvedValueOnce ( { key : MD_ROW . key } )
@@ -782,7 +785,7 @@ describe('workspace file metadata and storage accounting', () => {
782785 } )
783786
784787 it ( 'does NOT merge a non-markdown write (the collaborative editor only renders markdown)' , async ( ) => {
785- const updatedFile = { ...FILE_ROW , size : 10 }
788+ const updatedFile = { ...FILE_ROW , size : 10 , sizeBytes : 10 }
786789 dbChainMockFns . limit . mockResolvedValueOnce ( [ FILE_ROW ] ) . mockResolvedValueOnce ( [ FILE_ROW ] )
787790 dbChainMockFns . returning . mockResolvedValueOnce ( [ updatedFile ] )
788791 mockUploadFile . mockResolvedValueOnce ( { key : FILE_ROW . key } )
@@ -799,7 +802,7 @@ describe('workspace file metadata and storage accounting', () => {
799802 } )
800803
801804 it ( 'writes when the expectedUpdatedAt optimistic-concurrency guard matches' , async ( ) => {
802- const updatedFile = { ...FILE_ROW , size : 12 }
805+ const updatedFile = { ...FILE_ROW , size : 12 , sizeBytes : 12 }
803806 dbChainMockFns . limit . mockResolvedValueOnce ( [ FILE_ROW ] ) . mockResolvedValueOnce ( [ FILE_ROW ] )
804807 dbChainMockFns . returning . mockResolvedValueOnce ( [ updatedFile ] )
805808 mockUploadFile . mockResolvedValueOnce ( { key : FILE_ROW . key } )
0 commit comments