Skip to content

Respect SDK flags already present in history regardless of server capability detection.#2936

Merged
eamsden merged 9 commits into
masterfrom
ea/respect-the-flag
Jul 1, 2026
Merged

Respect SDK flags already present in history regardless of server capability detection.#2936
eamsden merged 9 commits into
masterfrom
ea/respect-the-flag

Conversation

@eamsden

@eamsden eamsden commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

What was changed

Respect SDK flags already present in history regardless of server capability detection.

Only default GetSystemInfo capabilities for true unknown-method UNIMPLEMENTED errors.

Retry gzip-compressed unary RPCs once without compression on compression-related UNIMPLEMENTED errors, then cache that downgrade per RPC method.

Why?

A gzip-incompatible gRPC endpoint or proxy can return UNIMPLEMENTED for GetSystemInfo. That should not be confused with an old server missing the RPC, and default capabilities should not mask SDK flags already recorded in history.

Checklist

  1. Closes N/A.

  2. How was this tested:

Added service-client coverage for per-RPC gzip downgrade, method-level downgrade caching, GrpcCompression.NONE, and generic UNIMPLEMENTED errors that must not downgrade.

Updated capability tests to distinguish unknown-method GetSystemInfo failures from gzip/decompression UNIMPLEMENTED failures.

Added replay regression coverage for histories whose SDK flags must still be respected when GetSystemInfo falls back to default capabilities.

  1. Any docs updates needed?

No external docs updates. Javadocs for gRPC compression were updated.

@eamsden eamsden requested a review from a team as a code owner July 1, 2026 20:18

@Sushisource Sushisource 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.

Overall semantics make sense to me but will defer to @maciejdudko for more detailed review


final class GrpcCompressionInterceptor implements ClientInterceptor {
private final GrpcCompression compression;
private final Set<String> compressionUnsupportedMethods =

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.

Needs to be protected for thread safety

Comment on lines 24 to 26
* @return True, as long as the server supports SDK flags
* @return True.
*/
public boolean setSdkFlag(SdkFlag flag) {

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.

Nit: arguably this method should return void. (Return value is unused anyway.)

Comment on lines 47 to 49

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.

Nit: this will always return false now.

}
}

static boolean isGetSystemInfoUnknownMethod(Status status) {

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.

Nit: add @VisibleForTesting annotation

eamsden added 8 commits July 1, 2026 16:41
Add a replay regression test that routes WorkflowService calls through a
small proxy which returns UNIMPLEMENTED for GetSystemInfo and forwards
all other RPCs.

The test injects VERSION_WAIT_FOR_MARKER into a known interleaved
getVersion history, verifies the history replays without the proxy, then
expects the same history to replay through the proxy. On current buggy
code this fails with TMPRL1100 because default capabilities disable SDK
metadata support and mask the recorded SDK flag.
Retry gzip-compressed unary RPCs once without request compression when
the server returns UNIMPLEMENTED with compression-related error text.
Cache
the affected gRPC method so subsequent calls to that method use identity
compression, while unrelated RPCs continue using gzip.

This mirrors sdk-go's per-RPC compression negotiation and avoids
treating
proxy/server gzip support failures as missing GetSystemInfo capability
data.
Keep generic UNIMPLEMENTED errors unchanged.

Add service-client tests covering downgrade, method-level caching,
opt-out
behavior when compression is NONE, and generic UNIMPLEMENTED errors that
must not trigger downgrade.
@eamsden eamsden force-pushed the ea/respect-the-flag branch from f7e7a11 to cfdadd3 Compare July 1, 2026 21:58
@eamsden eamsden enabled auto-merge (squash) July 1, 2026 21:58
@eamsden eamsden merged commit fcfbb36 into master Jul 1, 2026
18 checks passed
@eamsden eamsden deleted the ea/respect-the-flag branch July 1, 2026 23:46
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.

3 participants