Skip to content

Fix VCDiff decoding after an empty base payload - #734

Open
Kayvan-Zahiri wants to merge 3 commits into
ably:mainfrom
Kayvan-Zahiri:codex/decode-deltas-from-empty-base
Open

Kayvan-Zahiri wants to merge 3 commits into
ably:mainfrom
Kayvan-Zahiri:codex/decode-deltas-from-empty-base

Conversation

@Kayvan-Zahiri

@Kayvan-Zahiri Kayvan-Zahiri commented Oct 24, 2026 •

Copy link
Copy Markdown

A delta following an empty full message currently raises error 40018 even though the real VCDiff decoder can decode it. The base-payload guard conflates empty strings/bytes/bytearrays with an absent base.

Check explicitly for None, preserving the missing-base error. Add six public Message decoding tests using the real decoder and a literal-only VCDIFF window, including batch chaining and missing/nonempty-base controls.

Validation: four regressions failed and two controls passed before the fix; 120 offline encoding/type/channel delta tests pass, seven skip, after it. Full repository Ruff check passes. Python 3.12; no hosted Ably requests or full integration/version matrix run.

AI-assisted contribution; maintainer review pending.

Summary by CodeRabbit

  • Bug Fixes
    • VCDIFF decoding now accepts empty payloads as valid bases, while still reporting an error when the base is absent. This improves decoding for messages that use an empty starting payload and supports batch sequences that follow an empty full message. Decoded content and message details are preserved when processing these cases.

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

VCDIFF decoding now accepts empty base payloads. It still raises the missing-base error when the base payload is None. Added tests cover direct decoding and batch chaining.

Changes

Empty-base VCDIFF decoding

Layer / File(s) Summary
Decoder behavior and validation
ably/pubsub/types/mixins.py, test/uts/rest/unit/encoding/empty_delta_base_test.py
The decoder raises the missing-base error only when the base payload is None. Tests check decoding with empty and nonempty bases, error code 40018 for a None base, and batch chaining after an empty full message.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: ttypic

Merge Risk: Minimal · up to 18272

This fixes VCDiff decoding of a delta that follows an empty full message. The missing-base error is preserved, and tests cover the changed behavior. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Fix VCDiff decoding after an empty base payload" matches the main change. The summary says the base-payload guard now treats a base as missing only when it is None, so empty strings, bytes,…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Fix VCDiff decoding after an empty base payload" matches the main change. The summary says the base-payload guard now treats a base as missing only when it is None, so empty strings, bytes, and bytearrays are no longer rejected. The added tests cover decoding with empty and nonempty bases, rejection of None, and batch chaining after an empty full message. The title is specific, concise, and free of filler.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit taps an empty base,
Then watches “hello” find its place.
A missing base still earns an error,
The tests check each path with care.
The next message hops along.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 77d4bb75-f648-4a5f-ad39-1664b3877cf1
Commits

Reviewing files that changed from the base of the PR and between 60c46e4 and 182722a.

Files selected for processing: 2

  • ably/pubsub/types/mixins.py
  • test/uts/rest/unit/encoding/empty_delta_base_test.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@ttypic ttypic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @Kayvan-Zahiri,

Thanks a lot for contributing! is you PR ready for review?

We usually don't proactively review draft PRs

@Kayvan-Zahiri
Kayvan-Zahiri marked this pull request as ready for review December 3, 2026 18:07

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants