make the forge-notify cursor bound explicit: shared fetch-limit const + assert + docs (closes #2117)

This commit is contained in:
damocles 2026-07-02 12:52:19 +02:00 committed by mara
commit 383bb3b083
2 changed files with 28 additions and 1 deletions

View file

@ -100,6 +100,15 @@ Each poll prunes it to the threads still in the unread set. A failed
wake delivery is left unread **and** out of the cursor, so it
resurfaces next tick.
**Size bound:** the per-poll prune retains only ids present in the
single `limit=UNREAD_FETCH_LIMIT` (50) fetch page, so the cursor never
exceeds that many entries — it tracks the unread *window*, not the
all-time notification count. The fetch limit and the bound are the
same constant in `forge_notify.rs` (with a debug assertion), so a
future pagination change grows the ceiling visibly rather than
silently. This is why the cursor stays a small JSON field rather than
a db table — see the storage discussion on the tracker (issue 2117).
The cursor is **persisted** as the `forge_cursor` field of the
harness's consolidated `hyperhive-harness.json` state file (atomic
tmp+rename, flushed only when it changed) and reloaded on boot, so a