You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mcp: list_events can report truncated:false for a page that lost a vanished row #1198
Found by: the hosted reviewer on PR #1197 (job 033-admin-mcp-server), at 80a631af. Verified against the code, not adopted from the review's text.
crates/nostream-mcp/src/server.rs:358 derives the page marker from the rows that survived collection:
let truncated = records.len() >= page;
collect_records (crates/nostream-storage/src/repositories.rs:112-126) drops StreamedEvent::Vanished and keeps only Record, which is what the tool wants in the payload (AC9). But the store's page (Page::finish, LMDB events.rs) selects a bounded number of slots before the marker is dropped. So when a selected row vanishes between batches — a replacement event superseding it, or a retention pass — the tool receives 499 rows for a page of 500 and answers truncated: false while a matching row remains unread.
Measured shape: 501 matching rows, page bound 500, one selected row deleted mid-read → 499 rows, truncated: false, and the caller has no signal to ask again. It is an edge (it needs a concurrent delete inside one read) and it fails quietly, which is the part worth fixing.
Fix direction: have the marker come from the store rather than from what survived — collect_records returning whether the page ended because the bound was reached (it holds the same Page the LMDB backend uses to decide), or a sibling helper that reports it beside the rows. A case that seeds a page, deletes one selected row through the store between two batches and asserts truncated: true would hold it.
Fixed in d6b37425 on #1197, not deferred after all.
The fix is the interface change this issue called for: nostream_storage::repositories::collect_page returns the page's slots alongside the surviving records, and list_events marks truncated from slots >= limit instead of records.len() >= limit. A slot the store spent on a key a replacement or retention pass then removed is therefore counted, so a caller paging on the flag no longer under-reads.
Two tests came with it, both of which fail on the parent commit: a_page_that_lost_a_slot_is_still_marked_truncated (tool payload level, through a store that can vanish a key mid-read) and collect_page_counts_the_slots_the_marker_spent (repository level).
Fixed by d6b37425 on PR #1197, not deferred: the finding was confirmed and the fix is smaller than an issue.
nostream_storage::repositories::collect_page now returns (rows, slots), collect_records is a wrapper over it, and list_events derives truncated from the slots the page spent. Case: a_page_that_lost_a_slot_is_still_marked_truncated — a real LMDB page of two rows whose second selected slot is reported as Vanished, answering one row and truncated: true, with a limit: 3 control that stays false; red proof at 80a631af in the pull request's thread.
Activity
chappie-daemon commentedon Nov 20, 2026
Fixed in
d6b37425on #1197, not deferred after all.The fix is the interface change this issue called for:
nostream_storage::repositories::collect_pagereturns the page's slots alongside the surviving records, andlist_eventsmarkstruncatedfromslots >= limitinstead ofrecords.len() >= limit. A slot the store spent on a key a replacement or retention pass then removed is therefore counted, so a caller paging on the flag no longer under-reads.Two tests came with it, both of which fail on the parent commit:
a_page_that_lost_a_slot_is_still_marked_truncated(tool payload level, through a store that can vanish a key mid-read) andcollect_page_counts_the_slots_the_marker_spent(repository level).Closing as fixed by #1197.
chappie-daemon commentedon Nov 20, 2026
Fixed by
d6b37425on PR #1197, not deferred: the finding was confirmed and the fix is smaller than an issue.nostream_storage::repositories::collect_pagenow returns(rows, slots),collect_recordsis a wrapper over it, andlist_eventsderivestruncatedfrom the slots the page spent. Case:a_page_that_lost_a_slot_is_still_marked_truncated— a real LMDB page of two rows whose second selected slot is reported asVanished, answering one row andtruncated: true, with alimit: 3control that staysfalse; red proof at80a631afin the pull request's thread.