feat(local-server-stress-tests): add support for dynamic generator weights#26324
Conversation
…ights Enable generator weights to be functions that receive state and return a weight, instead of only supporting static numeric weights. This allows weights to vary based on the current test state. Co-Authored-By: anthony-murphy <anthony.murphy@microsoft.com> Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
/azp run Build - api-markdown-documenter, Build - benchmark-tool, Build - build-common, Build - build-tools, Build - client packages, Build - common-utils, Build - eslint-config-fluid, Build - eslint-plugin-fluid, Build - protocol-definitions, Build site |
|
/azp run Build - test-tools, repo-policy-check, server-gitrest, server-gitssh, server-historian, server-routerlicious |
|
Azure Pipelines successfully started running 1 pipeline(s). |
1 similar comment
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This PR adds infrastructure for dynamic weight functions in weighted random generators for the local-server-stress-tests package. Currently, the stochastic-test-utils library only supports static numeric weights, but this enhancement enables weights that can be computed dynamically based on runtime test state.
Changes:
- Introduces
dynamicWeightGenerator.tswith support for both static and dynamic (function-based) weights - Updates
baseModel.tsto use the new dynamic weight generator instead of the static one from stochastic-test-utils - Maintains full backward compatibility - existing code with static weights continues to work
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
packages/test/local-server-stress-tests/src/dynamicWeightGenerator.ts |
New module implementing createWeightedAsyncGeneratorWithDynamicWeights, a variant of the stochastic-test-utils function that evaluates weight functions dynamically at runtime |
packages/test/local-server-stress-tests/src/baseModel.ts |
Updated to use the new dynamic weight generator, with type changes from AsyncWeights to DynamicAsyncWeights |
|
/azp run Build - api-markdown-documenter, Build - benchmark-tool, Build - build-common, Build - build-tools, Build - client packages, Build - common-utils, Build - eslint-config-fluid, Build - eslint-plugin-fluid, Build - protocol-definitions, Build - test-tools |
|
/azp run repo-policy-check, server-gitrest, server-gitssh, server-historian, server-routerlicious |
|
Azure Pipelines successfully started running 1 pipeline(s). |
1 similar comment
|
Azure Pipelines successfully started running 1 pipeline(s). |
…ation Simplify the dynamic weight generator by evaluating shouldAccept during the cumulative sums calculation phase rather than using rejection sampling after selection. This means cumulativeSums only contains valid entries, eliminating the need for the do-while loop. Co-Authored-By: anthony-murphy <anthony.murphy@microsoft.com> Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
/azp run Build - client packages, Build - api-markdown-documenter, Build - benchmark-tool, Build - build-common, Build - build-tools, Build - common-utils, Build - eslint-config-fluid, Build - eslint-plugin-fluid, Build - protocol-definitions, Build - test-tools |
|
/azp run Build site, repo-policy-check, server-gitrest, server-gitssh, server-historian, server-routerlicious |
|
Azure Pipelines successfully started running 1 pipeline(s). |
1 similar comment
|
Azure Pipelines successfully started running 1 pipeline(s). |
packages/test/local-server-stress-tests/src/dynamicWeightGenerator.ts
Outdated
Show resolved
Hide resolved
|
/azp run Build site, repo-policy-check, server-gitrest, server-gitssh, server-historian, server-routerlicious |
|
/azp run Build - client packages, Build - api-markdown-documenter, Build - benchmark-tool, Build - build-common, Build - build-tools, Build - common-utils, Build - eslint-config-fluid, Build - eslint-plugin-fluid, Build - protocol-definitions, Build - test-tools |
|
Azure Pipelines successfully started running 1 pipeline(s). |
1 similar comment
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Azure Pipelines commands (copy and post separately, limit of 10 at a time): |
Resolve merge conflicts in baseModel.ts and dynamicWeightGenerator.ts after upstream changes from PR microsoft#26324 were merged to main. Preserved the detached operation phasing logic from this PR while adopting the updated acceptance condition filtering from upstream. Co-Authored-By: anthony-murphy <anthony.murphy@microsoft.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…26325) ## Summary Introduces operation phasing during the detached state before attach: - **Creation phase** (first 7 ops): prioritizes `createDataStore` and `createChannel` with high weights - **DDS ops phase** (ops 8-20): prioritizes `DDSModelOp` operations with increased weight This ensures tests create sufficient data structure (datastores and channels) before exercising DDS operations, providing better test coverage. ## Dependencies - Depends on #26324 (dynamic generator weights) ## Test plan - [x] local-server-stress-tests pass - [x] Verified phasing behavior produces expected operation distribution related to [AB#8839](https://dev.azure.com/fluidframework/235294da-091d-4c29-84fc-cdfc3d90890b/_workitems/edit/8839) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: anthony-murphy-agent <anthony-murphy-agent@users.noreply.github.com> Co-authored-by: anthony-murphy <anthony.murphy@microsoft.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: yann-achard-MS <97201204+yann-achard-MS@users.noreply.github.com>
Summary
dynamicWeightGenerator.tswithcreateWeightedAsyncGeneratorWithDynamicWeightsThe standard
createWeightedAsyncGeneratorfrom stochastic-test-utils only supports static numeric weights. This enhancement enables dynamic weighting based on runtime conditions like container attach state.Test plan
related to AB#8839
🤖 Generated with Claude Code