Skip to content

fix(membership): support truncated UUIDs in tasklist exclusion#7768

Open
jakobht wants to merge 2 commits intocadence-workflow:masterfrom
jakobht:update_uuid_regex
Open

fix(membership): support truncated UUIDs in tasklist exclusion#7768
jakobht wants to merge 2 commits intocadence-workflow:masterfrom
jakobht:update_uuid_regex

Conversation

@jakobht
Copy link
Copy Markdown
Member

@jakobht jakobht commented Mar 2, 2026

What changed?

Updated the UUID regex in tasklist differentiator to accept 10-12 hex characters in the final segment instead of exactly 12.

Why?

Short-lived tasklists are being created with truncated UUIDs (10 or 11 hex characters in the last segment). These were not being matched by the existing strict UUID pattern, causing them to bypass the shard distributor exclusion logic.

How did you test it?

go test -v ./common/membership/... -run TestTaskListExcludedFromShardDistributor

Potential risks

Low - the regex change is minimal and backwards compatible. Existing full UUIDs continue to match, while also matching slightly truncated variants.

Release notes

N/A

Documentation Changes

N/A

…ng to catch those

Signed-off-by: Jakob Haahr Taankvist <jht@uber.com>
@gitar-bot
Copy link
Copy Markdown

gitar-bot bot commented Mar 23, 2026

Please add a reference to the related GitHub issue in the PR description. You can use any of the following formats:

  • Fixes #123
  • cadence-workflow/cadence#123
  • https://github.com/cadence-workflow/cadence/issues/123

