Loop generator: Familiarity never finds own trails (track search filters author by user id, index uses actor id) #75

Closed
opened 2026-11-06 11:34:04 +00:00 by maximus · 1 comment
Member

Found by the #73 browser acceptance run (2026-11-06, live https://wanderer.bearoverse.com, test user claude_test, source read from origin/deploy c48b528d).

Summary

The loop generator's Familiarity panel never finds the user's own trails, so "Prefer known trails" / "Prefer new trails" has no effect: the panel always says "No nearby trails found — familiarity bias not applied."

Cause: web/src/lib/stores/activity_tracks_store.ts (activityTracksNear) filters the Meilisearch trails index with author = "${user.id}", the user record id. The index stores author as the ActivityPub actor id ($currentUser.actor). Other callers already use the actor id, e.g. routes/lists/edit/[id]/+page.svelte (author = ${$currentUser?.actor}). The unit test only checks that the filter contains author = , so it misses this.

Repro

  1. Log in as a user who owns a trail starting near X. For claude_test this is "TEST Cap Ferrat coastal loop", planned (not completed), start 43.693486, 7.332852.
  2. New trail → Draw a route → Loop tab → set the start at X ("Use current location" / "Pick on map").
  3. Familiarity: "Prefer known trails", Strength 100 %, Track source "Planned trails" (or "Completed & planned").
  4. Generate loop.

Expected

POST /api/v1/search/trails returns the user's nearby trail, and the candidates show "N % on known trails" and are re-ranked.

Actual

The request filter is author = "rlbmwdc6h8c26hi" AND _geoRadius(43.693486, 7.332852, 1432) AND completed = false, where rlbmwdc6h8c26hi is claude_test's user id. It returns 0 hits, and the panel shows "No nearby trails found — familiarity bias not applied." The same query with the actor id ekcamvokwuhieug returns the trail (1 hit). "Completed & planned" also returns 0 hits.

Check of the rest of the feature: when the test rewrote the author to the actor id (test-side only, page.route), everything after the search worked. Candidates showed "6 % / 11 % on known trails", and switching "Prefer known" → "Prefer new" moved each score by 2 × 25 × strength × share (+3.0 and +5.7 vs +3.0 and +5.5 expected from the rounded shares). So the fix should only need the filter to use user.actor (plus a unit test that asserts the actor id).

Evidence

  • Screenshot: /root/tools/wanderer-shots/acceptance/out/t8c-familiarity-planned-stub-panel.png (BRouter was stubbed for this UI-only step, which is why it also shows "Couldn't generate a loop")
  • Results: /root/tools/wanderer-shots/acceptance/out/t8-live-2026-11-06.json (checks 8e, 8f)
  • Test: /root/tools/wanderer-shots/acceptance/t8_loop_panels.mjs

Refs #73.

🤖 Generated with Claude Code

Found by the #73 browser acceptance run (2026-11-06, live https://wanderer.bearoverse.com, test user `claude_test`, source read from `origin/deploy` c48b528d). ## Summary The loop generator's **Familiarity** panel never finds the user's own trails, so "Prefer known trails" / "Prefer new trails" has no effect: the panel always says "No nearby trails found — familiarity bias not applied." Cause: `web/src/lib/stores/activity_tracks_store.ts` (`activityTracksNear`) filters the Meilisearch `trails` index with `author = "${user.id}"`, the **user** record id. The index stores `author` as the **ActivityPub actor** id (`$currentUser.actor`). Other callers already use the actor id, e.g. `routes/lists/edit/[id]/+page.svelte` (`author = ${$currentUser?.actor}`). The unit test only checks that the filter contains `author = `, so it misses this. ## Repro 1. Log in as a user who owns a trail starting near X. For `claude_test` this is "TEST Cap Ferrat coastal loop", planned (not completed), start 43.693486, 7.332852. 2. New trail → Draw a route → **Loop** tab → set the start at X ("Use current location" / "Pick on map"). 3. Familiarity: "Prefer known trails", Strength 100 %, Track source "Planned trails" (or "Completed & planned"). 4. Generate loop. ## Expected `POST /api/v1/search/trails` returns the user's nearby trail, and the candidates show "N % on known trails" and are re-ranked. ## Actual The request filter is `author = "rlbmwdc6h8c26hi" AND _geoRadius(43.693486, 7.332852, 1432) AND completed = false`, where `rlbmwdc6h8c26hi` is claude_test's user id. It returns **0 hits**, and the panel shows "No nearby trails found — familiarity bias not applied." The same query with the actor id `ekcamvokwuhieug` returns the trail (1 hit). "Completed & planned" also returns 0 hits. Check of the rest of the feature: when the test rewrote the author to the actor id (test-side only, `page.route`), everything after the search worked. Candidates showed "6 % / 11 % on known trails", and switching "Prefer known" → "Prefer new" moved each score by 2 × 25 × strength × share (+3.0 and +5.7 vs +3.0 and +5.5 expected from the rounded shares). So the fix should only need the filter to use `user.actor` (plus a unit test that asserts the actor id). ## Evidence - Screenshot: `/root/tools/wanderer-shots/acceptance/out/t8c-familiarity-planned-stub-panel.png` (BRouter was stubbed for this UI-only step, which is why it also shows "Couldn't generate a loop") - Results: `/root/tools/wanderer-shots/acceptance/out/t8-live-2026-11-06.json` (checks 8e, 8f) - Test: `/root/tools/wanderer-shots/acceptance/t8_loop_panels.mjs` Refs #73. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Member

Fixed by #77 (Familiarity search filters by actor id). Live since 2026-11-06 14:2x (web deploy-e5a57df8, hf #924). Acceptance t8 on live: 8e finds own trails without the test-side workaround; 14/14 PASS. Tested on the preview first (#60).

🤖 Generated with Claude Code

Fixed by #77 (Familiarity search filters by actor id). Live since 2026-11-06 14:2x (web deploy-e5a57df8, hf #924). Acceptance t8 on live: 8e finds own trails without the test-side workaround; 14/14 PASS. Tested on the preview first (#60). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
public/wanderer#75
No description provided.