Skip to content

fix: the deletion gate flagged every gem on CI - #242

Merged
pftg merged 1 commit into
masterfrom
fix/deletion-gate-ci-path
Aug 23, 2026
Merged

fix: the deletion gate flagged every gem on CI#242
pftg merged 1 commit into
masterfrom
fix/deletion-gate-ci-path

Conversation

@pftg

@pftg pftg commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Master has been red since #238. The 3.0 deletion test's stray detector used a bare /snap_diff/ substring against $LOADED_FEATURES. CI checks this repo out at /home/runner/work/snap_diff-capybara/snap_diff-capybara/, so the pattern matched every gem under vendor/bundle — the reported strays were all nokogiri, with no snap_diff file among them. It passed locally only because the dev checkout is named capybara-screenshot-diff, which lacks the substring.

Anchored to %r{/lib/snap_diff(/|\.rb\z)}. Verified against all four path shapes:

path matches? required
nokogiri under the CI checkout false false
genuine stray from the intact lib/ true true
the snap_diff.rb entry file true true
a file inside the tmpdir (then rejected by start_with?) true true

ruby -Itest test/unit/deletion_3_0_test.rb → 8 runs, 38 assertions, 0 failures — including the pre-existing "the gate line rejects an intact tree" case, so the gate still bites.

Found by the vocabulary-sweep lane while investigating why its own PR was red.

🤖 Generated with Claude Code

Summary by Sourcery

Bug Fixes:

  • Prevent the 3.0 deletion gate from falsely flagging unrelated gems loaded from CI checkout paths containing the repository name.

Summary by CodeRabbit

  • Bug Fixes
    • Improved deletion checks to correctly identify eligible files under the expected library path.
    • Prevented unrelated paths containing similar names from being incorrectly matched.
    • Continued excluding files within the deleted temporary directory.

The stray detector matched a bare /snap_diff/ substring against
$LOADED_FEATURES. CI checks this repo out at .../snap_diff-capybara/, so
every gem under vendor/bundle matched and the gate aborted on nokogiri.
It passed locally only because the dev checkout is named
capybara-screenshot-diff. Anchored on /lib/snap_diff(/|.rb).
@sourcery-ai

sourcery-ai Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Tightens the deletion gate’s stray file detector in the 3.0 test to only match actual snap_diff library paths instead of any path containing the substring, resolving CI failures where nokogiri and other bundled gems were incorrectly flagged as strays.

File-Level Changes

Change Details Files
Narrow the stray file detection regex in the 3.0 deletion gate test so that only snap_diff library files are considered, preventing CI from flagging unrelated gems as strays.
  • Replace the broad /snap_diff/ grep against $LOADED_FEATURES with an anchored %r{/lib/snap_diff(/
.rb\z)} pattern
  • Document in a comment why anchoring is required given CI checkout paths and vendor/bundle layout
  • Retain the subsequent rejection of files that start with the intact tree path to ensure the gate still only flags true strays

  • Tips and commands

    Interacting with Sourcery

    • Trigger a new review: Comment @sourcery-ai review on the pull request.
    • Continue discussions: Reply directly to Sourcery's review comments.
    • Generate a GitHub issue from a review comment: Ask Sourcery to create an
      issue from a review comment by replying to it. You can also reply to a
      review comment with @sourcery-ai issue to create an issue from it.
    • Generate a pull request title: Write @sourcery-ai anywhere in the pull
      request title to generate a title at any time. You can also comment
      @sourcery-ai title on the pull request to (re-)generate the title at any time.
    • Generate a pull request summary: Write @sourcery-ai summary anywhere in
      the pull request body to generate a PR summary at any time exactly where you
      want it. You can also comment @sourcery-ai summary on the pull request to
      (re-)generate the summary at any time.
    • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
      request to (re-)generate the reviewer's guide at any time.
    • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
      pull request to resolve all Sourcery comments. Useful if you've already
      addressed all the comments and don't want to see them anymore.
    • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
      request to dismiss all existing Sourcery reviews. Especially useful if you
      want to start fresh with a new review - don't forget to comment
      @sourcery-ai review to trigger a new review!

    Customizing Your Experience

    Access your dashboard to:

    • Enable or disable review features such as the Sourcery-generated pull request
      summary, the reviewer's guide, and others.
    • Change the review language.
    • Add, remove or edit custom review instructions.
    • Adjust other review settings.

    Getting Help

    @pftg
    pftg merged commit b1d01af into master Aug 23, 2026
    5 checks passed
    @pftg
    pftg deleted the fix/deletion-gate-ci-path branch August 23, 2026 12:15
    @coderabbitai

    coderabbitai Bot commented Aug 23, 2026

    Copy link
    Copy Markdown

    Review Change Stack

    Caution

    Review failed

    The pull request is closed.

    ℹ️ Recent review info
    ⚙️ Run configuration

    Configuration used: defaults

    Review profile: CHILL

    Plan: Pro Plus

    Run ID: aee3b49b-3abf-44da-886c-b6ba50a53771

    📥 Commits

    Reviewing files that changed from the base of the PR and between 785f413 and 387575c.

    📒 Files selected for processing (1)
    • test/unit/deletion_3_0_test.rb

    📝 Walkthrough

    Walkthrough

    The deletion gate test now matches loaded files under /lib/snap_diff instead of any path containing snap_diff. It still excludes files in the deleted temporary tree.

    Changes

    Deletion gate validation

    Layer / File(s) Summary
    Restrict loaded-feature path matching
    test/unit/deletion_3_0_test.rb
    The test uses a library-path-specific regular expression to avoid matching unrelated dependency paths while detecting loaded files outside the deleted tree.

    Estimated code review effort: 1 (Trivial) | ~2 minutes

    ✨ Finishing Touches
    📝 Generate docstrings
    • Create stacked PR
    • Commit on current branch
    🧪 Generate unit tests (beta)
    • Create PR with unit tests
    • Commit unit tests in branch fix/deletion-gate-ci-path

    Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

    ❤️ Share

    Comment @coderabbitai help to get the list of available commands.

    @sourcery-ai sourcery-ai Bot 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.

    Hey - I've reviewed your changes and they look great!

    Sourcery assessment

    Approved.


    Sourcery is free for open source - if you like our reviews please consider sharing them ✨
    Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

    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