From 9d662f702b1c483ec65e8048ffc32d0ee53c1528 Mon Sep 17 00:00:00 2001 From: thepra Date: Wed, 7 Oct 2026 02:55:30 +0200 Subject: [PATCH] The feed memory test counts the deletions it was told of In one full run (241 of 242 passing) the home feed came back from a thread with fewer posts than it was left with, and passed three times alone. The feed takes a post out at once when the stream says it was deleted, and earlier tests do delete posts in that persona's home, but PrivaPub's log shows no federated Delete at that minute, so the cause is not proven. The test now allows for the deletions the stream reported during the trip and says the three numbers when it fails; with none reported, a shorter feed still fails, and coming back still may not read the home feed again. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw --- tests/e2e/Actions/FeedMemoryTests.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/e2e/Actions/FeedMemoryTests.cs b/tests/e2e/Actions/FeedMemoryTests.cs index 088f0e1..540ab56 100644 --- a/tests/e2e/Actions/FeedMemoryTests.cs +++ b/tests/e2e/Actions/FeedMemoryTests.cs @@ -14,6 +14,13 @@ namespace decePubClient.E2E.Actions var persona = Pasture.Personas().First(); await using var session = await SignIn.As(browser, persona); var page = session.Page; + // a deletion the stream tells (late federated Deletes from the tests before) takes its post out at once + var deletions = 0; + page.WebSocket += (_, socket) => socket.FrameReceived += (_, frame) => + { + if (frame.Text?.Contains("\"event\":\"delete\"") == true) + Interlocked.Increment(ref deletions); + }; await Results.Cell("client.action.feed-memory", "privapub", persona.UserName, async () => { await page.GotoAsync($"{Pasture.Site}/"); @@ -25,6 +32,7 @@ namespace decePubClient.E2E.Actions await page.EvalOnSelectorAsync("#feed-scroll", "root => root.scrollTop = root.scrollHeight"); await Pasture.Eventually(async () => int.Parse(await feed.GetAttributeAsync("data-feed-count") ?? "0") > 20, 10); var count = int.Parse(await feed.GetAttributeAsync("data-feed-count") ?? "0"); + var deletedBefore = Volatile.Read(ref deletions); var homeReads = 0; page.Request += (_, request) => @@ -38,7 +46,9 @@ namespace decePubClient.E2E.Actions await page.GoBackAsync(); await page.Locator("article[data-uri]").First.WaitForAsync(new() { Timeout = 10000 }); - Assert.True(int.Parse(await feed.GetAttributeAsync("data-feed-count") ?? "0") >= count, "the feed came back shorter than it was left"); + var back = int.Parse(await feed.GetAttributeAsync("data-feed-count") ?? "0"); + var deleted = Volatile.Read(ref deletions) - deletedBefore; + Assert.True(back >= count - deleted, $"the feed came back with {back} posts, left with {count} ({deleted} deleted meanwhile)"); Assert.Equal(0, homeReads); await session.AssertGuards(); }, page);