-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
Description
Problem
RxDocumentServiceRequest.clone() does not copy all fields. This was discovered during PR #48432 where partitionKeyDefinition was missing from the clone, causing NPE in hedged thin client queries.
A field-by-field audit reveals ~12 other fields that are not copied by clone():
- effectivePartitionKey
- properties (carries excludedRegions and request-scoped metadata)
- throughputControlGroupName
- responseTimeout
- entityId
- and others
Impact
For hedging scenarios (where clone() is used), the cloned request silently loses these properties. The properties map is particularly concerning since it carries excludedRegions -- a hedged request could target an excluded region.
Proposed Fix
- Audit every field in RxDocumentServiceRequest against clone()
- Add missing field copies
- Add a reflection-based completeness test that fails when a new field is added to the class but not included in clone() -- this prevents future regressions
Context
- Reported in PR #48432 review by @xinlian12
- Related to [GATEWAY V2] thin client availability strategy work
- clone() is a maintenance trap -- every new field silently breaks hedging until someone discovers a bug
- The reflection-based test would make this self-enforcing
Reactions are currently unavailable