Skip to content

Implement ReplicaOf method to replace deprecated SlaveOf#3720

Merged
ndyakov merged 6 commits into
masterfrom
copilot/implement-replicaof-method
Mar 9, 2026
Merged

Implement ReplicaOf method to replace deprecated SlaveOf#3720
ndyakov merged 6 commits into
masterfrom
copilot/implement-replicaof-method

Conversation

Copilot AI commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

SlaveOf was deprecated in favor of ReplicaOf (Redis 5.0+) but the replacement method was not implemented, causing linter warnings on codebases using the deprecated method.

Changes

  • Added ReplicaOf method to Cmdable interface and cmdable implementation
    • Uses REPLICAOF Redis command (lowercase following codebase convention)
    • Identical signature and behavior to SlaveOf
  • Added test coverage mirroring existing SlaveOf test
  • Migrated internal usage from SlaveOf to ReplicaOf in sentinel test setup

Usage

// Old (deprecated)
err := client.SlaveOf(ctx, "127.0.0.1", "6379").Err()
err := client.SlaveOf(ctx, "NO", "ONE").Err()

// New
err := client.ReplicaOf(ctx, "127.0.0.1", "6379").Err()
err := client.ReplicaOf(ctx, "NO", "ONE").Err()

The deprecated SlaveOf method remains for backward compatibility.

Original prompt

This section details on the original issue you should resolve

<issue_title>Deprecation of SlaveOf without recommended alternative being implemented</issue_title>
<issue_description>SlaveOf become deprecated and ReplicaOf is not implemented, but recommended to be used.

Negative side effect: potential linter failures.</issue_description>

<agent_instructions>You should implement ReplicaOf method which is identical to SlaveOf outside of the actual command send to redis. The command in redis is REPLICAOF <host port | NO ONE>, you can find more information in the official documentation https://redis.io/docs/latest/commands/replicaof/ . Please substitute all usages of SlaveOf with the newly added ReplicaOf.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@ndyakov Thank you for reporting this.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.


Note

Medium Risk
Adds a new method to the exported Cmdable interface, which can be a breaking change for any external mocks/implementations of that interface; otherwise behavior mirrors existing SlaveOf. Also updates various example/extra module dependency locks, which may cause incidental build/test drift in those modules.

Overview
Introduces ReplicaOf as the non-deprecated alternative to SlaveOf by adding it to Cmdable and implementing it in cmdable using the replicaof Redis command.

Updates test coverage to exercise ReplicaOf and migrates sentinel test setup to call ReplicaOf instead of SlaveOf. Also refreshes several example/* and extra/* module go.mod/go.sum dependencies (notably cpuid, xxh3, and golang.org/x/sys).

Written by Cursor Bugbot for commit 5507f56. This will update automatically on new commits. Configure here.

@jit-ci

jit-ci Bot commented Feb 24, 2026

Copy link
Copy Markdown

🛡️ Jit Security Scan Results

CRITICAL HIGH MEDIUM

✅ No security findings were detected in this PR


Security scan by Jit

Copilot AI and others added 2 commits February 24, 2026 08:10
Co-authored-by: ndyakov <1547186+ndyakov@users.noreply.github.com>
Co-authored-by: ndyakov <1547186+ndyakov@users.noreply.github.com>

@ndyakov ndyakov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks good to me, cc @ofekshenawa

@ndyakov ndyakov requested a review from ofekshenawa February 24, 2026 08:15
Co-authored-by: ndyakov <1547186+ndyakov@users.noreply.github.com>
Copilot AI changed the title [WIP] Add ReplicaOf method to replace deprecated SlaveOf Implement ReplicaOf method to replace deprecated SlaveOf Feb 24, 2026
Copilot AI requested a review from ndyakov February 24, 2026 08:18
@ndyakov ndyakov marked this pull request as ready for review February 24, 2026 08:29
@ndyakov ndyakov merged commit 8eca179 into master Mar 9, 2026
33 checks passed
@ndyakov ndyakov deleted the copilot/implement-replicaof-method branch March 9, 2026 11:35
@ndyakov ndyakov added the feature label Mar 9, 2026
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.

Deprecation of SlaveOf without recommended alternative being implemented

3 participants