78 Commits
Author SHA1 Message Date
Guarzo af2a265c71 fix(tracker): characters stop moving on the map after a browser disconnect
maybe_start_location_tracking/2 matched %{track_location: true} in the
track_settings argument. No caller passes that key -- all five call sites
send %{map_id: _, track: true | false} -- so the clause never matched and
the function could not turn location tracking on. maybe_start_ship_tracking/2
had the identical defect.

Match on the state's active_maps instead: a character on at least one map
should be polling their location.

Without this, a character is stranded by an event they never initiated. When
a browser's presence lapses past the grace period the character is untracked
server-side, active_maps empties, and maybe_stop_tracking/2 clears
track_location. The character is still online in EVE throughout, and the only
other writer -- update_online/1 -- is gated on an online-status transition
that a character who stays logged in never produces. So the browser
reconnecting cannot restore it. update_location/1 then falls through to its
catch-all on every tick, and the character stops moving on the map while
every liveness signal keeps reporting healthy.

This is why #620 reports that toggling tracking off and on does not help but
relogging in EVE does: toggling routes through the dead clause, while
relogging produces the online transition that restores the flag as a side
effect.

Fixes #620
2026-08-11 19:56:05 +00:00
Guarzo a3777b390a fix(test): address upstream review findings
- correct the Jita/Hek comment to match the systems the tests actually use
- document the sandbox contract on IntegrationCase and make shared mode an
  explicit opt-in that is reverted on exit
- drop the blanket rescue around Sandbox.allow/4: it returns
  {:already, :owner | :allowed} rather than raising, so the rescue only
  masked genuine infrastructure faults
- use Cache.insert/3 and document the :online option
2026-08-08 16:56:57 -04:00
GuarzoandClaude Opus 5 33acc374b4 fix(map): match Ash-wrapped NotFound in MapRepo.get/2
Review of the previous commit found that Ash returns NotFound wrapped
inside Ash.Error.Invalid, not as a bare struct. Verified against a live
query: `Api.Map.by_id(<missing uuid>)` returns

    {:error, %Ash.Error.Invalid{errors: [%Ash.Error.Query.NotFound{}]}}

so the bare-NotFound clause never matched. A genuinely missing map would
have propagated as a generic error and logged a spurious error line.

Match the wrapped shape as well. Confirmed `MapRepo.get/2` now returns
{:error, :not_found} for a missing map with no error log. No caller
depends on the :not_found atom specifically (all use wildcard or
with/else), so propagation of real faults is unaffected.

Also make track_character_on_map/2 clear stale per-map location caches,
mirroring TrackingUtils.track_character/4, which the helper claimed to
mirror but did not.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 19:29:25 +00:00
GuarzoandClaude Opus 5 887769402b test(map): fix 8 failing character location tracking tests
Four independent causes, each confirmed by instrumentation rather than
inference.

1. Sandbox access. MapPool GenServers are spawned dynamically and load
   map state from the DB during init (six Task.async loaders in
   do_init_state/1). IntegrationCase's one-shot supervision-tree grant
   runs before any pool exists, and its polling monitor granted only
   mock ownership, never Ecto sandbox access -- and would lose the race
   regardless. Every loader died with DBConnection.OwnershipError.

   Fixed with an opt-in @moduletag :shared_sandbox. Shared mode is the
   only mechanism covering a process that queries immediately upon
   spawn. It is opt-in rather than a global flip because Ecto shared
   mode is node-global, and it is now reverted to :manual on exit --
   not reverting is why an earlier global-flip attempt broke
   CommonAPIControllerTest.

2. Characters were never tracked. update_characters/1 iterates
   get_tracked_character_ids/1, which needs the character in
   map.characters AND a tracking_start_time cache key. The tests set
   only presence_character_ids, which that path never reads, so the
   tracked list was empty and the whole body was a no-op. Added
   track_character_on_map/2.

3. Characters were offline. With online: false the :character_online
   handler deletes the solar_system_id cache key that
   check_location_update just wrote, so no movement was ever observed.

4. Map scopes. get_effective_scopes/1 prefers the scopes array over
   scope, and scopes defaults to [:wormholes]. The tests set only
   scope: :all, so hi-sec movement was rejected as an invalid
   connection.

Separately, these tests asserted that Jita is added to the map. Jita is
hardcoded in @prohibited_systems and can never be added, so those
assertions could never pass. Rather than weaken them, the start system
is now Hek (not prohibited), which preserves each test's intent, and a
new regression test pins the Jita prohibition itself.

Verified by set-diff against merge-base b7ddbc48 at full-suite scope
(two runs each, counts are unstable so sets were compared): zero new
failures, all 9 target failures fixed. Suite is 15 tests, 0 failures
across seeds 0, 1 and 42, with no OwnershipError and no map-start
timeout remaining.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-01 19:03:01 +00:00
Guarzo 5349b5088c fix: authorize client-supplied IDs in LiveView handlers (IDOR audit)
LiveView event handlers were trusting client-supplied record IDs without
verifying they belong to the user's current map/user scope. A logged-in
user could push another map's record UUID over the LV socket and act on
it. Affected handlers:

- cancel-subscription / edit-subscription / update_subscription
  (cancel or upgrade any map's paid subscription by ID)
- characters_live.ex "delete"
  (soft-delete any user's character and null their user_id)
- cancel_ping
  (cross-map rally-ping cancellation broadcast)
- deleteSystemComment
  (cross-map comment deletion)
- update_passage_mass
  (cross-map wormhole passage mass corruption)
- updateCharacterTracking
  (untrack another user's character on a shared map)

Also fixes a related numeric-trust bug in subscribe/update_subscription
where `period`, `characters_limit`, and `hubs_limit` were parsed without
bounds, allowing `period: "-1"` to produce a back-dated subscription
with a negative price.

Adds WandererAppWeb.HandlerAuth with focused helpers each handler now
routes through, plus 26 regression tests covering both the IDOR auth
checks and the bounded-int parsers.
2026-06-10 14:31:56 +00:00
starkythefox 36c1c7ce21 test: reword k162Type to match actual code 2026-04-18 15:14:35 +02:00
Dmitry Popov 0032b56d09 fix(signatures): Back linked signatures not cleared old connection statuses 2026-04-10 23:57:40 +02:00
Dmitry Popov 74e8f45265 feat(core): added character profile pages support 2026-04-07 00:38:24 +02:00
Guarzo 40d0a0777a fix: adding system when linked signature is provided 2026-01-27 03:10:33 +00:00
Guarzo 2f38da52e8 fix: api fixes and format 2026-01-16 08:39:19 +00:00
Dmitry Popov 8c911f89e0 fix(core): fixed new connections got deleted after linked signature cleanup 2026-01-05 00:48:38 +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
Dmitry Popov b4ef9ae983 fix(core): fixed map scopes updates & logic 2025-12-27 23:10:26 +01:00
Dmitry Popov 8f671a359b fix(core): fixed permissions update after character corp updates 2025-12-19 10:37:59 +01:00
Dmitry Popov d6bfaf8008 chore: added promo codes support for map subs 2025-12-18 22:19:26 +01:00
Dmitry Popov cba050a9e7 fix(core): fixed scopes 2025-12-15 01:35:41 +01:00
Dmitry Popov 71ae326cf7 fix(core): fixed map scopes 2025-12-12 19:48:26 +01:00
Dmitry Popov 9f6849209b fix(core): fixed map scopes 2025-12-12 19:35:26 +01:00
Dmitry Popov 3877e121c3 fix(core): fixed map scopes & signatures clean up behaviour 2025-12-12 18:07:18 +01:00
Dmitry Popov 051e71f1a6 Merge pull request #566 from guarzo/guarzo/sigapi
Build Test / 🚀 Deploy to test env (fly.io) (push) Has been cancelled
Build Test / 🛠 Build (1.17, 18.x, 27) (push) Has been cancelled
Build Develop / 🛠 Build (1.17, 18.x, 27) (push) Has been cancelled
Build Develop / 🛠 Build Docker Images (linux/amd64) (push) Has been cancelled
Build Develop / 🛠 Build Docker Images (linux/arm64) (push) Has been cancelled
Build Develop / merge (push) Has been cancelled
Build Develop / 🏷 Notify about develop release (push) Has been cancelled
🧪 Test Suite / Test Suite (push) Has been cancelled
fix: apiV1 default fields updates
2025-12-03 00:20:13 +04:00
Guarzo 20a50e8db0 fix: apiV1 default fields updates 2025-12-02 17:55:05 +00:00
Dmitry Popov 2b07af5e12 Merge branch 'main' into develop
Build Test / 🚀 Deploy to test env (fly.io) (push) Has been cancelled
Build Test / 🛠 Build (1.17, 18.x, 27) (push) Has been cancelled
Build Develop / 🛠 Build (1.17, 18.x, 27) (push) Has been cancelled
Build Develop / 🛠 Build Docker Images (linux/amd64) (push) Has been cancelled
Build Develop / 🛠 Build Docker Images (linux/arm64) (push) Has been cancelled
Build Develop / merge (push) Has been cancelled
Build Develop / 🏷 Notify about develop release (push) Has been cancelled
🧪 Test Suite / Test Suite (push) Has been cancelled
2025-12-02 13:45:57 +01:00
Dmitry Popov ee85d29c54 chore: added tests 2025-12-02 13:45:47 +01:00
Dmitry Popov fa32c62f63 Merge branch 'main' into develop
Build Test / 🚀 Deploy to test env (fly.io) (push) Has been cancelled
Build Test / 🛠 Build (1.17, 18.x, 27) (push) Has been cancelled
Build Develop / 🛠 Build (1.17, 18.x, 27) (push) Has been cancelled
🧪 Test Suite / Test Suite (push) Has been cancelled
Build Develop / 🛠 Build Docker Images (linux/amd64) (push) Has been cancelled
Build Develop / 🛠 Build Docker Images (linux/arm64) (push) Has been cancelled
Build Develop / merge (push) Has been cancelled
Build Develop / 🏷 Notify about develop release (push) Has been cancelled
2025-11-30 23:25:48 +01:00
Dmitry Popov 5289893264 fix(core): fixed tracking issues 2025-11-30 23:25:37 +01:00
Dmitry Popov f50ea40b15 chore: updated tests for tracking 2025-11-30 19:06:15 +01:00
Dmitry Popov c3de3c4e35 Merge branch 'main' into develop
Build Test / 🚀 Deploy to test env (fly.io) (push) Has been cancelled
Build Test / 🛠 Build (1.17, 18.x, 27) (push) Has been cancelled
Build Develop / 🛠 Build (1.17, 18.x, 27) (push) Has been cancelled
🧪 Test Suite / Test Suite (push) Has been cancelled
Build Develop / 🛠 Build Docker Images (linux/amd64) (push) Has been cancelled
Build Develop / 🛠 Build Docker Images (linux/arm64) (push) Has been cancelled
Build Develop / merge (push) Has been cancelled
Build Develop / 🏷 Notify about develop release (push) Has been cancelled
2025-11-29 20:17:14 +01:00
Dmitry Popov 85c075c5a6 fix(core): fixed tracking issues 2025-11-29 20:12:54 +01:00
Dmitry Popov 4585c3a94b feat(core): Added several map scopes support (Wh, Hi, Low, Null, Pochven) 2025-11-29 14:36:45 +01:00
Dmitry Popov e7219e0eec chore: fixed compile warnings 2025-11-29 12:34:28 +01:00
Dmitry Popov d0874cbc6f fix(core): fixed tracking issues 2025-11-29 00:43:13 +01:00
Dmitry Popov 5766fcf4d8 fix(core): fixed tracking issues 2025-11-28 23:49:48 +01:00
Dmitry Popov 9e9dc39200 Merge pull request #556 from guarzo/guarzo/ticker2andsse
Build Test / 🚀 Deploy to test env (fly.io) (push) Has been cancelled
Build Test / 🛠 Build (1.17, 18.x, 27) (push) Has been cancelled
Build Develop / 🛠 Build (1.17, 18.x, 27) (push) Has been cancelled
Build Develop / 🛠 Build Docker Images (linux/amd64) (push) Has been cancelled
Build Develop / 🛠 Build Docker Images (linux/arm64) (push) Has been cancelled
Build Develop / merge (push) Has been cancelled
Build Develop / 🏷 Notify about develop release (push) Has been cancelled
🧪 Test Suite / Test Suite (push) Has been cancelled
fix: sse enable checkbox, and kills ticker
2025-11-25 15:33:05 +04:00
Dmitry Popov abd7e4e15c chore: fix tests issues 2025-11-25 12:28:31 +01:00
Dmitry Popov 01e291daf4 chore: fix tests issues 2025-11-24 23:57:52 +01:00
Dmitry Popov a872561b18 chore: fix tests issues 2025-11-24 11:33:08 +01:00
Dmitry Popov 857608f8ef chore: fix tests issues 2025-11-23 22:43:59 +01:00
Guarzo 7a74ae566b fix: sse enable checkbox, and kills ticker 2025-11-23 18:04:30 +00:00
Dmitry Popov f2c8724763 Merge branch 'tests-fixes' into develop
Build Test / 🚀 Deploy to test env (fly.io) (push) Has been cancelled
Build Test / 🛠 Build (1.17, 18.x, 27) (push) Has been cancelled
Build Develop / 🛠 Build (1.17, 18.x, 27) (push) Has been cancelled
🧪 Test Suite / Test Suite (push) Has been cancelled
Build Develop / 🛠 Build Docker Images (linux/amd64) (push) Has been cancelled
Build Develop / 🛠 Build Docker Images (linux/arm64) (push) Has been cancelled
Build Develop / merge (push) Has been cancelled
Build Develop / 🏷 Notify about develop release (push) Has been cancelled
2025-11-22 12:35:19 +01:00
Dmitry Popov 9a8dc4dbe5 Merge branch 'main' into tests-fixes 2025-11-22 12:29:22 +01:00
Dmitry Popov c175f19142 Merge branch 'main' into develop 2025-11-20 11:35:38 +01:00
Dmitry Popov aac2c33fd2 fix(auth): fixed character auth issues 2025-11-19 22:05:49 +01:00
guarzo f4d28f282a Merge branch 'develop' into guarzo/minorfixes 2025-11-19 11:03:43 -05:00
Dmitry Popov 1fe8ef17bd Merge branch 'main' into develop
Build Test / 🚀 Deploy to test env (fly.io) (push) Has been cancelled
Build Test / 🛠 Build (1.17, 18.x, 27) (push) Has been cancelled
Build / 🛠 Build (1.17, 18.x, 27) (push) Has been cancelled
Build / 🛠 Build Docker Images (linux/amd64) (push) Has been cancelled
Build / 🛠 Build Docker Images (linux/arm64) (push) Has been cancelled
Build / merge (push) Has been cancelled
Build / 🏷 Create Release (push) Has been cancelled
🧪 Test Suite / Test Suite (push) Has been cancelled
2025-11-19 11:35:45 +01:00
Dmitry Popov 543ec7f071 fix: fixed duplicated map slugs 2025-11-19 11:32:35 +01:00
Guarzo 5764c41d23 pr feedback 2025-11-18 20:46:06 +00:00
Guarzo 09444596ff fix: apiv1 token auth and structure fixes 2025-11-18 20:10:06 +00:00
Dmitry Popov 5e0965ead4 fix(tests): updated tests 2025-11-17 12:52:11 +01:00
Dmitry Popov 712379f4bb Merge branch 'main' into develop
Build Test / 🚀 Deploy to test env (fly.io) (push) Has been cancelled
Build Test / 🛠 Build (1.17, 18.x, 27) (push) Has been cancelled
Build / 🛠 Build (1.17, 18.x, 27) (push) Has been cancelled
🧪 Test Suite / Test Suite (push) Has been cancelled
Build / 🛠 Build Docker Images (linux/amd64) (push) Has been cancelled
Build / 🛠 Build Docker Images (linux/arm64) (push) Has been cancelled
Build / merge (push) Has been cancelled
Build / 🏷 Create Release (push) Has been cancelled
2025-11-17 00:09:27 +01:00
Dmitry Popov 4c39c6fb39 fix(tests): updated tests 2025-11-17 00:09:10 +01:00