Skip to content

fix(azcosmos): remove no-op PopulateCompositeContinuationToken from ChangeFeedResponse#26792

Merged
tvaron3 merged 2 commits into
Azure:mainfrom
tvaron3:tvaron3/remove-populate-composite-continuation-token
May 15, 2026
Merged

fix(azcosmos): remove no-op PopulateCompositeContinuationToken from ChangeFeedResponse#26792
tvaron3 merged 2 commits into
Azure:mainfrom
tvaron3:tvaron3/remove-populate-composite-continuation-token

Conversation

@tvaron3
Copy link
Copy Markdown
Member

@tvaron3 tvaron3 commented May 15, 2026

Purpose

Removes ChangeFeedResponse.PopulateCompositeContinuationToken(), which was made a no-op in PR #26768. With the queue-driven GetChangeFeed rewrite, the response's ContinuationToken field is populated by the drain loop itself with a multi-range composite token. Calling PopulateCompositeContinuationToken() would either:

  • Be a no-op (its current behavior in main), or
  • If invoked on a hand-constructed ChangeFeedResponse, build a stale single-range token that would skip subsequent ranges after a split when used to resume.

There's no remaining valid use case for the method, so this PR removes it outright.

Public API surface for getting continuation tokens after this change

ChangeFeedResponse exposes the following ways to obtain a continuation token, in order of preference:

  1. ContinuationToken string (struct field — recommended)
    Populated automatically by GetChangeFeed with the multi-range composite token that drives the queue-based drain loop introduced in fix(azcosmos): GetChangeFeed split-resilient via overlap match, 410/Gone retry, multi-range continuation queue (#26767) #26768. This is the only token shape that survives partition splits correctly. Pass it back via ChangeFeedOptions.Continuation to resume from where the previous call left off.

  2. GetCompositeContinuationToken() (string, error)
    Public helper that constructs a single-range composite token from the response's FeedRange + ETag. Useful for advanced callers who hand-construct a ChangeFeedResponse outside the normal GetChangeFeed flow (e.g., test fixtures or custom adapters). Note: this builds a single-range token, so it will not preserve multi-range queue state across partition splits — prefer the ContinuationToken field for production code.

  3. GetContinuation() string
    Low-level accessor returning the raw ETag string from the response. Intended for callers that want to perform their own continuation-token construction; not directly usable as a ChangeFeedOptions.Continuation value because GetChangeFeed only honors composite-token JSON.

  4. GetContRanges() (min string, max string, ok bool)
    Low-level accessor returning the FeedRange bounds of the page that was drained. Pairs with GetContinuation() for callers building tokens manually.

What this PR changes

  • Deletes func (response *ChangeFeedResponse) PopulateCompositeContinuationToken() from cosmos_change_feed_response.go.
  • Retargets the two existing tests (TestChangeFeedResponseWithFeedRange, TestChangeFeedResponseWithoutFeedRange) at GetCompositeContinuationToken() so the underlying composite-token construction stays covered.
  • Removes a stale comment in cosmos_container_change_feed.go that referenced the deleted method.
  • Adds a Breaking Changes entry to CHANGELOG.md.

Tests

go test -race -short -count=1 ./sdk/data/azcosmos/... — all green.

Checklist

  • The PR does not update generated files.
  • Tests are included and/or updated for code changes.
  • Updates to module CHANGELOG.md are included.
  • MIT license headers are included in each file.

…hangeFeedResponse

After PR Azure#26768, GetChangeFeed populates ChangeFeedResponse.ContinuationToken
directly with the multi-range composite token. PopulateCompositeContinuationToken
became a no-op (early-returning when ContinuationToken was already set) to
prevent it from overwriting the multi-range token with a stale single-range
one rebuilt from the per-head FeedRange.

This PR removes the now-vestigial method outright. Tests that previously
exercised it have been retargeted at GetCompositeContinuationToken (which
still exists as a public helper for callers building single-range tokens
manually).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tvaron3 tvaron3 marked this pull request as ready for review May 15, 2026 18:05
@tvaron3 tvaron3 requested a review from a team as a code owner May 15, 2026 18:05
Copilot AI review requested due to automatic review settings May 15, 2026 18:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Removes the no-op PopulateCompositeContinuationToken() method from ChangeFeedResponse, which became redundant after the queue-driven GetChangeFeed rewrite in #26768 now populates ContinuationToken directly with multi-range composite tokens.

Changes:

  • Deletes PopulateCompositeContinuationToken() from cosmos_change_feed_response.go and adds a Breaking Changes entry to the CHANGELOG.
  • Updates two existing tests to call GetCompositeContinuationToken() instead.
  • Removes a stale comment referencing the deleted method.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
sdk/data/azcosmos/cosmos_change_feed_response.go Removes the deprecated no-op method.
sdk/data/azcosmos/cosmos_change_feed_response_test.go Retargets tests at GetCompositeContinuationToken().
sdk/data/azcosmos/cosmos_container_change_feed.go Cleans up stale comment referencing removed method.
sdk/data/azcosmos/CHANGELOG.md Documents the breaking change.

Comment thread sdk/data/azcosmos/CHANGELOG.md Outdated
Co-authored-by: Simon Moreno <30335873+simorenoh@users.noreply.github.com>
@tvaron3 tvaron3 enabled auto-merge (squash) May 15, 2026 18:53
Copy link
Copy Markdown
Member

@xinlian12 xinlian12 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks

@tvaron3 tvaron3 merged commit b96ec28 into Azure:main May 15, 2026
18 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants