May 2026 Summaries
17 posts from Mergify
Filter
Month:
Year:
Post Summaries
Back to Blog
In an effort to enhance the functionality of dashboard charts, the integration of brush zoom, click-to-filter, and shareable URLs was implemented using ECharts, transforming static charts into interactive tools. This involved enabling users to visually drill into time ranges with brush zoom, apply filters directly by clicking on chart segments, and share specific views via URL state persistence. The challenges addressed included coordinating the brush zoom across multiple charts, refactoring state management for click-to-filter functionality, and ensuring URL state accurately reflected the view, including handling edge cases like sidebar navigation. These enhancements eliminated the need for manual screenshot sharing, as users can now share precise, interactive data views through URLs, improving data exploration and collaboration. The approach emphasized the importance of building URL state persistence from the outset and treating chart interactions as state mutations for seamless synchronization across dashboard elements.
May 29, 2026
1,420 words in the original blog post.
In software testing, particularly with the RSpec framework for Rails applications, issues can arise when the Timecop tool is used to freeze time without properly resetting it, leading to time-related test failures across unrelated specs. This occurs because Timecop's side-effecting form requires a manual reset with Timecop.return, and if this is missed, the frozen state persists, causing discrepancies in assertions that depend on the current time. The recommended solution for Rails apps is to switch to ActiveSupport::Testing::TimeHelpers, which offers a block form that automatically resets time, reducing the likelihood of such failures. For non-Rails applications or older Rails versions, using Timecop's block form alongside a global reset hook can mitigate these issues. Additionally, injecting time dependencies directly into production code enhances testability and reduces reliance on global state changes. Tools like Mergify can help identify and manage these time-leak failures by tracking test order and surfacing patterns, ensuring that tests remain reliable and maintainable.
May 24, 2026
1,296 words in the original blog post.
The text discusses the challenges and solutions associated with managing authentication states in Playwright, a popular testing framework. It highlights how a shared authentication file, used to store login state across multiple tests, can lead to test failures when a logout test inadvertently overwrites this state, causing subsequent tests to fail by being redirected to the login page. To address this issue, the text suggests a three-rule approach: utilizing per-test storage paths to prevent shared file overwrites, running tests that alter session states in isolated contexts, and implementing code review checks to ensure only authorized scripts can modify the shared authentication file. Additionally, it touches on the necessity of validating session states for long-running authentication scenarios and how tools like Mergify can help identify the source of test failures by tracking the sequence of test runs. The document emphasizes the importance of scoping shared resources to prevent similar issues and improve test reliability.
May 21, 2026
1,461 words in the original blog post.
Mergify has decided to remove the Jinja2 templating feature from its user configuration after years of maintenance challenges and security concerns. Initially, Jinja2 was used to allow users to template merge commit messages with flexibility, but the ongoing need to patch security vulnerabilities and address upstream bugs became burdensome. An analysis of user configurations revealed that most users employed simple templates, prompting the switch to a narrow declarative schema that better aligns with actual usage patterns. This new schema offers predefined options like inheriting titles or bodies from pull requests and simplifies the process by leveraging GitHub's existing settings without introducing new vulnerabilities. As security threats have evolved, the company recognized the need to update its approach, emphasizing that flexible features serve as valuable research tools but can become liabilities if not periodically reviewed and refined. Mergify continues to use Jinja2 in other areas, but each usage is being re-evaluated to determine if a more secure, narrow schema can be implemented.
May 21, 2026
937 words in the original blog post.
Disabling per-test module isolation in Vitest by setting `isolate: false` in `vitest.config.ts` can lead to a 30% increase in testing speed, but it also introduces a risk of subtle, hard-to-detect bugs due to cross-file state sharing, which appear similar to ordinary logic errors. These issues arise from module-level singletons that persist across test files, causing tests to fail intermittently if they depend on shared state. While reverting to `isolate: true` can temporarily resolve these failures, it doesn't address the underlying problem of state-sharing bugs. The recommended solution involves conducting an audit to identify and refactor module-level mutable states in production code, replacing them with class-based instances or ensuring resets before each test. This approach helps maintain the speed advantage without compromising test reliability. Tools like Mergify Test Insights can assist in identifying these cross-file dependencies by tagging related test files, providing a clearer picture of the source of the issue.
May 19, 2026
1,305 words in the original blog post.
Hypothesis, a property-based testing tool, often reveals hidden bugs in code by generating edge cases that may not have been considered during development. A common scenario involves a test passing consistently for months but suddenly failing in a continuous integration (CI) run due to an unforeseen edge case, such as integer overflow. The text emphasizes that the failure indicates a real bug, not a flaky test, and advises against dismissing the test or modifying it to avoid the edge case. Instead, developers should capture and include the failing example as an explicit test case and fix the underlying code to handle such edge cases. This approach ensures that the bug is addressed and not ignored, as ignoring it could lead to the bug affecting production environments. The text also discusses how to use Hypothesis effectively, including strategies for reproducing failing tests by pinning seeds and differentiating between real bugs and cases that fall outside the intended scope of the function being tested. Mergify's Test Insights is highlighted as a tool that correctly identifies these failures as significant issues rather than mere flakiness, promoting a more proactive approach to testing and bug resolution.
May 17, 2026
1,187 words in the original blog post.
The blog post by Rémy Duthu discusses the challenges of using the database_cleaner gem in testing Rails applications, particularly when dealing with RSpec system specs and JavaScript-driven tests. It explains how Capybara's separate browser connection can cause transactional fixtures to fail, as the browser does not see uncommitted data from the test's connection, leading to empty database errors. The post suggests using a per-spec-type strategy, switching from transactions to truncation for JS specs, to ensure data visibility across connections. For Rails 7.1 and newer, a connection-shared transaction mode can replace database_cleaner, making the test connection visible to the server connection without third-party tools. The article also outlines how Mergify Test Insights detects and categorizes these errors, making it easier for developers to address cleanup-strategy mismatches and maintain stable test environments.
May 15, 2026
1,098 words in the original blog post.
Faced with a rapidly increasing GitHub Actions bill of $400 a day, the team decided to bring their continuous integration (CI) infrastructure in-house using three bare-metal hosts, eventually replacing virtual machines (VMs) with Docker containers. The transition aimed to reduce costs and align with the CI Insights they provide to clients. Initial testing showed significant performance disparities between bare-metal hosts and VMs, prompting extensive optimization efforts with mixed results. Ultimately, the team opted for Docker due to its quicker image iteration and boot times, despite its reduced isolation compared to VMs, as their current needs involved only private repositories without workflow secrets. They addressed challenges like rate limits through a proxy stack and emphasized the importance of image-refresh time over job duration. The static fleet setup enabled predictable costs, contrasting with dynamic autoscaling options, and was managed using a custom declarative reconciler. The transition highlighted areas for improvement, including the need for better runner lifecycle management from GitHub.
May 13, 2026
2,801 words in the original blog post.
In Playwright testing, the timing of route handler registration is crucial for deterministically intercepting network requests, as handlers can only intercept requests made after they are registered. A common issue arises when a handler is registered after a `page.goto()` call, causing it to miss the initial request and fail to intercept the desired API response, often leading to flaky tests. To ensure consistent results, the route handler should be registered before navigation or any action that triggers the request. This principle is critical when mocking requests and can be managed using specific strategies like registering handlers per page or using a counter in the handler for varying responses. Mergify Test Insights identifies these "route-handler-too-late" failures, categorizing them to highlight the order issue without rerunning tests, thus maintaining the test suite's efficiency and reliability.
May 13, 2026
1,165 words in the original blog post.
regex101 is an online regex tester widely used by engineers for its comprehensive features that facilitate writing, understanding, and debugging regular expressions across various programming languages. It supports multiple regex flavors such as PCRE2, JavaScript, Python, and others, allowing users to test patterns in the correct context and providing live matching and detailed explanations of each pattern component. Key features include permalinks for easy sharing, code generators for different languages that handle escape rules and flags, and a substitution preview for testing regex-replace operations. regex101 enhances the regex learning and debugging process by highlighting every group, quantifier, and backreference in real time, and it also identifies errors that may not be apparent in other regex engines. While it excels in testing and interpreting regex patterns, it does not generate regex from descriptions nor does it benchmark performance, making it a versatile tool for pattern creation, analysis, and translation across engines.
May 13, 2026
1,017 words in the original blog post.
The text delves into the intricacies of handling mocks in Vitest, particularly focusing on the concept of hoisting and its implications on mock factories and test execution. It explains how Vitest's compiler hoists `vi.mock` calls to the top of the file, which can lead to ReferenceErrors when closure variables like `stubUser` are accessed before initialization. This behavior arises from the hoisting model inherited from Jest, where ESM imports are evaluated before any module-level code, necessitating mock registration prior to import resolution. The text provides solutions such as using `vi.hoisted()` to declare values that are hoisted alongside mocks, ensuring availability throughout the test file. It also highlights how Mergify's Test Insights can preemptively catch hoisting-related issues by tracking test reliability across different execution environments. The broader context includes various patterns in the flaky-tests-in-Vitest guide, emphasizing the balance between speed optimization and semantic clarity in testing.
May 11, 2026
1,107 words in the original blog post.
The text delves into the challenges and solutions associated with flaky tests in pytest, particularly when using pytest-xdist to distribute tests across multiple workers. It describes a common issue where tests that pass individually fail when run in parallel due to shared external states, such as file paths in temporary directories, which lead to race conditions. The text suggests solutions like using pytest's tmp_path fixture to give each test its own directory or employing tmp_path_factory at session scope for genuinely shared resources, ensuring that no race conditions occur. Additionally, it highlights the importance of choosing the right scheduler, such as loadscope, loadfile, or worksteal, based on the test suite's characteristics to minimize cross-test interference. The document also explains how tools like Mergify Test Insights can help identify and quarantine these race conditions by analyzing failures based on xdist worker IDs, thus preventing them from reaching production unnoticed.
May 09, 2026
922 words in the original blog post.
The text explores the challenges of managing hidden coupling between tests in a Rails application using RSpec, particularly when running tests in a randomized order. It highlights how such coupling leads to flaky tests, where tests pass or fail inconsistently across different runs due to dependencies on the order of execution. The random order feature, which shuffles test execution to expose hidden dependencies, can lead to intermittent failures, known as flaky tests. The text provides insights into diagnosing these issues by reproducing failures using specific seed values and employing the `--bisect` command to isolate the minimal set of interdependent tests. While temporary fixes like pinning the seed or using order-dependent annotations can mask the problem, they don't eliminate the underlying issue of state persistence across tests. The solution involves resetting mutated states between tests, using tools like `stub_const` for constants and `travel_to` with `travel_back` for time mutations. The text underscores the importance of addressing these coupling issues to maintain reliable test suites and mentions tools like Mergify, which can track seed-specific failures and provide insights into test dependencies, helping teams identify and fix hidden couplings before they become problematic.
May 07, 2026
1,090 words in the original blog post.
A new engineer at Mergify developed a daily quiz system based on real test assertions to familiarize himself with a codebase largely written by AI, where he initially scored three out of ten. This tool, built as a Claude Code skill, helps bridge the gap in understanding by presenting one question a day derived from the test suite, ensuring that each question traces back to a real assertion in the codebase, thereby avoiding the pitfalls of AI-generated inaccuracies. The quiz adapts dynamically as the test suite evolves and uses spaced repetition to prioritize areas of weakness, helping the engineer build a mental model of the system through interaction rather than passive review. The process is designed to fit into small breaks, allowing for continuous learning without overwhelming the engineer, though it currently lacks a difficulty gradient, treating common and rare scenarios equally. The approach is particularly beneficial for engineers whose roles focus more on reviewing than writing code, offering a deliberate learning method in environments dominated by AI-generated code.
May 07, 2026
1,967 words in the original blog post.
Rémy Duthu's article explores a common issue within Playwright testing involving auto-wait and component re-renders, particularly in React applications. The problem arises when Playwright's actionability check targets a DOM element that becomes stale due to a React re-render, leading to test failures such as "Element is not attached to the DOM." This occurs because React's state updates can unmount and remount components, resulting in visually identical but programmatically distinct DOM nodes. The author suggests a solution by employing a locator strategy that requeries elements based on a stable parent, ensuring that tests can adapt to DOM changes without failing. Additionally, the article warns against relying on naive fixes like extending timeouts and highlights the importance of identifying underlying performance issues when frequent re-renders occur. It also discusses how tools like Mergify can help identify and quarantine flaky test patterns, thus preventing them from disrupting CI pipelines.
May 05, 2026
1,124 words in the original blog post.
Vitest's default threads pool, which optimizes for speed by reusing module states across tests, can lead to state leakage issues, causing test failures that appear as logic bugs. This configuration is useful for performance as it amortizes the cost of module loading, but it disrupts the assumption of test file isolation that many engineers hold, leading to tests inadvertently sharing state. A common issue is when a module-level Set in a Vitest worker thread is mutated by one test and unexpectedly affects another, which is often caught by tools like Mergify Test Insights. Solutions to this problem include using a slower per-file process isolation with forks, isolating specific files with poolMatchGlobs while maintaining thread usage for the rest, or refactoring to avoid shared states entirely. While manual triage often misidentifies the source of the failure, Mergify's integration with Vitest can identify and tag cross-file dependencies, providing a clearer picture of the issue and aiding in decision-making between configuration changes or code refactoring.
May 04, 2026
1,066 words in the original blog post.
In Rémy Duthu's discussion about pytest fixture teardown races, the focus is on the issue that arises when session-scoped fixtures cause state inconsistencies, particularly in CI environments. The problem occurs when fixtures like seeded_users and admin, which share a database connection, are torn down in the reverse order of their setup, sometimes leading to unexpected deletions due to dependence on shared external resources. A naive defensive teardown can mitigate some visible failures but may still leave orphaned states. The recommended solution is to explicitly declare dependencies between fixtures to ensure proper teardown order, or to isolate fixtures by giving each its own connection. Additional solutions include using transactional fixtures for databases like PostgreSQL to handle rollbacks automatically, ensuring each test operates on a clean database state. Tools like Mergify can help detect these teardown race conditions by tagging tests sensitive to lifecycle issues, allowing for automated quarantine and smoother CI processes. The article also notes that fixture teardown races are part of broader patterns of flaky tests in pytest, often related to state not being cleaned up as expected.
May 01, 2026
1,120 words in the original blog post.