Comment on lines 24 to +33
{
name: "task list with short UUID (end segment is 11 characters)",
taskListName: "tasklist-550e8400-e29b-41d4-a716-4466554400a",
want: true,
},
{
name: "task list with short UUID (end segment is 10 characters)",
taskListName: "tasklist-550e8400-e29b-41d4-a716-4466554400suffix",
want: true,
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚨 Bug: New truncated-UUID tests don't actually test the regex

The two new test cases for short UUIDs (lines 24-33) omit both excludeShortLivedTaskLists (defaults to false) and percentageOnboarded (defaults to 0). With these defaults:

  1. excludeShortLivedTaskLists = false && uuidRegexp.MatchString(...) → always false (short-circuited), so the UUID regex is never evaluated.
  2. !belowPercentage(name, 0)!(hash%100 < 0) → always true (uint64 is never < 0).

So want: true passes trivially for any task list name, regardless of whether the regex matches. These tests provide no coverage for the regex change.

You can verify by changing want to false or using a non-UUID name — they'll still pass with want: true.

Suggested fix:

Set the flags to actually exercise the UUID path:
		{
			name:                       "task list with short UUID (end segment is 11 characters)",
			taskListName:               "tasklist-550e8400-e29b-41d4-a716-4466554400a",
			want:                       true,
			percentageOnboarded:        100,
			excludeShortLivedTaskLists: true,
		},

Was this helpful? React with 👍 / 👎 | Reply gitar fix to apply this suggestion

@gitar-bot
Copy link
Copy Markdown

gitar-bot bot commented Mar 23, 2026

🔍 CI failure analysis for 33de09b: Build failure due to duplicate field names in test struct literal in tasklist_differentiator_test.go; the new test cases added for truncated and uppercase UUIDs were not properly closed, causing compilation errors across all test jobs.

Overview

All 3 CI jobs failed with the same root cause: a Go compilation error in tasklist_differentiator_test.go. The PR adds support for truncated UUIDs in tasklist exclusion but introduces a syntax error in the test file that prevents the code from compiling. This affects both the codecov and golang unit test pipelines.

Failures

Duplicate Struct Fields in Test Case (confidence: high)

  • Type: build
  • Affected jobs: All (codecov, golang unit test, coverage report)
  • Related to change: yes
  • Root cause: Lines 25-37 add three new test cases for truncated and uppercase UUID matching, but the closing brace and comma are missing after line 36. This causes the struct fields from line 38 onwards (name, taskListName, want) to be treated as duplicate fields within the same struct literal rather than part of a new test case.
  • Suggested fix: Add a closing brace and comma after the uppercase UUID test case on line 36. Each test case should be properly closed: {name: "...", taskListName: "...", want: true},. The diff shows the new test cases were inserted but not properly terminated, leaving the existing test case (now at line 38) as part of the same struct literal.

Summary

  • Change-related failures: 3/3 jobs failed due to the same syntax error introduced by this PR
  • Infrastructure/flaky failures: None detected
  • Recommended action: Fix the test struct literal syntax in tasklist_differentiator_test.go by properly closing the new test case blocks with closing braces and commas before the next test case definition begins. This is a straightforward syntax fix that will unblock all CI pipelines.
Code Review 🚫 Blocked 0 resolved / 2 findings

Adds truncated UUID support to tasklist exclusion but is blocked by two critical issues: duplicate struct fields causing a compile error in test case definitions, and new truncated-UUID tests that don't actually exercise the regex due to missing required test configuration parameters.

🚨 Bug: Duplicate struct fields cause compile error in test

📄 common/membership/tasklist_differentiator_test.go:34-43

The "task list with uppercase UUID" test case (line 34) is missing its closing }, and opening { before the next test case ("task list with UUID - exclude disabled"). This merges the two struct literals, producing duplicate name, taskListName, and want fields in a single Go struct literal — a compile error.

This means the tests cannot run, so none of the new behavior is verified.

Suggested fix
Add the missing struct closing/opening between the two test cases:

		{
			name:                       "task list with uppercase UUID",
			taskListName:               "tasklist-550E8400-E29B-41D4-A716-446655440000",
			want:                       true,
			percentageOnboarded:        100,
			excludeShortLivedTaskLists: true,
		},
		{
			name:                       "task list with UUID - exclude disabled",
			...
🚨 Bug: New truncated-UUID tests don't actually test the regex

📄 common/membership/tasklist_differentiator_test.go:24-33

The two new test cases for short UUIDs (lines 24-33) omit both excludeShortLivedTaskLists (defaults to false) and percentageOnboarded (defaults to 0). With these defaults:

  1. excludeShortLivedTaskLists = false && uuidRegexp.MatchString(...) → always false (short-circuited), so the UUID regex is never evaluated.
  2. !belowPercentage(name, 0)!(hash%100 < 0) → always true (uint64 is never < 0).

So want: true passes trivially for any task list name, regardless of whether the regex matches. These tests provide no coverage for the regex change.

You can verify by changing want to false or using a non-UUID name — they'll still pass with want: true.

Suggested fix
Set the flags to actually exercise the UUID path:
		{
			name:                       "task list with short UUID (end segment is 11 characters)",
			taskListName:               "tasklist-550e8400-e29b-41d4-a716-4466554400a",
			want:                       true,
			percentageOnboarded:        100,
			excludeShortLivedTaskLists: true,
		},
🤖 Prompt for agents
Code Review: Adds truncated UUID support to tasklist exclusion but is blocked by two critical issues: duplicate struct fields causing a compile error in test case definitions, and new truncated-UUID tests that don't actually exercise the regex due to missing required test configuration parameters.

1. 🚨 Bug: Duplicate struct fields cause compile error in test
   Files: common/membership/tasklist_differentiator_test.go:34-43

   The "task list with uppercase UUID" test case (line 34) is missing its closing `},` and opening `{` before the next test case ("task list with UUID - exclude disabled"). This merges the two struct literals, producing duplicate `name`, `taskListName`, and `want` fields in a single Go struct literal — a compile error.
   
   This means the tests cannot run, so none of the new behavior is verified.

   Suggested fix:
   Add the missing struct closing/opening between the two test cases:
   
   		{
   			name:                       "task list with uppercase UUID",
   			taskListName:               "tasklist-550E8400-E29B-41D4-A716-446655440000",
   			want:                       true,
   			percentageOnboarded:        100,
   			excludeShortLivedTaskLists: true,
   		},
   		{
   			name:                       "task list with UUID - exclude disabled",
   			...

2. 🚨 Bug: New truncated-UUID tests don't actually test the regex
   Files: common/membership/tasklist_differentiator_test.go:24-33

   The two new test cases for short UUIDs (lines 24-33) omit both `excludeShortLivedTaskLists` (defaults to `false`) and `percentageOnboarded` (defaults to `0`). With these defaults:
   
   1. `excludeShortLivedTaskLists = false && uuidRegexp.MatchString(...)` → always `false` (short-circuited), so the UUID regex is never evaluated.
   2. `!belowPercentage(name, 0)` → `!(hash%100 < 0)` → always `true` (uint64 is never < 0).
   
   So `want: true` passes trivially for *any* task list name, regardless of whether the regex matches. These tests provide no coverage for the regex change.
   
   You can verify by changing `want` to `false` or using a non-UUID name — they'll still pass with `want: true`.

   Suggested fix:
   Set the flags to actually exercise the UUID path:
   		{
   			name:                       "task list with short UUID (end segment is 11 characters)",
   			taskListName:               "tasklist-550e8400-e29b-41d4-a716-4466554400a",
   			want:                       true,
   			percentageOnboarded:        100,
   			excludeShortLivedTaskLists: true,
   		},

Rules ⚠️ 1/2 requirements met

Repository Rules

GitHub Issue Linking Requirement: Add a reference to the GitHub issue in the PR description using one of these formats: 'Fixes #123', '#123', or 'https://github.com//issues/123'.
PR Description Quality Standards: All required sections are present and substantive with clear explanations for the truncated UUID fix.

Tip

Comment Gitar fix CI or enable auto-apply: gitar auto-apply:on

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

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