Skip to content

Fix bare VUs scenario override precedence#5986

Draft
cursor[bot] wants to merge 2 commits into
masterfrom
cursor/critical-correctness-bugs-b203
Draft

Fix bare VUs scenario override precedence#5986
cursor[bot] wants to merge 2 commits into
masterfrom
cursor/critical-correctness-bugs-b203

Conversation

@cursor

@cursor cursor Bot commented May 14, 2026

Copy link
Copy Markdown

What?

Fixes the bare vus shortcut precedence introduced by PR #5794 so it only clears lower-priority scenarios when the bare vus value comes from a higher-priority configuration tier.

Also keeps explicit empty stages from activating a lower-tier bare vus, while still allowing a higher-tier --vus to override lower empty stages and run as shared iterations.

Why?

After the recent bare --vus change, any final Options value with VUs.Valid and Scenarios != nil could replace scenarios during derivation, regardless of where vus came from. A config-file default like { "vus": 3 } combined with a script that defines scenarios would silently run a default shared-iterations scenario instead of the script's scenarios, causing major load profile corruption.

Root cause: DeriveScenariosFromShortcuts() only sees the consolidated options, so it could not distinguish higher-tier CLI/env/script overrides from lower-tier defaults that should not override explicit scenarios.

Checklist

  • I have performed a self-review of my code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests for my changes.
  • I have run linter and tests locally (make check) and all pass.

Validation performed:

  • go test ./internal/cmd ./lib/...
  • go test ./internal/cmd/... ./lib/...

Checklist: Documentation (only for k6 maintainers and if relevant)

Please do not merge this PR until the following items are filled out.

  • I have added the correct milestone and labels to the PR.
  • I have updated the release notes: link
  • I have updated or added an issue to the k6-documentation: grafana/k6-docs#NUMBER if applicable
  • I have updated or added an issue to the TypeScript definitions: grafana/k6-DefinitelyTyped#NUMBER if applicable

Related PR(s)/Issue(s)

Follow-up to #5794 / #5793

Open in Web View Automation 

cursoragent and others added 2 commits May 14, 2026 11:10
Co-authored-by: Inanc Gumus <github@inanc.io>
Co-authored-by: Inanc Gumus <github@inanc.io>
@cla-assistant

cla-assistant Bot commented May 14, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@cursor cursor Bot temporarily deployed to azure-trusted-signing May 14, 2026 11:18 Inactive
@cursor cursor Bot temporarily deployed to azure-trusted-signing May 14, 2026 11:20 Inactive
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