Skip to content

Prevent Minitest reporters from being mutated after LSP hooks #3518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

vinistock
Copy link
Member

@vinistock vinistock commented May 21, 2025

Motivation

Putting the effort on users to configure their apps in a way that prevents Minitest reporters from being replaced is not a nice experience. We can instead patch the accessors for reporters, so that no gem is able to change the reporters once the LSP has hooked them for the explorer usage.

Implementation

Created a patch module that does two things:

  1. Prevents fully overriding the reporters by no-oping the reporters= writer
  2. Prevents mutating the array of reporters (with append, prepend or delete) by overriding the reader, so that it always returns a fresh copy of the reporters array

Copy link
Member Author


How to use the Graphite Merge Queue

Add the label graphite-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@vinistock vinistock force-pushed the 05-21-prevent_minitest_reporters_from_being_mutated_after_lsp_hooks branch from 938d00e to 2e33963 Compare May 21, 2025 17:48
@vinistock vinistock self-assigned this May 21, 2025
@vinistock vinistock added server This pull request should be included in the server gem's release notes bugfix This PR will fix an existing bug labels May 21, 2025 — with Graphite App
@vinistock vinistock marked this pull request as ready for review May 21, 2025 17:49
@vinistock vinistock requested a review from a team as a code owner May 21, 2025 17:49
@vinistock vinistock enabled auto-merge (squash) May 21, 2025 18:00
@vinistock vinistock merged commit 852c014 into main May 21, 2025
44 of 45 checks passed
@vinistock vinistock deleted the 05-21-prevent_minitest_reporters_from_being_mutated_after_lsp_hooks branch May 21, 2025 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants