No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
public/wanderer!77
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/75-76-loop-gen"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #75, fixes #76. Two loop-generator bugs found by the #73 browser acceptance run.
#75: Familiarity never finds the user's own trails
Root cause:
activityTracksNear(web/src/lib/stores/activity_tracks_store.ts) filtered the Meilisearchtrailsindex withauthor = "<user.id>". The index storesauthoras the ActivityPub actor id (documentFromTrailRecordindb/util/meilisearch.gowritesauthor.Idof the expandedactivitypub_actorsrecord), so the search always returned 0 hits and the familiarity/novelty bias was never applied.Fix: filter by
$currentUser.actor, the same way the other own-trail searches do (routes/lists/edit/[id]/+page.svelte,trail_dropdown.svelte,trail/edit/[id]/+page.ts). If the user has no actor id, return[]without querying. The "completed", "planned" and "both" sources share this author clause (they only addcompleted = true/false, which is a filterable index field), so all three are fixed.Tests: the store tests now set an actor id distinct from the user id, assert
author = "<actor>"for completed, planned and both, assert the user id is not in the filter, and add a no-actor case that does not call fetch.#76: Identical candidates listed twice
Root cause:
generateLoops(web/src/lib/routing/generator.ts) keeps one survivor per rotation and never compared survivors. With a must-visit point or a constrained network, several rotations snap to the same ways and come back as the same route.Fix: after the gates and the score sort,
dedupeCandidatesdrops any candidate thatisSameLoopmatches against a candidate already kept, so the best-scored copy survives and the order stays the same. Two loops are the same when:Resampling means long straight segments with few vertices still count by length. The overlap check ignores direction, so the same loop walked the other way round also counts as a duplicate, since it has the same distance and D+ and looks identical on the map. Routes without geometry are never treated as duplicates.
Tests:
isSameLoopcovers identical, resampled, reversed and near-identical routes (match), a mirrored loop with identical numbers and a distance/D+ outside the tolerance (no match), and empty geometry.dedupeCandidateskeeps the first copy and the order. TwogenerateLoopscases use a port where every rotation snaps to one loop (expect 1 candidate) or to two different loops (expect 2).Verification
vitest run(full web unit suite): 1275 passed, 13 skippednpm run check: 0 errors (the 2 warnings are already intrail/edit/[id]/+page.svelte)Not merged and no image built. Test it on the preview environment first.
🤖 Generated with Claude Code
https://claude.ai/code/session_01XMf4EGfBC9xbQ6rjD6HxgP