Skip to content

Preserve indeterminate Redis outcomes across transport failures - #1462

Merged
bootjp merged 1 commit into
mainfrom
feature/redis-typed-error-boundary
Nov 13, 2026
Merged

bootjp merged 1 commit into
mainfrom
feature/redis-typed-error-boundary

Conversation

@bootjp

@bootjp bootjp commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Behavior

  • Remove error-text suffix matching from Redis leader classification.
  • Treat gRPC statuses, transport failures, and post-proposal leadership loss as indeterminate Redis outcomes, including EXEC terminal errors.
  • Give the leader proxy circuit sentinel a distinct type so same-text errors cannot impersonate it.

Risk

Some previously retryable NOTLEADER replies now become explicit unknown outcomes when the request may have been submitted. This is conservative; clients must resolve or avoid replaying non-idempotent operations.

Verification

  • Focused kv and adapter tests pass, including race tests and leader proxy gRPC tests.
  • Commit lint passed with 0 issues.
  • Full adapter suite timed out locally after 10 minutes in Raft integration tests; CI is the authoritative full run.

Summary by CodeRabbit

  • バグ修正
    • リーダー切り替えや通信切断などで処理結果を確認できない場合、結果不明として応答するようになりました。
    • リーダー不在や各種通信エラーを適切に分類し、Redisエラー応答の内容を安定させました。
    • リーダー関連エラーやトランザクションエラーの判定を改善しました。

@bootjp

bootjp commented Nov 13, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Redisアダプターのエラー分類を、型付きエラーと転送状態に基づく判定へ変更しました。結果不明エラーとデコード済みNOTLEADER応答に固定のRedis応答を返します。プロキシのトランザクション処理と関連テストも更新しました。

Changes: Redisエラー結果の処理

Layer / File(s) Summary
Redisエラー分類と応答
adapter/redis.go, kv/leader_proxy_breaker.go, adapter/redis_error_prefix_test.go
gRPCステータス、期限超過、キャンセル、EOF、ネットワークエラー、リーダーシップ喪失を結果不明として扱います。デコード済みNOTLEADER応答には固定応答を返します。一時的リーダーエラーの末尾文字列判定を削除し、回路遮断エラーの型を変更しました。
プロキシのトランザクションエラー処理
adapter/redis_proxy_leader.go, adapter/redis_error_prefix_test.go
パイプラインとコマンドのエラー処理で、結果不明や終端エラーに対応するRedis応答を返します。トランザクションおよびコマンドの各経路で、トップレベル応答と配列応答の扱いをテストします。

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Possibly related issues

Possibly related PRs

  • bootjp/elastickv#1380 — writeRedisErrorで結果不明エラーに固定応答を返す経路を共有します。
  • bootjp/elastickv#1335 — 結果不明エラーの伝播と、そのRedis応答での取り扱いに関連します。
Merge Risk: Minimal · up to adeb3

The change classifies ambiguous Redis outcomes as explicit unknown replies instead of matching error-text suffixes. No concrete merge-blocking issue remains. Some previously retryable NOTLEADER replies now become unknown outcomes, which the author has already disclosed.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed PRタイトル「Preserve indeterminate Redis outcomes across transport failures」は、変更の主目的である、トランスポート障害時の不確定なRedis結果の扱いを明確に示しています。要約とPR目的の両方に一致します。ただし、NOTLEADER判定からのサフィックス照合の削除や、ErrLeaderProxyCircuitOpenの型変更は含まれ…
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

PRタイトル「Preserve indeterminate Redis outcomes across transport failures」は、変更の主目的である、トランスポート障害時の不確定なRedis結果の扱いを明確に示しています。要約とPR目的の両方に一致します。ただし、NOTLEADER判定からのサフィックス照合の削除や、ErrLeaderProxyCircuitOpenの型変更は含まれていません。それらは副次的な変更であり、タイトルに含める必要はありません。

  • 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

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: 60b26a0c-eef3-4c97-9261-68401706ba1f
Commits

Reviewing files that changed from the base of the PR and between 3d26854 and adeb35a.

Files selected for processing: 4

  • adapter/redis.go
  • adapter/redis_error_prefix_test.go
  • adapter/redis_proxy_leader.go
  • kv/leader_proxy_breaker.go

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T01:07:56.297657Z adeb35a Manual request
🔒 Security Review ✅ Completed 2026-11-13T01:10:04.769167Z adeb35a Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7319681481

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread adapter/redis.go
return true
}
}
return false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve recognition of explicit NOTLEADER replies over RESP

When a proxied EXEC target rejects the transaction with NOTLEADER leader not found, go-redis decodes that reply into a Redis error without any Go sentinel identity. Removing the suffix fallback makes both handleProxyTxnError and handleProxyTxnCommandError ignore this terminal rejection, so proxyTransactionToLeaderAddr falls through to writing an EXEC result array containing the copied error for every queued command. This changes a rejected transaction into an apparently executed transaction with per-command failures and prevents clients from handling the top-level rejection correctly. Recognize the explicit RESP NOTLEADER error code separately from arbitrary error-text suffixes, and cover this path with a decoded Redis error rather than a typed gRPC status.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 7319681481

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@bootjp
bootjp force-pushed the feature/redis-typed-error-boundary branch from 7319681 to 9ea9aff Compare November 13, 2026 01:01
@bootjp

bootjp commented Nov 13, 2026

Copy link
Copy Markdown
Owner Author

Handled the EXEC terminal-reply finding at 9ea9aff: decoded RESP NOTLEADER is recognized by its explicit Redis error code and promoted to a fixed top-level reply; arbitrary suffixes and plain-text lookalikes are excluded. Targeted tests and lint pass.

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9ea9aff9e6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +299 to +301
isRedisNotLeaderReply(err) ||
errors.Is(err, raftengine.ErrLeadershipLost) ||
isRedisTransportUncertain(err)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve decoded unknown outcomes as top-level EXEC errors

When EXEC is forwarded through a server without requestAdmission (as configured in cmd/server/demo.go), the target now converts leadership-loss and gRPC failures into ERR operation outcome unknown. After go-redis decodes that RESP reply, it has neither the original sentinel nor a transport-error type, so both terminal-error checks ignore it and proxyTransactionToLeaderAddr writes an array containing the copied error for each queued command. Previously, the leadership failures recognized by the suffix fallback remained top-level rejections. This makes an indeterminate transaction look like an executed transaction with individual command failures. Apply the existing isProxyTransactionOutcomeUnknown recognition outside the admission-only path and preserve the fixed top-level unknown reply.

Useful? React with 👍 / 👎.

Signed-off-by: bootjp <contact@bootjp.me>
@bootjp
bootjp force-pushed the feature/redis-typed-error-boundary branch from 9ea9aff to adeb35a Compare November 13, 2026 01:06
@bootjp

bootjp commented Nov 13, 2026

Copy link
Copy Markdown
Owner Author

The decoded unknown-outcome EXEC finding is addressed at adeb35a. Both pipeline-level and per-command decoded terminal errors now produce the fixed top-level unknown reply; focused tests and lint pass.

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: adeb35a0cb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: adeb35a0cb

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@bootjp
bootjp merged commit 2f7b915 into main Nov 13, 2026
18 checks passed
@bootjp
bootjp deleted the feature/redis-typed-error-boundary branch November 13, 2026 01:27
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.

1 participant