Skip to content

feat(queue): fast_forward_collaborative_group#80

Merged
ltitanb merged 1 commit into
mainfrom
collaborative-fast-forward
May 9, 2026
Merged

feat(queue): fast_forward_collaborative_group#80
ltitanb merged 1 commit into
mainfrom
collaborative-fast-forward

Conversation

@ltitanb
Copy link
Copy Markdown
Contributor

@ltitanb ltitanb commented May 9, 2026

Adds an opt-in way for a collaborative group to join at the producer's current write head instead of replaying whatever is still in the ring.

A fresh collaborative consumer's init_collaborative calls acquire_next_slot from a zero-initialised group cursor; the cursor immediately gets SpedPast and falls back to acquire_earliest_available_slot, landing at count - queue.len() — i.e. a full ring of backlog. That is correct for groups whose payload outlives the queue, but it's wrong when the payload references data with a tighter lifetime (e.g. an external arena that recycles independently). Replaying the backlog there produces stale references and noisy warnings.

Queue::fast_forward_collaborative_group(label) advances the group cursor via fetch_max(self.count()), allocating the slot if needed. Exposed on FluxSpine for any field with AsRef<SpineQueue<T>>.

Safety: must be called once, before any group member starts consuming. After a member's acquire_next_slot has run, fetch_max can overshoot already-claimed positions and silently drop messages produced in the gap. Documented on the API.

Tests: single-consumer skips backlog; 4-consumer group sees every post-fast-forward message exactly once.

@ltitanb ltitanb requested a review from a team May 9, 2026 18:10
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@ltitanb ltitanb merged commit ed5030b into main May 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants