Skip to content

Commit c567ef8

Browse files
alexjbaclaude
andcommitted
fix(storenode): restore 30-page community fetch cap — 3 pages starved busy-topic descriptions (#21470-hf)
On-device (S21FE, dev fleet): with the 3-page cap the Status community's 1.4MB description became unreachable — its universal topic carries all channels' traffic, so the newest 3 pages (~150 envelopes) never contained the periodically-republished description. 62 capped fetch attempts, 23 backoff suppressions, zero resolves, community permanently absent from Discover; low-traffic communities resolved fine. 30 pages reached it in every measured run. Deep pages are now affordable: the keyless early-drop gate (36dd3cf) discards undecryptable envelopes cheaply, empty pages skip processing (cae6698), and the description-seen gate (6cd6ced) still ends the request on the first hit. The tighter-than-contact test assertion is relaxed to not-looser-than accordingly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> (cherry picked from commit 2e1dc62) (cherry picked from commit fbab6816d95f1c397aadafcac8cab7e33507eb2c)
1 parent 0e465fe commit c567ef8

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

protocol/messenger_store_node_request_manager_config.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ package protocol
99
// full 31-day store-node window and burns CPU/battery on the device.
1010
const maxStoreNodeRequestPageCount = 30
1111

12-
// maxCommunityStoreNodeRequestPageCount caps community fetches far more tightly
13-
// than the generic contact cap (issue #21470-hf). Store queries page newest-first
14-
// (verified in go-waku history.go: PaginationForward unset => proto3 default false
15-
// => backward) and community descriptions are republished periodically, so a live
16-
// community's description lands within the first pages; the description-seen gate
17-
// (6cd6ced1a) then stops the request on that hit. Deeper paging can therefore only
18-
// ever chew empty/irrelevant history — exactly the device failure mode: dead
19-
// curated ids each cost a ~minutes-long 30-page run finalizing with
20-
// fetchedEnvelopesCount=0. 3 pages keeps a healthy fetch (1-2 pages) untouched
21-
// while collapsing a dead-id run to a fraction of its former cost. Applied only at
22-
// the community construction site; the contact/default cap stays at 30.
23-
const maxCommunityStoreNodeRequestPageCount = 3
12+
// maxCommunityStoreNodeRequestPageCount caps community fetches (issue #21470-hf).
13+
// Store queries page newest-first, but on a HIGH-TRAFFIC community the universal
14+
// content topic carries all channels' messages, so the periodically-republished
15+
// description can sit well below the newest pages: on-device (Samsung S21FE, dev
16+
// fleet) a 3-page cap made the Status community's 1.4MB description UNREACHABLE —
17+
// 62 capped fetch attempts, zero resolves, community permanently absent from
18+
// Discover — while low-traffic communities resolved in 1-2 pages. 30 pages
19+
// (~1500 envelopes) reliably reached it in every measured run. Deep pages are
20+
// affordable now that undecryptable envelopes drop early (keyless gate,
21+
// 36dd3cf7f) and empty pages skip processing; the description-seen gate
22+
// (6cd6ced1a) still stops a request the moment the description appears.
23+
const maxCommunityStoreNodeRequestPageCount = 30
2424

2525
type StoreNodeRequestConfig struct {
2626
WaitForResponse bool

protocol/messenger_store_node_request_manager_config_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ func TestStoreNodeRequestPageCap(t *testing.T) {
7575
// fetches keep the generous 30-page cap; only the community construction site is
7676
// tightened, never the shared default.
7777
func TestCommunityStoreNodeRequestPageCap(t *testing.T) {
78-
t.Run("community construction caps at 3 pages", func(t *testing.T) {
79-
require.Equal(t, 3, maxCommunityStoreNodeRequestPageCount)
78+
t.Run("community construction caps at 30 pages", func(t *testing.T) {
79+
require.Equal(t, 30, maxCommunityStoreNodeRequestPageCount)
8080
cfg := buildCommunityStoreNodeRequestConfig(nil)
8181
require.Equal(t, maxCommunityStoreNodeRequestPageCount, cfg.MaxPageCount)
8282
})
@@ -87,10 +87,10 @@ func TestCommunityStoreNodeRequestPageCap(t *testing.T) {
8787
require.Equal(t, maxStoreNodeRequestPageCount, cfg.MaxPageCount)
8888
})
8989

90-
t.Run("community construction is tighter than contact construction", func(t *testing.T) {
90+
t.Run("community construction is not looser than contact construction", func(t *testing.T) {
9191
community := buildCommunityStoreNodeRequestConfig(nil)
9292
contact := buildStoreNodeRequestConfig(nil)
93-
require.Less(t, community.MaxPageCount, contact.MaxPageCount)
93+
require.LessOrEqual(t, community.MaxPageCount, contact.MaxPageCount)
9494
})
9595

9696
t.Run("community construction inherits the shared non-cap defaults", func(t *testing.T) {

0 commit comments

Comments
 (0)