@@ -754,3 +754,91 @@ test.describe("Inbox session reply admission", () => {
754754 ] ) ;
755755 } ) ;
756756} ) ;
757+
758+ // Browser-only: CSS hides the list at this width. Real IndexedDB rejection must
759+ // remain visible/retryable while the selected detail is mounted, not just in DOM.
760+ test ( "narrow selected detail keeps a rejected read save and its captured Retry visible" , async ( {
761+ page,
762+ app,
763+ } ) => {
764+ await page . setViewportSize ( { width : 390 , height : 844 } ) ;
765+ await page . addInitScript ( ( ) => {
766+ const put = IDBObjectStore . prototype . put ;
767+ window . inboxReadFailure = { armed : false , failures : 0 , saves : 0 } ;
768+ IDBObjectStore . prototype . put = function ( value , ...args ) {
769+ if (
770+ this . name === "partitions" &&
771+ this . transaction . db . name === "buzz-read-state-v1"
772+ ) {
773+ if (
774+ window . inboxReadFailure . armed &&
775+ Object . keys ( value ?. state ?. frontiers ?? { } ) . length
776+ ) {
777+ window . inboxReadFailure . failures ++ ;
778+ throw new Error ( "Synthetic read storage failure" ) ;
779+ }
780+ this . transaction . addEventListener (
781+ "complete" ,
782+ ( ) => {
783+ window . inboxReadFailure . saves ++ ;
784+ } ,
785+ { once : true } ,
786+ ) ;
787+ }
788+ return put . call ( this , value , ...args ) ;
789+ } ;
790+ } ) ;
791+ await open ( page , app ) ;
792+ await page
793+ . getByRole ( "button" , { name : "Show navigation" , exact : true } )
794+ . click ( ) ;
795+ await page . getByRole ( "button" , { name : "Inbox" , exact : true } ) . click ( ) ;
796+ const inbox = page . getByRole ( "region" , { name : "Inbox" , exact : true } ) ;
797+ await expect ( inbox . getByText ( "Checking recent activity…" ) ) . toHaveCount ( 0 ) ;
798+ await inbox . getByRole ( "combobox" , { name : "Activity type" } ) . click ( ) ;
799+ await page . getByRole ( "option" , { name : "Mentions" , exact : true } ) . click ( ) ;
800+ const row = inbox
801+ . getByRole ( "list" , { name : "Inbox conversations" } )
802+ . getByRole ( "listitem" )
803+ . first ( ) ;
804+ await expect ( row . getByRole ( "img" , { name : "Unread" } ) ) . toBeVisible ( ) ;
805+ await page . evaluate ( ( ) => {
806+ window . inboxReadFailure . armed = true ;
807+ } ) ;
808+ try {
809+ await row . getByRole ( "button" , { name : / ^ O p e n / } ) . click ( ) ;
810+ const detail = inbox . getByRole ( "complementary" , {
811+ name : "Thread" ,
812+ exact : true ,
813+ } ) ;
814+ await expect ( detail ) . toBeVisible ( ) ;
815+ const alert = inbox
816+ . getByRole ( "alert" )
817+ . filter ( { hasText : "Synthetic read storage failure" } ) ;
818+ await expect ( alert ) . toBeVisible ( ) ;
819+ await expect (
820+ alert . getByRole ( "button" , { name : "Retry inbox" } ) ,
821+ ) . toBeInViewport ( ) ;
822+ await expect (
823+ inbox . getByRole ( "list" , { name : "Inbox conversations" } ) ,
824+ ) . not . toBeVisible ( ) ;
825+ const saves = await page . evaluate ( ( ) => {
826+ window . inboxReadFailure . armed = false ;
827+ return window . inboxReadFailure . saves ;
828+ } ) ;
829+ await alert . getByRole ( "button" , { name : "Retry inbox" } ) . click ( ) ;
830+ await expect ( alert ) . toHaveCount ( 0 ) ;
831+ await expect
832+ . poll ( ( ) => page . evaluate ( ( ) => window . inboxReadFailure . saves ) )
833+ . toBeGreaterThan ( saves ) ;
834+ await expect ( detail ) . toBeVisible ( ) ;
835+ await detail
836+ . getByRole ( "button" , { name : "Close thread" , exact : true } )
837+ . click ( ) ;
838+ await expect ( row . getByRole ( "img" , { name : "Unread" } ) ) . toHaveCount ( 0 ) ;
839+ } finally {
840+ await page . evaluate ( ( ) => {
841+ window . inboxReadFailure . armed = false ;
842+ } ) ;
843+ }
844+ } ) ;
0 commit comments