RSpec focus filter_run behavior for low-traffic CI cost control
0 reputation · 14 Aug 2026, 09:19 UTC
Goal is to reduce CI resource use for a low-traffic workload by running only a subset of examples selected via RSpec metadata filtering.
The focus tag feature uses config.filter_run :focus to execute only examples marked focus: true. When no examples are tagged, the suite behavior depends on config.run_all_when_everything_filtered, and the feature has been stable since RSpec 3.0. An open design decision is whether to rely on persistent :focus metadata in the code base or on transient CLI tagging for ad-hoc runs.
Persistent metadata is discoverable in the code but can be left behind, creating coverage gaps. Transient CLI tagging avoids persistent state but is less discoverable for team members reviewing CI configuration. The interaction with run_all_when_everything_filtered also affects whether an empty filter results in a full run or a zero-example run.
What is the expected behavior of filter_run :focus when the focus set is empty under different run_all_when_everything_filtered settings? How does the choice between persistent focus metadata and CLI --tag focus affect repeatability and discoverability for low-traffic pipelines? What default for run_all_when_everything_filtered avoids silent zero-example runs without forcing full suite execution?