Compare commits

..

19 Commits

Author SHA1 Message Date
CI
e585cdfd20 chore: release version v1.91.7 2026-01-05 20:29:10 +00:00
Dmitry Popov
3a3180f7b3 Merge branch 'main' of github.com:wanderer-industries/wanderer 2026-01-05 21:28:38 +01:00
Dmitry Popov
53abc580e5 chore: added promo on characters page 2026-01-05 21:28:35 +01:00
CI
8710d172a0 chore: [skip ci] 2026-01-04 23:49:15 +00:00
CI
301a380a4b chore: release version v1.91.6 2026-01-04 23:49:15 +00:00
Dmitry Popov
8c911f89e0 fix(core): fixed new connections got deleted after linked signature cleanup 2026-01-05 00:48:38 +01:00
CI
d7e09fc94e chore: [skip ci] 2025-12-30 10:49:35 +00:00
CI
3b7e191898 chore: release version v1.91.5 2025-12-30 10:49:35 +00:00
Dmitry Popov
f351fbaf20 Merge branch 'main' of github.com:wanderer-industries/wanderer 2025-12-30 11:49:02 +01:00
Dmitry Popov
016e793ba7 chore: Added 2026 roadmap blog post 2025-12-30 11:48:59 +01:00
CI
db483fd253 chore: [skip ci] 2025-12-30 09:27:37 +00:00
CI
911ba231cd chore: release version v1.91.4 2025-12-30 09:27:37 +00:00
Dmitry Popov
b3053f325d Merge branch 'main' of github.com:wanderer-industries/wanderer 2025-12-30 10:27:06 +01:00
Dmitry Popov
4ab47334fc fix(core): fixed connections create between k-space systems (considered as wh connection) 2025-12-30 10:27:03 +01:00
CI
e163f02526 chore: [skip ci] 2025-12-28 17:02:12 +00:00
CI
9e22dba8f1 chore: release version v1.91.3 2025-12-28 17:02:12 +00:00
Dmitry Popov
9631406def Merge branch 'main' of github.com:wanderer-industries/wanderer 2025-12-28 18:01:43 +01:00
Dmitry Popov
f6ae448c3b chore: update event post 2025-12-28 18:01:39 +01:00
CI
46345ef596 chore: [skip ci] 2025-12-27 22:11:03 +00:00
20 changed files with 560 additions and 75 deletions

3
.gitignore vendored
View File

