Skip to content

fix: preserve block callbacks in asynchronous history - #182

Closed
pcbeingused333 wants to merge 1 commit into
pubnub:masterfrom
pcbeingused333:fix/c3519-history-callback
Closed

pcbeingused333 wants to merge 1 commit into
pubnub:masterfrom
pcbeingused333:fix/c3519-history-callback

Conversation

@pcbeingused333

Copy link
Copy Markdown

Preserve block callbacks in asynchronous history pagination.

paged_history and all_history_messages resolve their callback from either the callback: option or the supplied block. Their asynchronous paths pass only the original options into a future, then re-enter the public method without the block, silently losing block callbacks.

Pass the resolved callback in a merged options hash to each asynchronous helper. This preserves explicit callback precedence (including explicit nil) and leaves the caller's options unchanged.

Tests

Added eight offline RSpec examples using real Concurrent::Future execution and stubbed history responses. Both asynchronous block cases fail before the fix; all eight examples pass afterward. The cases cover synchronous and asynchronous blocks, explicit callback precedence, explicit nil callbacks, and frozen caller options.

Run rspec spec/lib/paged_history_spec.rb with RSpec and concurrent-ruby installed.

This change and its tests were prepared with AI assistance (Codex).

Internal notes

No linked issue exists for this independently reproduced bug; no issue-closing keyword is included.
Base: master 8e31712.
Eligibility from scout at the same revision: README.md §Support and contributions requires behavioral tests; no prior issue, assignment, approval, CLA/DCO, alternate target branch or changelog requirement was found.

@pubnub-snyk-universal-prd

pubnub-snyk-universal-prd Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@pubnub-release-bot

Copy link
Copy Markdown
Contributor

@pcbeingused333 this issue is addressed in v6.2.1

@github-actions github-actions Bot added the status: done This issue is considered resolved. label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: done This issue is considered resolved.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants