igniter
igniter copied to clipboard
Igniter.Project.Config.configure/6 should do nothing when updater returns :error
Versions
Elixir 1.18.4 Erlang/OTP 28.0.1
Operating system
macOS
Current Behavior
When the updater returns :error, a new config entry is added:
Update: config/config.exs
1 1 |import Config
2 2 |
3 - |config :my_app, foo: [
4 - | bar: :baz
5 - |]
3 + |config :my_app, foo: nil
6 4 |
5 + |config :my_app,
6 + | foo: [
7 + | bar: :baz
8 + | ]
9 +
Reproduction
igniter =
Igniter.Test.test_project(
files: %{
"config/config.exs" => """
import Config
config :my_app, foo: [
bar: :baz
]
"""
}
)
if Igniter.Project.Config.configures_key?(igniter, "config.exs", :my_app, :foo) do
Igniter.Project.Config.configure(igniter, "config.exs", :my_app, :foo, nil,
updater: fn _zipper -> :error end
)
else
igniter
end
|> Igniter.Test.diff()
|> IO.puts()
Expected Behavior
The config should stay as is, since the updater failed.
(it would also be nice if the :failure_message would be printed whenever the updater returns :error)
I pulled the latest main and noticed there is already a regression test for this behavior in test/igniter/project/config_test.exs. It looks like the original config rewrite issue may already be fixed on main. Is there still work needed here, or should this issue be closed?
I think it is outdated indeed!