Skip to content

[CRE-7129] Make sharding test deterministic by picking workflow names upfront - #24225

Open
dmitriytymosh wants to merge 1 commit into
developfrom
CRE-7129-deterministic-sharding-test
Open

dmitriytymosh wants to merge 1 commit into
developfrom
CRE-7129-deterministic-sharding-test

Conversation

@dmitriytymosh

@dmitriytymosh dmitriytymosh commented Nov 17, 2026 •

Copy link
Copy Markdown

CRE-7129

What

The sharding system tests required workflows on both shards, but shard placement is consistent hashing over the workflow ID, and the ID depends on the compiled WASM, so with fixed names all workflows occasionally landed on one shard (about 1 run in 15 with 5 workflows). The previous workaround raised the cron workflow count to 16, which only lowered the odds and slowed every run.

Now the test picks the workflow names upfront. It computes the workflow ID for each candidate name and the shard the ring routes it to, and keeps names until the workflows are split evenly between the two shards. The distribution no longer depends on hash luck, so the cron scenario is back to 5 workflows.

  • ring.LocateShard: exported wrapper over the existing ring placement, so tests use the same code as the nodes. No change in node behavior.
  • workflow.ComputeWorkflowID: workflow ID derivation extracted from RegisterWithContract, so prediction and registration share one implementation.
  • t_helpers.WorkflowIDPredictor: compiles the workflow once and computes the ID per name.
  • sharding_test.go: pickShardSpanningWorkflowNames is used by the cron, EVM log and HTTP trigger scenarios.

Requires

None.

Supports

None.

Deployment Validation Steps

Tests only, plus an exported helper in core/services/ring that nodes do not call. Nothing to validate in staging.

Verified locally with Local CRE (workflow-gateway-sharded-don.toml): Test_CRE_V2_Sharding (cron and EVM log) and Test_CRE_V2_ShardingWithHttpTrigger pass. golangci-lint v2.15.0 reports no issues for the changed packages.

@dmitriytymosh
dmitriytymosh requested review from a team as code owners November 17, 2026 23:43
@github-actions

Copy link
Copy Markdown
Contributor

👋 dmitriytymosh, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions

Copy link
Copy Markdown
Contributor

✅ No conflicts with other open PRs targeting develop

@dmitriytymosh dmitriytymosh self-assigned this Nov 17, 2026
@mchain0
mchain0 requested review from mchain0 and removed request for justinkaseman November 18, 2026 09:15
@dmitriytymosh
dmitriytymosh force-pushed the CRE-7129-deterministic-sharding-test branch from 5f13b2c to cfc7e3f Compare November 19, 2026 22:17

This branch has not been deployed

No deployments
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