Skip to content

Skip stale RBI file removal when --only is set#2642

Open
Vein05 wants to merge 1 commit into
Shopify:mainfrom
Vein05:fix/skip-purge-with-only
Open

Skip stale RBI file removal when --only is set#2642
Vein05 wants to merge 1 commit into
Shopify:mainfrom
Vein05:fix/skip-purge-with-only

Conversation

@Vein05
Copy link
Copy Markdown

@Vein05 Vein05 commented Jun 7, 2026

Motivation

Fixes #1612.

When tapioca dsl --only runs, only the specified compilers execute. The purge logic in generate_dsl_rbi_files computes existing_rbi_files - generated_files and treats the result as stale. Since only a subset of compilers ran, RBI files from every other compiler end up in the purge set and get deleted, producing a large misleading diff.

Implementation

Guard the purge computation in abstract_dsl.rb with an @only.any? check. When --only is present, the method returns an empty Set and logs a message explaining that stale RBI removal was skipped. The guard is placed after pipeline.run so file generation still executes normally (including for dsl --only --verify).

Tests

Added a new test ("does not remove existing RBI files when using --only") that:

  1. Generates RBI files for two compilers via a full dsl run
  2. Re-runs with --only SidekiqWorker
  3. Asserts both RBI files still exist and no "Removing stale RBI files" message appears

Updated four existing --only tests to include the new skip message in their expected stdout.

I added say("Skipping stale RBI removal because --only is set.", :yellow) instead of "Skipping purging because of --only flag" as that felt more relevant here.

This will be my first time working with production ruby, and I may have skipped something important. I'm open to suggestions. Thanks!

All 69 tests pass (0 failures, 1 pre-existing protobuf error). bin/typecheck passes with no errors.

When `tapioca dsl --only` runs, only a subset of compilers executes.
The purge logic then treats every RBI from excluded compilers as stale
and deletes them, producing a large misleading diff.

Return an empty purge set when `--only` is present so existing RBI
files from other compilers are preserved during focused runs.

Fixes Shopify#1612
@Vein05 Vein05 requested a review from a team as a code owner June 7, 2026 16:36
@Vein05
Copy link
Copy Markdown
Author

Vein05 commented Jun 7, 2026

I have signed the CLA!

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.

bin/tapioca dsl --only should not purge existing directory

1 participant