Stacks

Add a Regression Test for a Bug Fix in Erlang with Atlas in 2026

Updated 5 min read

In 2026, Erlang developers use Atlas to add regression tests for bug fixes by first writing a test that fails with `rebar3 eunit`, then applying the fix, and finally confirming the test passes, ensuring the bug is locked in. Atlas leverages the real Erlang toolchain, including `rebar3` for package management and `erlfmt` for consistent code style, all within a terminal-native environment.

How Atlas adds a regression test for an Erlang bug fix

Atlas streamlines the process of adding a regression test for an Erlang bug fix in 2026 by following a red-first, green-second discipline. It guides developers to reproduce the bug, write a failing test, apply the fix, and then confirm the test passes, all within the terminal.

Atlas assists Erlang developers in establishing robust regression tests for bug fixes. The workflow begins with reproducing the bug using Atlas's `bash` tool, capturing the exact failing command and its output. Next, Atlas's `write` tool is employed to create a new Eunit test that specifically asserts on the observed wrong behavior, designed to fail before the fix. Once the failing test is confirmed by running `bash rebar3 eunit`, Atlas's `edit` tool applies the necessary code changes to resolve the bug. The same `bash rebar3 eunit` command is then re-run to confirm the test now passes, effectively locking in the fix. Atlas ensures that every step, from test creation to fix application, is permission-gated and transparent, providing a unified diff for approval.

Concrete Erlang commands and files for regression testing

Erlang developers in 2026 interact with Atlas using concrete commands like `rebar3 eunit` for running tests and `erlfmt` for formatting. Atlas understands the structure of `rebar.config` and `src/*.app.src` files, ensuring it operates within the established Erlang/OTP project conventions.

Atlas is deeply integrated with the Erlang toolchain. When adding a regression test, Atlas uses the `bash` tool to execute `rebar3 eunit`, the standard test runner for Erlang projects built with `rebar3`. This command is crucial for proving the bug's existence (red state) and confirming its resolution (green state). Atlas expects Eunit tests to reside in the `test/` directory, following common Erlang project layouts. For code modifications, Atlas ensures style consistency by running `erlfmt` on touched modules, presenting the formatted changes as a diff for developer approval. Atlas's understanding extends to core Erlang configuration files such as `rebar.config` and `src/*.app.src`, allowing it to accurately map supervisor callbacks, `gen_server` modules, and release configurations, which is vital for precise code indexing and modifications.

Ensuring safety and review with Atlas in Erlang development

Atlas prioritizes safety and developer review in Erlang projects by implementing permission-gated tool calls and unified diffs. Every Atlas tool call, such as running `rebar3 eunit` or applying an `erlfmt` change, requires explicit approval, giving developers full control over their codebase.

Safety and developer oversight are paramount when using Atlas for Erlang development. Atlas operates with a robust permission-gated system, where every tool call, including `bash` executions of `rebar3 eunit` or `erlfmt`, is subject to `allow`, `ask`, or `deny` rules. Before any changes are made, Atlas drafts a plan in a read-only plan agent, which is then presented for review. Once approved, it switches to a build agent. For every file edit, Atlas computes a unified diff, clearly showing the proposed changes to the Erlang code. This diff is surfaced for explicit approval before Atlas writes anything to disk. Furthermore, Atlas integrates with git, reading branches, status, and diffs, and can stage and create commits on your behalf. It also snapshots file changes as git patches, allowing for easy diffing and rolling back of edits, providing a secure and auditable workflow for Erlang bug fixes.

Step by step

  1. 01Reproduce the Erlang bug using Atlas's `bash` tool, capturing the exact failing `rebar3 eunit` command and its output.
  2. 02Use Atlas's `write` tool to draft a new Eunit test module under `test/` that asserts on the observed wrong behavior, ensuring it will fail.
  3. 03Run the newly written Erlang test with `bash rebar3 eunit` and confirm Atlas records a non-zero exit code, proving the bug is reproducible.
  4. 04Apply the bug fix using Atlas's `edit` tool, providing an exact `oldString` to ensure precise replacement within the Erlang module.
  5. 05Re-run the same `bash rebar3 eunit` command to confirm the test now passes, then execute `bash rebar3 eunit` for the wider suite to check for collateral damage.
  6. 06Have Atlas run `erlfmt` on the touched Erlang modules to align with project style, then approve the unified diff.
  7. 07Allow Atlas to stage and create a git commit for the fix and the new regression test.

Frequently asked questions

How does Atlas ensure my Erlang tests are run correctly?
Atlas uses its `bash` tool to execute `rebar3 eunit` directly, capturing the real process exit code to unambiguously determine test pass or fail states for Erlang applications, ensuring accurate validation of your bug fixes.
Can Atlas help me format my Erlang code after a fix?
Yes, Atlas can run `erlfmt` on any touched Erlang modules to ensure the code adheres to your project's style guidelines. It presents a unified diff of the formatted changes for your approval before writing them to disk.
What Erlang project files does Atlas understand?
Atlas understands key Erlang project files like `rebar.config` and `src/*.app.src`. This allows it to accurately map supervisor callbacks, `gen_server` modules, and release configurations within your Erlang/OTP system.
How does Atlas prevent unwanted changes in my Erlang codebase?
Atlas employs a permission-gated system for all tool calls, including `bash` and `edit`. It drafts plans in a read-only agent and presents unified diffs for every file edit, requiring your explicit approval for any Erlang code changes.
Does Atlas support Erlang's hot code loading or supervision trees?
Atlas is designed for Erlang/OTP systems where supervision trees and hot code loading are central. It builds its code index using AST declarations via tree-sitter, providing a deep understanding of your Erlang application's structure.
How does Atlas handle git operations for Erlang fixes?
Atlas reads git branches, status, and diffs. It can stage changes and create commits on your behalf for Erlang fixes, and it snapshots file changes as git patches for easy diffing and rolling back of edits.
Can I use Atlas with my local Erlang development environment?
Yes, Atlas is terminal-native and can build its code index with local Ollama embeddings, keeping your Erlang code off third-party servers. This ensures direct integration with your existing local Erlang development setup.

Try Atlas in your terminal

The terminal-native AI coding agent. Free core, single binary.

Install Atlas

Related guides

Add a Regression Test for a Bug Fix with Atlas in 2026

How to add a regression test with Atlas in 2026: red first, then green. bash records the exit code, write creates the failing test, and edit applies the fix.

Atlas for Erlang in 2026

Atlas is a terminal-native AI coding agent for Erlang/OTP in 2026. Run it in an app with a rebar.config, map supervisors and gen_server modules, review every diff.

Locate Erlang Behavior Implementations with Atlas in 2026

In 2026, Erlang developers use Atlas to quickly find where a behavior is implemented, leveraging semantic search, grep, and LSP tools across rebar3 projects.

Onboard to an unfamiliar codebase in Erlang with Atlas in 2026

Erlang developers in 2026 can use Atlas to quickly build a mental model of unfamiliar rebar3 projects. Understand supervision trees, gen_server modules, and application structure without reading every file, leveraging

Write Unit Tests for Untested Code in Erlang with Atlas in 2026

In 2026, Erlang developers use Atlas to write unit tests for untested modules, leveraging `rebar3 eunit` and `erlfmt` to match existing project conventions and ensure code quality.

Plan a Multi-File Change Before Editing in Erlang with Atlas in 2026

In 2026, Erlang developers use Atlas to plan and review complex multi-file changes, ensuring design approval before modifying a single line of code or running rebar3. Securely design Erlang system updates.

Self-review Your Working Diff Before Committing in Erlang with Atlas in 2026

Erlang developers in 2026 use Atlas to self-review uncommitted diffs, catching mistakes before CI. Leverage rebar3, erlfmt, and eunit with AI assistance.

Run the Erlang Test Suite and Triage Failures with Atlas in 2026

Erlang developers in 2026 use Atlas to efficiently triage rebar3 eunit test failures, transforming extensive red output into a prioritized list of distinct root causes for rapid resolution.

Browse this resource hub