@@ -17,6 +17,9 @@ repomix*
/priv/static/images/
/priv/static/*.js
/priv/static/*.css
/priv/static/*-*.png
/priv/static/*-*.webp
/priv/static/*-*.webmanifest
# Dialyzer PLT files
/priv/plts/

View File

@@ -2,6 +2,39 @@
<!-- changelog -->
## [v1.91.7](https://github.com/wanderer-industries/wanderer/compare/v1.91.6...v1.91.7) (2026-01-05)
## [v1.91.6](https://github.com/wanderer-industries/wanderer/compare/v1.91.5...v1.91.6) (2026-01-04)
### Bug Fixes:
* core: fixed new connections got deleted after linked signature cleanup
## [v1.91.5](https://github.com/wanderer-industries/wanderer/compare/v1.91.4...v1.91.5) (2025-12-30)
## [v1.91.4](https://github.com/wanderer-industries/wanderer/compare/v1.91.3...v1.91.4) (2025-12-30)
### Bug Fixes:
* core: fixed connections create between k-space systems (considered as wh connection)
## [v1.91.3](https://github.com/wanderer-industries/wanderer/compare/v1.91.2...v1.91.3) (2025-12-28)
## [v1.91.2](https://github.com/wanderer-industries/wanderer/compare/v1.91.1...v1.91.2) (2025-12-27)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

@@ -5,6 +5,7 @@ defmodule WandererApp.Map.Server.ConnectionsImpl do
alias WandererApp.Map.Server.Impl
alias WandererApp.Map.Server.SignaturesImpl
alias WandererApp.Map.Server.SystemsImpl
# @ccp1 -1
@c1 1
@@ -887,6 +888,44 @@ defmodule WandererApp.Map.Server.ConnectionsImpl do
end
end
@doc """
Check if a connection between two k-space systems is a wormhole connection.
Returns true if:
1. Both systems are k-space (not wormhole space)
2. There is no known stargate between them
This is used to detect wormhole connections through k-space, like when
a player jumps from low-sec to low-sec through a wormhole.
"""
def is_kspace_wormhole_connection?(from_solar_system_id, to_solar_system_id)
when is_nil(from_solar_system_id) or is_nil(to_solar_system_id),
do: false
def is_kspace_wormhole_connection?(from_solar_system_id, to_solar_system_id)
when from_solar_system_id == to_solar_system_id,
do: false
def is_kspace_wormhole_connection?(from_solar_system_id, to_solar_system_id) do
with {:ok, from_info} <- get_system_static_info(from_solar_system_id),
{:ok, to_info} <- get_system_static_info(to_solar_system_id) do
from_is_wormhole = from_info.system_class in @wh_space
to_is_wormhole = to_info.system_class in @wh_space
# Both must be k-space (not wormhole space)
if not from_is_wormhole and not to_is_wormhole do
# Check if there's a known stargate
case find_solar_system_jump(from_solar_system_id, to_solar_system_id) do
{:ok, []} -> true # No stargate = wormhole connection
_ -> false # Stargate exists or error
end
else
false
end
else
_ -> false
end
end
defp get_system_static_info(solar_system_id) do
case WandererApp.CachedInfo.get_system_static_info(solar_system_id) do
{:ok, system_static_info} when not is_nil(system_static_info) ->
@@ -920,6 +959,13 @@ defmodule WandererApp.Map.Server.ConnectionsImpl do
WandererApp.Cache.delete("map_#{map_id}:conn_#{connection.id}:start_time")
# Clear linked_sig_eve_id on target system when connection is deleted
# This ensures old signatures become orphaned and won't affect future connections
SystemsImpl.update_system_linked_sig_eve_id(map_id, %{
solar_system_id: location.solar_system_id,
linked_sig_eve_id: nil
})
_error ->
:ok
end

View File

@@ -170,16 +170,20 @@ defmodule WandererApp.Map.Server.SignaturesImpl do
end
defp remove_signature(map_id, sig, system, delete_conn?) do
# optionally remove the linked connection
if delete_conn? && sig.linked_system_id do
# Check if this signature is the active one for the target system
# This prevents deleting connections when old/orphan signatures are removed
is_active = sig.linked_system_id && is_active_signature_for_target?(map_id, sig)
# Only delete connection if this signature is the active one
if delete_conn? && is_active do
ConnectionsImpl.delete_connection(map_id, %{
solar_system_source_id: system.solar_system_id,
solar_system_target_id: sig.linked_system_id
})
end
# clear any linked_sig_eve_id on the target system
if sig.linked_system_id do
# Only clear linked_sig_eve_id if this signature is the active one
if is_active do
SystemsImpl.update_system_linked_sig_eve_id(map_id, %{
solar_system_id: sig.linked_system_id,
linked_sig_eve_id: nil
@@ -190,6 +194,16 @@ defmodule WandererApp.Map.Server.SignaturesImpl do
|> MapSystemSignature.destroy!()
end
defp is_active_signature_for_target?(map_id, sig) do
case MapSystem.read_by_map_and_solar_system(%{
map_id: map_id,
solar_system_id: sig.linked_system_id
}) do
{:ok, target_system} -> target_system.linked_sig_eve_id == sig.eve_id
_ -> false
end
end
def apply_update_signature(
map_id,
%MapSystemSignature{} = existing,

View File

@@ -547,9 +547,24 @@ defmodule WandererApp.Map.Server.SystemsImpl do
# If :wormholes scope is enabled AND old_location is a wormhole,
# allow this system to be added as a border system (so you can see
# where your wormhole exits to)
:wormholes in scopes and
not is_nil(old_location) and
ConnectionsImpl.can_add_location([:wormholes], old_location.solar_system_id)
wormhole_border_from_wh_space =
:wormholes in scopes and
not is_nil(old_location) and
ConnectionsImpl.can_add_location([:wormholes], old_location.solar_system_id)
# Third check: k-space wormhole connection
# If :wormholes scope is enabled AND there's no stargate between the systems,
# this is a wormhole connection through k-space - add both systems
kspace_wormhole_connection =
:wormholes in scopes and
not is_nil(old_location) and
not is_nil(old_location.solar_system_id) and
ConnectionsImpl.is_kspace_wormhole_connection?(
old_location.solar_system_id,
location.solar_system_id
)
wormhole_border_from_wh_space or kspace_wormhole_connection
end
end

View File

@@ -29,6 +29,34 @@
id="characters-list"
class="w-full h-full col-span-2 lg:col-span-1 p-4 pl-20 pb-20 overflow-auto"
>
<div class="flex items-center justify-between gap-4 px-4 py-2 mb-4 bg-stone-900/60 border border-stone-800 rounded">
<div class="flex items-center gap-3">
<.icon name="hero-gift-solid" class="w-4 h-4 text-green-400 flex-shrink-0" />
<span class="text-sm text-gray-300">
Support development by using promocode
<code class="ml-1 px-1.5 py-0.5 bg-stone-800 rounded text-green-400 text-xs font-mono">WANDERER</code>
<span class="ml-1">at official</span>
</span>
<a
href="https://store.eveonline.com/"
target="_blank"
rel="noopener noreferrer"
class="inline-flex items-center gap-1 text-sm text-green-400 hover:text-green-300 transition-colors"
>
<span>EVE Online Store</span>
<.icon name="hero-arrow-top-right-on-square-mini" class="w-3 h-3" />
</a>
</div>
<a
href="https://wanderer.ltd/news"
target="_blank"
rel="noopener noreferrer"
class="inline-flex items-center gap-1.5 px-3 py-1 text-sm text-white rounded bg-gradient-to-r from-stone-700 to-stone-600 hover:from-stone-600 hover:to-stone-500 transition-all duration-300 animate-pulse hover:animate-none"
>
<.icon name="hero-newspaper-solid" class="w-3.5 h-3.5" />
<span>Check Latest News</span>
</a>
</div>
<div
:if={@show_characters_add_alert}
role="alert"

View File

@@ -3,7 +3,7 @@ defmodule WandererApp.MixProject do
@source_url "https://github.com/wanderer-industries/wanderer"
@version "1.91.2"
@version "1.91.7"
def project do
[

View File

@@ -1,65 +0,0 @@
%{
title: "Event: Christmas Giveaway Challenge",
author: "Wanderer Team",
cover_image_uri: "/images/news/2025/12-18-advent-giveaway/cover.jpg",
tags: ~w(event giveaway challenge christmas advent partnership),
description: "Join our Advent Christmas Giveaway Challenge! Win exclusive partnership codes every day for a week. Be the fastest to claim your reward!"
}
---
![Christmas Giveaway Challenge](/images/news/2025/12-18-advent-giveaway/cover.jpg "Christmas Giveaway Challenge")
### Event Details
- **Event Name:** Advent Christmas Giveaway
- **Duration:** 1 week (7 days, 7 codes)
- **Event Link:** [Advent Christmas Giveaway](https://eventcortex.com/events/invite/cYdBywu1ygfVS3UN6ZZcmDzL1q85aDmH)
### The Season of Giving
This holiday season, we're spreading some festive cheer with a special event for our community: the **Advent Christmas Giveaway Challenge**!
---
### How It Works
1. **Daily Giveaway:**
- Every day during the event week, a partnership code will be revealed at a specific scheduled time.
- The exact reveal time will be announced for each day.
2. **The Challenge:**
- When the code is revealed, it becomes visible to **all participants** at the exact same moment.
- **First person to activate the code wins!**
- Speed and timing are everything.
3. **One Code Per Day:**
- Each day features a single partnership code.
- Miss today? Come back tomorrow for another chance!
---
### Tips for Participants
- **Be Ready:** Know the reveal time and be online a few minutes early.
- **Stay Alert:** The code appears for everyone simultaneously — every second counts!
- **Keep Trying:** Didn't win today? There's always tomorrow's code.
---
### Why Participate?
Partnership codes can be redeemed in EVE Online for **exclusive partnership SKINs** — unique ship skins that let you fly in style! This is your chance to grab one for free — if you're fast enough!
Good luck, and may the fastest capsuleer win!
---
Fly safe and happy holidays,
**The Wanderer Team**
---

View File

@@ -0,0 +1,53 @@
%{
title: "Event: Wanderer 2026 Roadmap Reveal",
author: "Wanderer Team",
cover_image_uri: "/images/news/2026/01-01-roadmap/cover.webp",
tags: ~w(event roadmap 2026 announcement community),
description: "JWanderer's 2026 roadmap are ready to reveal! Discover what exciting features and improvements are coming in 2026."
}
---
### Wanderer 2026 Roadmap Live Event
We're excited to announce that we're ready to share **Wanderer 2026 Roadmap**! Join to see the actual version with live updates for vision and plans.
---
### Event Details
- **Event Link:** [Wanderer 2026 Roadmap](https://eventcortex.com/events/invite/LcHQjTPb1jqHLzttlrgvUIb1RSBt7MFE)
- **You can always support development by join us on [Patreon](https://www.patreon.com/WandererLtd) to give feedback & increase priority for your feature requests in our special Discord channel available to our patrons only.**
---
### What to Expect
This year, we have ambitious plans to make Wanderer even better for the EVE Online community. Check event page for live updates on:
- **New Planned Features:** Exciting additions to enhance your mapping experience
- **Performance Improvements:** Faster, smoother, and more reliable
- **Community Requests:** Features you've been asking for
- **Integration Enhancements:** Better tools for corporations and alliances
- **API Expansions:** More power for developers and third-party tools
---
### Stay Connected
Join our community channels to stay updated:
- **[Discord](https://discord.gg/cafERvDD2k)**
- **[Telegram](https://t.me/wanderer_mapper)**
- **[Github](https://github.com/wanderer-industries)**
- **[YouTube](https://www.youtube.com/channel/UCalmteoec8rNXQugzZQcGnw?sub_confirmation=1)**
- **[Patreon](https://www.patreon.com/WandererLtd)**
---
We can't wait to share what's coming in 2026!
Fly safe,
**The Wanderer Team**
---

View File

@@ -0,0 +1,36 @@
%{
title: "Event: Weekly Giveaway Challenge",
author: "Wanderer Team",
cover_image_uri: "/images/news/2026/01-05-weekly-giveaway/cover.webp",
tags: ~w(event giveaway challenge),
description: "Join our Weekly Giveaway Challenge! Be the fastest to claim your reward!"
}
---
![Weekly Giveaway Challenge](/images/news/2026/01-05-weekly-giveaway/cover.webp "Weekly Giveaway Challenge")
### Event Details
In 2026, we're going to giveaway partnership SKIN codes for our community, every week!
- **Event Name:** Weekly Giveaway Challenge
- **Event Link:** [Join Weekly Giveaway Challenge](https://eventcortex.com/events/invite/Cjo87svZFq6J8cc1cubH4B7AR_VfPmQ4)
---
### Tips for Participants
- **Be Ready:** Know the reveal time and be online a few minutes early.
---
Good luck, and may the fastest capsuleer win!
---
Fly safe,
**Wanderer Team**
---

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

View File

@@ -49,6 +49,8 @@ defmodule WandererApp.Map.MapScopeFilteringTest do
setup do
# Setup system static info cache with both wormhole and k-space systems
setup_scope_test_systems()
# Setup known stargates between adjacent k-space systems
setup_kspace_stargates()
:ok
end
@@ -190,6 +192,30 @@ defmodule WandererApp.Map.MapScopeFilteringTest do
:ok
end
# Setup known stargates between adjacent k-space systems
# This ensures that k-space to k-space connections WITH stargates are properly filtered
# (connections WITHOUT stargates are treated as wormhole connections)
defp setup_kspace_stargates do
# Stargate between Halenan (HS) and Mili (HS) - adjacent high-sec systems
# Cache key format: "jump_#{smaller_id}_#{larger_id}"
halenan_mili_key = "jump_#{@hs_system_halenan}_#{@hs_system_mili}"
WandererApp.Cache.insert(halenan_mili_key, %{
from_solar_system_id: @hs_system_halenan,
to_solar_system_id: @hs_system_mili
})
# Stargate between Halenan (HS) and Halmah (LS) - adjacent high-sec to low-sec
halenan_halmah_key = "jump_#{@hs_system_halenan}_#{@ls_system_halmah}"
WandererApp.Cache.insert(halenan_halmah_key, %{
from_solar_system_id: @hs_system_halenan,
to_solar_system_id: @ls_system_halmah
})
:ok
end
describe "Scope filtering logic tests" do
# These tests verify the filtering logic without full integration
# The actual filtering is tested more comprehensively in map_scopes_test.exs

View File

@@ -56,8 +56,12 @@ defmodule WandererApp.Map.Server.MapScopesTest do
30_000_101 => %{solar_system_id: 30_000_101, system_class: @ls},
# Nullsec system
30_000_200 => %{solar_system_id: 30_000_200, system_class: @ns},
# Another nullsec for tests
30_000_201 => %{solar_system_id: 30_000_201, system_class: @ns},
# Pochven system
30_000_300 => %{solar_system_id: 30_000_300, system_class: @pochven},
# Another pochven for tests
30_000_301 => %{solar_system_id: 30_000_301, system_class: @pochven},
# Jita (prohibited system - highsec)
30_000_142 => %{solar_system_id: 30_000_142, system_class: @hs}
}
@@ -525,5 +529,84 @@ defmodule WandererApp.Map.Server.MapScopesTest do
assert result == true,
"Pochven to Hi-Sec with [:wormholes] should be valid when no stargate exists"
end
# Same-space-type wormhole connections
# These verify that jumps within the same security class are valid when no stargate exists
test "Low-Sec to Low-Sec with [:wormholes] is valid when no stargate exists" do
# A wormhole can connect two low-sec systems
# With [:wormholes] scope and no known stargate, this should be tracked
result = ConnectionsImpl.is_connection_valid([:wormholes], @ls_system_id, 30_000_101)
assert result == true,
"Low-Sec to Low-Sec with [:wormholes] should be valid when no stargate exists"
end
test "Hi-Sec to Hi-Sec with [:wormholes] is valid when no stargate exists" do
# A wormhole can connect two hi-sec systems
# With [:wormholes] scope and no known stargate, this should be tracked
result = ConnectionsImpl.is_connection_valid([:wormholes], @hs_system_id, 30_000_002)
assert result == true,
"Hi-Sec to Hi-Sec with [:wormholes] should be valid when no stargate exists"
end
test "Null-Sec to Null-Sec with [:wormholes] is valid when no stargate exists" do
# A wormhole can connect two null-sec systems
# With [:wormholes] scope and no known stargate, this should be tracked
result = ConnectionsImpl.is_connection_valid([:wormholes], @ns_system_id, 30_000_201)
assert result == true,
"Null-Sec to Null-Sec with [:wormholes] should be valid when no stargate exists"
end
test "Pochven to Pochven with [:wormholes] is valid when no stargate exists" do
# A wormhole can connect two Pochven systems
# With [:wormholes] scope and no known stargate, this should be tracked
result = ConnectionsImpl.is_connection_valid([:wormholes], @pochven_id, 30_000_301)
assert result == true,
"Pochven to Pochven with [:wormholes] should be valid when no stargate exists"
end
# Cross-space-type comprehensive tests
# Verify all k-space combinations work correctly
test "all k-space combinations with [:wormholes] are valid when no stargate exists" do
# Test all combinations of k-space security types
# All should be valid because no stargates exist in test data = wormhole connections
# Hi-Sec combinations
assert ConnectionsImpl.is_connection_valid([:wormholes], @hs_system_id, @ls_system_id) == true,
"Hi->Low should be valid"
assert ConnectionsImpl.is_connection_valid([:wormholes], @hs_system_id, @ns_system_id) == true,
"Hi->Null should be valid"
assert ConnectionsImpl.is_connection_valid([:wormholes], @hs_system_id, @pochven_id) == true,
"Hi->Pochven should be valid"
# Low-Sec combinations
assert ConnectionsImpl.is_connection_valid([:wormholes], @ls_system_id, @hs_system_id) == true,
"Low->Hi should be valid"
assert ConnectionsImpl.is_connection_valid([:wormholes], @ls_system_id, @ns_system_id) == true,
"Low->Null should be valid"
assert ConnectionsImpl.is_connection_valid([:wormholes], @ls_system_id, @pochven_id) == true,
"Low->Pochven should be valid"
# Null-Sec combinations
assert ConnectionsImpl.is_connection_valid([:wormholes], @ns_system_id, @hs_system_id) == true,
"Null->Hi should be valid"
assert ConnectionsImpl.is_connection_valid([:wormholes], @ns_system_id, @ls_system_id) == true,
"Null->Low should be valid"
assert ConnectionsImpl.is_connection_valid([:wormholes], @ns_system_id, @pochven_id) == true,
"Null->Pochven should be valid"
# Pochven combinations
assert ConnectionsImpl.is_connection_valid([:wormholes], @pochven_id, @hs_system_id) == true,
"Pochven->Hi should be valid"
assert ConnectionsImpl.is_connection_valid([:wormholes], @pochven_id, @ls_system_id) == true,
"Pochven->Low should be valid"
assert ConnectionsImpl.is_connection_valid([:wormholes], @pochven_id, @ns_system_id) == true,
"Pochven->Null should be valid"
end
end
end

View File

@@ -0,0 +1,213 @@
defmodule WandererApp.Map.Server.SignatureConnectionCascadeTest do
@moduledoc """
Tests for the signature-connection cascade behavior fix.
This test suite verifies that:
1. System's linked_sig_eve_id can be updated and cleared
2. The data model relationships work correctly
"""
use WandererApp.DataCase, async: false
import Mox
alias WandererApp.Api.MapSystem
alias WandererAppWeb.Factory
setup :verify_on_exit!
setup do
# Set up mocks in global mode for GenServer processes
Mox.set_mox_global()
# Setup DDRT mocks
Test.DDRTMock
|> stub(:init_tree, fn _name, _opts -> :ok end)
|> stub(:insert, fn _data, _tree_name -> {:ok, %{}} end)
|> stub(:update, fn _id, _data, _tree_name -> {:ok, %{}} end)
|> stub(:delete, fn _ids, _tree_name -> {:ok, %{}} end)
|> stub(:query, fn _bbox, _tree_name -> {:ok, []} end)
# Setup CachedInfo mocks for test systems
WandererApp.CachedInfo.Mock
|> stub(:get_system_static_info, fn
30_000_142 ->
{:ok,
%{
solar_system_id: 30_000_142,
solar_system_name: "Jita",
system_class: 7,
security: "0.9"
}}
30_000_143 ->
{:ok,
%{
solar_system_id: 30_000_143,
solar_system_name: "Perimeter",
system_class: 7,
security: "0.9"
}}
_ ->
{:error, :not_found}
end)
# Create test data using Factory
character = Factory.create_character()
map = Factory.create_map(%{owner_id: character.id})
%{map: map, character: character}
end
describe "linked_sig_eve_id management" do
test "system linked_sig_eve_id can be set and cleared", %{map: map} do
# Create a system without linked_sig_eve_id
{:ok, system} =
MapSystem.create(%{
map_id: map.id,
solar_system_id: 30_000_142,
name: "Jita"
})
# Initially nil
assert is_nil(system.linked_sig_eve_id)
# Update to a signature eve_id (simulating connection creation)
{:ok, updated_system} =
MapSystem.update_linked_sig_eve_id(system, %{linked_sig_eve_id: "SIG-123"})
assert updated_system.linked_sig_eve_id == "SIG-123"
# Clear it back to nil (simulating connection deletion - our fix)
{:ok, cleared_system} =
MapSystem.update_linked_sig_eve_id(updated_system, %{linked_sig_eve_id: nil})
assert is_nil(cleared_system.linked_sig_eve_id)
end
test "system can distinguish between different linked signatures", %{map: map} do
# Create system B (target) with linked_sig_eve_id = SIG-NEW
{:ok, system_b} =
MapSystem.create(%{
map_id: map.id,
solar_system_id: 30_000_143,
name: "Perimeter",
linked_sig_eve_id: "SIG-NEW"
})
# Verify the signature is correctly set
assert system_b.linked_sig_eve_id == "SIG-NEW"
# This verifies the logic: an old signature with eve_id="SIG-OLD"
# would NOT match system_b.linked_sig_eve_id
old_sig_eve_id = "SIG-OLD"
refute system_b.linked_sig_eve_id == old_sig_eve_id
# The new signature DOES match
new_sig_eve_id = "SIG-NEW"
assert system_b.linked_sig_eve_id == new_sig_eve_id
end
end
describe "is_active_signature_for_target? logic verification" do
@doc """
These tests verify the core logic of the fix:
- A signature is "active" only if target_system.linked_sig_eve_id == signature.eve_id
- If they don't match, the signature is "orphan" and should NOT cascade to connections
"""
test "active signature: linked_sig_eve_id matches signature eve_id", %{map: map} do
sig_eve_id = "ABC-123"
# System has linked_sig_eve_id pointing to our signature
{:ok, target_system} =
MapSystem.create(%{
map_id: map.id,
solar_system_id: 30_000_143,
name: "Perimeter",
linked_sig_eve_id: sig_eve_id
})
# This is what is_active_signature_for_target? checks
assert target_system.linked_sig_eve_id == sig_eve_id
end
test "orphan signature: linked_sig_eve_id points to different signature", %{map: map} do
# System has linked_sig_eve_id pointing to a NEWER signature
{:ok, target_system} =
MapSystem.create(%{
map_id: map.id,
solar_system_id: 30_000_143,
name: "Perimeter",
linked_sig_eve_id: "NEW-SIG-456"
})
# Old signature has different eve_id
old_sig_eve_id = "OLD-SIG-123"
# This would return false in is_active_signature_for_target?
refute target_system.linked_sig_eve_id == old_sig_eve_id
end
test "orphan signature: linked_sig_eve_id is nil", %{map: map} do
# System has nil linked_sig_eve_id (connection was already deleted)
{:ok, target_system} =
MapSystem.create(%{
map_id: map.id,
solar_system_id: 30_000_143,
name: "Perimeter"
})
assert is_nil(target_system.linked_sig_eve_id)
# Any signature would be orphan
old_sig_eve_id = "OLD-SIG-123"
refute target_system.linked_sig_eve_id == old_sig_eve_id
end
end
describe "scenario simulation" do
test "simulated scenario: re-entering WH after connection deleted", %{map: map} do
# This simulates the bug scenario:
# 1. User enters WH A → B, creates connection, signature SIG-OLD links B
# 2. Connection is deleted - linked_sig_eve_id should be cleared (our fix)
# 3. User re-enters, creates new connection, SIG-NEW links B
# 4. User deletes SIG-OLD - should NOT delete the new connection
# Step 1: Initial state - B has linked_sig_eve_id = SIG-OLD
{:ok, system_b} =
MapSystem.create(%{
map_id: map.id,
solar_system_id: 30_000_143,
name: "Perimeter",
linked_sig_eve_id: "SIG-OLD"
})
assert system_b.linked_sig_eve_id == "SIG-OLD"
# Step 2: Connection deleted - linked_sig_eve_id cleared (our fix in action)
{:ok, system_b_after_conn_delete} =
MapSystem.update_linked_sig_eve_id(system_b, %{linked_sig_eve_id: nil})
assert is_nil(system_b_after_conn_delete.linked_sig_eve_id)
# Step 3: New connection created - SIG-NEW links B
{:ok, system_b_after_new_conn} =
MapSystem.update_linked_sig_eve_id(system_b_after_conn_delete, %{
linked_sig_eve_id: "SIG-NEW"
})
assert system_b_after_new_conn.linked_sig_eve_id == "SIG-NEW"
# Step 4: Now when user tries to delete SIG-OLD:
# is_active_signature_for_target? would check:
# system_b.linked_sig_eve_id ("SIG-NEW") == old_sig.eve_id ("SIG-OLD")
# This returns FALSE, so connection deletion is SKIPPED
old_sig_eve_id = "SIG-OLD"
refute system_b_after_new_conn.linked_sig_eve_id == old_sig_eve_id
# The fix works!
end
end
end