fix(matching): return typed ownership errors consistently with SD#7740
Conversation
aee032d to
185e324
Compare
**What changed?**
Standardized task list ownership-guard behavior in matching so SD-onboarded and non-onboarded paths return consistent typed ownership errors where applicable.
Also added unit-test for `errIfShardOwnershipLost`.
**Why?**
Previously, ownership checks could return different error shapes depending on whether shard distributor onboarding was enabled.
In SD mode, one branch returned an untyped wrapped error while non-SD mode returned `TaskListNotOwnedByHostError`.
This made error handling inconsistent and could cause ownership-related metrics/logs to be missed.
This change aligns behavior and adds dedicated tests to protect expected ownership semantics with and without shard-distributor.
**How did you test it?**
- `go test -v ./service/matching/handler TestErrIfShardOwnershipLost`
- `go test -v ./service/matching/handler/...`
**Potential risks**
- Matching ownership guard behavior is sensitive and sits in task-list manager acquisition flow.
- Error typing/shape changes can affect downstream error classification or alerting expectations.
- at the same time, the behaviour is now aligned with the previous
(ringpop) case
**Release notes**
N/A (internal correctness/consistency fix).
**Documentation Changes**
N/A.
Signed-off-by: Jan Kisel <dkrot@uber.com>
185e324 to
dd96aa0
Compare
Code Review ✅ Approved 2 resolved / 2 findingsClean refactor that standardizes ownership error types across SD and ringpop paths. Previous finding about missing SD happy path test has been resolved with the new test case at line 464. No new issues found. ✅ 2 resolved✅ Quality: Unused
|
| Auto-apply | Compact |
|
|
Was this helpful? React with 👍 / 👎 | Gitar
fix(matching): return typed ownership errors consistently with SD
What changed?
Standardized task list ownership-guard behavior in matching so SD-onboarded and non-onboarded paths return consistent typed ownership errors where applicable.
Also added unit-test for
errIfShardOwnershipLost.This is part of production-readiness for SD (#6862)
Why?
Previously, ownership checks could return different error shapes depending on whether shard distributor onboarding was enabled.
In SD mode, one branch returned an untyped wrapped error while non-SD mode returned
TaskListNotOwnedByHostError.This made error handling inconsistent and could cause ownership-related metrics/logs to be missed.
This change aligns behavior and adds dedicated tests to protect expected ownership semantics with and without shard-distributor.
How did you test it?
go test -v ./service/matching/handler TestErrIfShardOwnershipLostgo test -v ./service/matching/handler/...Potential risks
(ringpop) case
Release notes
N/A (internal correctness/consistency fix).
Documentation Changes
N/A.
Reviewer Validation
PR Description Quality (check these before reviewing code):
go testinvocation)