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
fix: record_ack_and_advance uses sentinel 0 for unknown sources #431
In crates/logfwd-core/src/pipeline/lifecycle.rs, record_ack_and_advance() uses unwrap_or(0) for old_offset when a source has never been committed. If a spurious ack arrives for an unknown source, this inserts 0 into the committed map — making committed_offset() return Some(0) instead of None.
Current behavior
let old_offset = committed.get(&source).copied().unwrap_or(0);// ... advance loop may not run ...
committed.insert(source, current);// inserts 0 for unknown source
Expected behavior
old_offset should be Option<u64>, and committed.insert() should only happen when the offset actually advanced. This keeps committed_offset() returning None for sources that were never properly committed.
Impact
Low — AckReceipt fields are pub(crate), so external code can't forge receipts. But the internal invariant is violated if a spurious ack is processed.
Fix
Change record_ack_and_advance to track old_offset as Option<u64> and only insert into committed when current != old_offset. The CommitAdvance struct already uses Option<u64> fields — just needs the internal logic to match.
Closing — unwrap_or(0) no longer exists in pipeline/lifecycle.rs. The code was rewritten with proper BTreeMap handling during the PipelineMachine typestate work (PR #425).
Activity
google-labs-jules commentedon Mar 31, 2026
Jules has failed to create a task. You can try again later by removing and re-adding the 'jules' label.
fix: guard spurious acks, assert drain test, fix Kani compilation
strawgate commentedon Apr 1, 2026
Closing —
unwrap_or(0)no longer exists in pipeline/lifecycle.rs. The code was rewritten with proper BTreeMap handling during the PipelineMachine typestate work (PR #425).