Skip to content

feat(setup): add optional mode arg to target setup#397

Merged
fargito merged 1 commit into
mainfrom
cod-2831-add-a-codspeed-setup-mode-command
Jun 10, 2026
Merged

feat(setup): add optional mode arg to target setup#397
fargito merged 1 commit into
mainfrom
cod-2831-add-a-codspeed-setup-mode-command

Conversation

@fargito

@fargito fargito commented Jun 10, 2026

Copy link
Copy Markdown
Member

No description provided.

@fargito fargito self-assigned this Jun 10, 2026
@greptile-apps

greptile-apps Bot commented Jun 10, 2026

Copy link
Copy Markdown

Greptile Summary

Adds an optional --mode argument (short -m, also read from CODSPEED_RUNNER_MODE) to the codspeed setup command, letting users target a specific executor (or a comma-separated list) rather than always running setup for every executor. The top-level codspeed status command is updated to pass &[] to setup::status, preserving its existing all-executors behaviour.

  • get_executors_from_modes is introduced as a central helper that resolves a &[RunnerMode] slice to executor instances, delegating to get_all_executors() when the list is empty.
  • setup_executor is extracted into its own async helper, cleaning up the previous inline match block.
  • setup::status is updated to accept and honour a modes slice, so codspeed setup status --mode walltime now only shows walltime tool status.

Confidence Score: 4/5

Safe to merge with one fix: the duplicate-executor path in get_executors_from_modes should be guarded before landing.

The refactoring is clean and the new --mode flag behaves correctly for the common cases. The one concrete defect is that passing both the deprecated instrumentation mode and simulation together (or via CODSPEED_RUNNER_MODE) produces two ValgrindExecutor instances, causing duplicate status lines and a redundant second Valgrind setup pass. Once that deduplication is in place, the change is straightforward to merge.

src/cli/setup.rs — specifically get_executors_from_modes

Important Files Changed

Filename Overview
src/cli/setup.rs Adds optional --mode / CODSPEED_RUNNER_MODE filtering to setup and setup status; extracts setup_executor helper. Duplicate executor issue when both instrumentation and simulation modes are passed.
src/cli/status.rs Updates call to setup::status to pass an empty slice (&[]), preserving the existing "show all executors" behaviour for the top-level codspeed status command.

Reviews (3): Last reviewed commit: "feat(setup): add optional `mode` arg to ..." | Re-trigger Greptile

Comment thread src/cli/setup.rs Outdated
@codspeed-hq

codspeed-hq Bot commented Jun 10, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

✅ 7 untouched benchmarks


Comparing cod-2831-add-a-codspeed-setup-mode-command (bd8f33e) with main (aca0831)

Open in CodSpeed

Comment thread src/cli/setup.rs Outdated
Comment thread src/cli/setup.rs Outdated
@fargito fargito force-pushed the cod-2831-add-a-codspeed-setup-mode-command branch from 344837c to c83b535 Compare June 10, 2026 10:35
In some cases, we want to setup only one or several modes.
We can now do so with the `mode` argument that only
installs the requested mode.

Usage:
- `codspeed setup`: installs all modes
- `codspeed setup --mode simulation`: only setup simulation mode
- `codspeed setup --mode simulation,walltime`: setup both modes
- `codspeed setup --mode simulation --mode walltime`: setup both modes
- `codspeed setup status`: show status for all modes
- `codspeed setup --mode simulation` status: show status for simulation mode
- `codspeed setup --mode simulation,walltime` status: show status for both modes
- `codspeed setup --mode simulation --mode walltime` status: show status for both modes
@fargito fargito force-pushed the cod-2831-add-a-codspeed-setup-mode-command branch from c83b535 to bd8f33e Compare June 10, 2026 10:38

@GuillaumeLagrange GuillaumeLagrange left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@fargito fargito merged commit bd8f33e into main Jun 10, 2026
22 checks passed
@fargito fargito deleted the cod-2831-add-a-codspeed-setup-mode-command branch June 10, 2026 12:02
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.

2 participants