chore: merge main into deploy (importer clamp, upstream-sync, CI cache, route-editor tests) #55

Closed
maximus wants to merge 0 commits from chore/sync-main-deploy into deploy
Member

Merges main (0d56e4dc) into deploy (e72a2cc5). Afterwards main has no commits that deploy lacks. Do not squash or rebase: the merge commit is what keeps the next main → deploy merge small.

Branch model (inferred from history, upstream-sync.yml and the cut-over notes)

upstream open-wanderer/main (releases only)
        │  weekly upstream-sync PR (#38) → main
        ▼
main    = upstream release + fork CI (.forgejo/) + work meant for upstream
          (importer clamp #37, route-editor fixes / smart insertion #17, CI cache #46)
        │  merge main → deploy on a branch (this PR; upstream-sync.yml says the same)
        ▼
deploy  = main + live-only fork features: planner/loop generator, BRouter + routing port,
          trail-analyze proxy, heatmap, image.yml. The image is built from here, then pinned in homelab-flux.
  • Changes flow main → deploy only. deploy is never merged back into main, because it carries features that should not go upstream.
  • Work that should go upstream branches off main and merges into main. A fork-only feature branches off deploy.
  • If a generic fix lands on deploy first (as #48 did), cherry-pick it onto a branch off main when it should go upstream. Deploy then gets it back on the next sync as an equivalent patch.

At the time of this PR, main was 20 commits ahead of deploy: #37 importer clamp, #38 upstream-sync workflow, the feat/smart-insertion merge 402280d6, the valhalla-store tests f9f8cbf9, and the CI cache 0d56e4dc (#46). deploy was 124 ahead of main, which is expected.

Conflict resolution

Seven files conflicted: the trail editor +page.svelte, valhalla_store.svelte.ts, route_insertion{,.test}.ts, and the de/en/fr locales. All of them were resolved to deploy's side:

  • deploy already has the smart-insertion chain (cfeb45dc..ab00270a, patch-equivalent to main's 6c469f72..6ee8ceb6). It has since moved on with #44 (f9668d34: shortest-path insert by default, one undo step per action via recordUserAction), ba0a249a (loop close near the first anchor) and per-segment routing modes. On every conflicted hunk, main's version is an older state of the same code.
  • main's i18n keys append-to-end / insert-at-nearest / insert-modifier-hint are not used on deploy. It uses append-only-mode / shortest-path-mode / mode-modifier-hint.

Everything else merged cleanly and comes in unchanged from main: .forgejo/workflows/{ci,upstream-sync}.yml, .forgejo/scripts/upstream-sync-dry-run.sh, db/plugins/importer/*, and web/src/lib/stores/valhalla_store_insert.test.ts.

The follow-up commit 66f7511a removes web/tests/playwright/e2e/trail/route-insertion.spec.ts, which came in from main. It tests main's UI (append by default, an "Adding to end of route" toggle, Alt/⌘ to insert once). deploy inverted that behaviour, so most of its cases would fail against deploy. The Playwright suite is not part of CI and needs the full stack, so I could not adapt and run it here. Follow-up: port the spec to deploy's semantics.

Verification (spl-vm05, on the merge result)

  • npm run check (svelte-check): 0 errors, 2 warnings. Both are pre-existing a11y warnings on <tbody> in the trail editor.
  • vitest --run: 840 passed, 13 skipped, 72 files. That includes main's valhalla_store_insert.test.ts running against deploy's store, and deploy's valhalla_undo.test.ts.
    • There was one unhandled rejection, ReadableStream is already closed, from src/lib/server/trail_analyze.test.ts. That file and everything under src/lib/server are byte-identical to deploy, and all 63 of its tests pass. I ran it on Node 24; CI uses node:20, so this is probably Node/undici-version noise. CI will show whether it matters.
  • db/ changed (importer from #37), so I ran gofmt -l, go vet ./plugins/importer/ and go test with CGO_ENABLED=0, because the VM has no gcc. gofmt and vet are clean. pocketbase/plugins/importer and pocketbase/tests/importer pass. I stopped the full ./... run after about 6 minutes because the shared VM's load went above budget, so CI's go test is the full check. deploy has no other db/ changes since the merge base, so the importer is the only Go code that is new to deploy.

Not in this PR

  • Nothing moves from deploy to main (see the model above). deploy has a few generic fixes that would suit upstream: f55a19e4 local fallback avatars, 3d4af533 4xx for an unknown trail id, aed6bfbc map style warning, and e72a2cc5 label for/id (all #48). Cherry-pick them onto a branch off main if they should go upstream.
  • Branch cleanup is being prepared separately as a script for review. Nothing has been deleted.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XMf4EGfBC9xbQ6rjD6HxgP

Merges `main` (0d56e4dc) into `deploy` (e72a2cc5). Afterwards main has no commits that deploy lacks. **Do not squash or rebase**: the merge commit is what keeps the next `main → deploy` merge small. ## Branch model (inferred from history, `upstream-sync.yml` and the cut-over notes) ``` upstream open-wanderer/main (releases only) │ weekly upstream-sync PR (#38) → main ▼ main = upstream release + fork CI (.forgejo/) + work meant for upstream (importer clamp #37, route-editor fixes / smart insertion #17, CI cache #46) │ merge main → deploy on a branch (this PR; upstream-sync.yml says the same) ▼ deploy = main + live-only fork features: planner/loop generator, BRouter + routing port, trail-analyze proxy, heatmap, image.yml. The image is built from here, then pinned in homelab-flux. ``` - Changes flow **main → deploy only**. deploy is never merged back into main, because it carries features that should not go upstream. - Work that should go upstream branches off `main` and merges into main. A fork-only feature branches off `deploy`. - If a generic fix lands on deploy first (as #48 did), cherry-pick it onto a branch off `main` when it should go upstream. Deploy then gets it back on the next sync as an equivalent patch. At the time of this PR, main was 20 commits ahead of deploy: #37 importer clamp, #38 upstream-sync workflow, the `feat/smart-insertion` merge 402280d6, the valhalla-store tests f9f8cbf9, and the CI cache 0d56e4dc (#46). deploy was 124 ahead of main, which is expected. ## Conflict resolution Seven files conflicted: the trail editor `+page.svelte`, `valhalla_store.svelte.ts`, `route_insertion{,.test}.ts`, and the `de`/`en`/`fr` locales. **All of them were resolved to deploy's side**: - deploy already has the smart-insertion chain (cfeb45dc..ab00270a, patch-equivalent to main's 6c469f72..6ee8ceb6). It has since moved on with #44 (f9668d34: shortest-path insert by default, one undo step per action via `recordUserAction`), ba0a249a (loop close near the first anchor) and per-segment routing modes. On every conflicted hunk, main's version is an older state of the same code. - main's i18n keys `append-to-end` / `insert-at-nearest` / `insert-modifier-hint` are not used on deploy. It uses `append-only-mode` / `shortest-path-mode` / `mode-modifier-hint`. Everything else merged cleanly and comes in unchanged from main: `.forgejo/workflows/{ci,upstream-sync}.yml`, `.forgejo/scripts/upstream-sync-dry-run.sh`, `db/plugins/importer/*`, and `web/src/lib/stores/valhalla_store_insert.test.ts`. The follow-up commit 66f7511a removes `web/tests/playwright/e2e/trail/route-insertion.spec.ts`, which came in from main. It tests main's UI (append by default, an "Adding to end of route" toggle, Alt/⌘ to insert once). deploy inverted that behaviour, so most of its cases would fail against deploy. The Playwright suite is not part of CI and needs the full stack, so I could not adapt and run it here. **Follow-up:** port the spec to deploy's semantics. ## Verification (spl-vm05, on the merge result) - `npm run check` (svelte-check): **0 errors**, 2 warnings. Both are pre-existing a11y warnings on `<tbody>` in the trail editor. - `vitest --run`: **840 passed, 13 skipped, 72 files**. That includes main's `valhalla_store_insert.test.ts` running against deploy's store, and deploy's `valhalla_undo.test.ts`. - There was one unhandled rejection, `ReadableStream is already closed`, from `src/lib/server/trail_analyze.test.ts`. That file and everything under `src/lib/server` are byte-identical to deploy, and all 63 of its tests pass. I ran it on Node 24; CI uses `node:20`, so this is probably Node/undici-version noise. CI will show whether it matters. - `db/` changed (importer from #37), so I ran `gofmt -l`, `go vet ./plugins/importer/` and `go test` with `CGO_ENABLED=0`, because the VM has no gcc. gofmt and vet are clean. `pocketbase/plugins/importer` and `pocketbase/tests/importer` pass. I stopped the full `./...` run after about 6 minutes because the shared VM's load went above budget, so CI's `go test` is the full check. deploy has no other `db/` changes since the merge base, so the importer is the only Go code that is new to deploy. ## Not in this PR - Nothing moves from deploy to main (see the model above). deploy has a few generic fixes that would suit upstream: f55a19e4 local fallback avatars, 3d4af533 4xx for an unknown trail id, aed6bfbc map style warning, and e72a2cc5 label for/id (all #48). Cherry-pick them onto a branch off main if they should go upstream. - Branch cleanup is being prepared separately as a script for review. Nothing has been deleted. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01XMf4EGfBC9xbQ6rjD6HxgP
Adds chooseInsertionIndex(anchors, point): scores prepend / each interior
gap / append by route-length increase and returns the least-detour anchor
index, so a clicked point that belongs mid-route is inserted there instead
of always appended. Pure + unit-tested (8 vitest cases); reuses
haversineDistance. Wiring into the map click handler follows separately.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Wire chooseInsertionIndex into the route editor's map-click handler so a
clicked point is placed where it grows total route length the least: a
point that belongs mid-route is inserted between its neighbouring anchors
(re-routing both halves, mirroring the segment-drag path) instead of always
being appended. Points that extend the route still append; k=0 prepends.

Also fixes insertIntoRoute() to splice at index 0 — the `if (index)` guard
treated 0 as falsy and appended; prepend relies on splicing at 0. No
existing caller passes 0.

svelte-check clean (0 errors); route_insertion unit tests green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
- removeAnchor: clear the track when <2 anchors remain (was leaving a
  dangling segment / stale route line); drop the gpx_data gate that skipped
  the map refresh while drawing; rebuild via setRoute when removing the end
  anchor so the last segment can't dangle.
- Tag anchorsBefore/anchorsAfter on add actions so undo/redo restores the
  anchor list instead of rebuilding from the emptied route (fixes: add two
  points then undo removes both).
- addAnchorSmart: mid-insert uses a single insertAnchorSplit change so undo
  reverts the whole insertion in one step; prepend routes new->start.
- deleteFromRoute: compute totals from the reduced snapshot, not the
  pre-delete route.

svelte-check clean; unit tests green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
- applyAnchorSnapshot(): on undo/redo, remove markers for anchors no longer
  present and (re-)add markers for restored ones. Fixes: the added point's
  marker stayed on the map after undo even though it left the anchor list.
- Placing the first anchor now records an anchor-only undo entry
  (pushAnchorOnlyChange) so it is undoable (undo was greyed / a no-op).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
feat(route-editor): append by default, opt-in smart insert (toggle + Alt/⌘-click)
Some checks failed
CI / go (push) Has been cancelled
CI / web (push) Has been cancelled
6ee8ceb695
Always-on min-detour insertion misfired when planning loops (a click meant
to extend the route landed near an early segment and got inserted
mid-route). Now a plain click appends to the end; smart insert-at-nearest
is opt-in via an 'Insert' toggle in the drawing panel or by holding Alt/⌘
while clicking. i18n en/fr/de.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
A GPX waypoint whose description exceeds the waypoints collection's 5000
character limit made createWaypoints' app.Save return a validation error,
aborting the ENTIRE trail import — the track and every other waypoint were
lost, not just the one over-long POI. komoot highlight/POI descriptions
routinely run 5-6.5k characters, so bulk GPX imports of multi-day routes
failed outright (oss/wanderer #15).

Clamp the description to the collection's own description-field limit (rune-
safe, with an ellipsis) before saving, mirroring how photoFiles already skips
individual bad media rather than failing the whole trail.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Generalizes the #15 guard. The importer also wrote the trail name/description
and the waypoint name unclamped, so an over-long value in any of them aborted
the whole import the same way (confirmed for waypoint name:
'name: Must be no more than 255 character(s)').

Add clampTextField(collection, field, value), which clamps to that field's own
rune limit (no-op for unbounded/non-text fields), and apply it to every
external text field createWaypoints and ImportTrail write.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
refactor(importer): leave rich-text descriptions to the bounded sanitizer
Some checks failed
CI / go (push) Has been cancelled
CI / web (push) Has been cancelled
d45b7875e9
Upstream v0.21.1 (#1320) runs util.SanitizeHTMLFieldsWithLimits on every
imported trail and waypoint, which already shortens descriptions to the
field limit in an HTML-aware way. Clamping the raw HTML first could cut a
tag in half, so only the plain-text name fields are clamped now. The
description test stays as a regression guard for #15.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01M1AaXnEghenJ4BDxNryKvs
Adds .forgejo/workflows/upstream-sync.yml: a weekly (and manually dispatchable)
job that checks whether upstream's default branch has commits the fork's base
branch is missing and, if so, pushes a dated branch and opens a sync PR into
main. Merging is left to a human via the PR so Forgejo surfaces any conflicts.

Kept in .forgejo/ (not .github/) so it does not diverge the workflows shared
with upstream and does not run on the upstream GitHub repo.

Closes #8.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
ci(forgejo): make upstream-sync run on our runner and never clobber branches
Some checks failed
CI / go (push) Has been cancelled
CI / web (push) Has been cancelled
5d4c9bcc2f
- runs-on: docker + checkout@v4 + apt-installed git/jq/curl (no sudo), the
  same setup as ci.yml on the NAS forgejo-runner v12.
- The sync branch is now the base branch plus a merge of upstream, so it
  keeps .forgejo/ (our CI runs on it, not upstream's release workflows) and
  the PR fast-forwards main. On a conflict it falls back to the raw upstream
  commit so the PR shows the conflict.
- Only ever pushes a new refs/heads/upstream-sync/<date> ref, without
  --force; an existing sync branch is left untouched.
- workflow_dispatch dry_run input; PR title names the upstream release tag;
  optional SYNC_TOKEN secret; token passed via a header file, not argv.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01M1AaXnEghenJ4BDxNryKvs
CI runs on a capacity-1 runner on the NAS and only had a push trigger.
Pushes made with the automatic Actions token (the upstream-sync branch)
do not start workflows, and CI often has to wait for a quiet window, so
add workflow_dispatch to run it on any branch on demand.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01M1AaXnEghenJ4BDxNryKvs
ci(forgejo): move upstream sync to Sunday 03:10 UTC, add a local dry run
All checks were successful
CI / go (push) Successful in 26m37s
CI / web (push) Successful in 2m7s
96295b75c5
- Schedule: Sunday 03:10 UTC instead of Monday 04:17, which collided
  with mail-archive-gmail (04:17) and sat next to Renovate (04:30) and
  the 03:30-04:30 backup jobs on the NAS that also hosts the runner.
- Document the token model: the branch push uses the automatic token
  (so it does not start CI at night); SYNC_TOKEN is optional and only
  for the PR API call if the automatic token is refused.
- Add .forgejo/scripts/upstream-sync-dry-run.sh: shows the behind count,
  the branch and PR it would create, conflicting files (git merge-tree,
  no worktree) and the incoming commits, in a throwaway bare repo,
  without pushing anything.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01M1AaXnEghenJ4BDxNryKvs
test(e2e): cover append-by-default and smart insertion in the route editor
All checks were successful
CI / go (push) Successful in 22m41s
CI / web (push) Successful in 1m52s
f4576f12a6
Drive the trail editor's route drawing in Chromium with routing,
elevation and reverse geocoding mocked in the browser (straight legs),
so it needs no Valhalla or Nominatim:

- a plain click appends to the end of the route;
- with the "insert at nearest" toggle on, a point beside the A-B leg is
  inserted between A and B, while a point beyond the end still appends;
- Alt-click inserts once and the next plain click appends again;
- undo/redo of the split insert, and down to the very first anchor,
  restores the anchor list, its order and the anchor markers on the map.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01M1AaXnEghenJ4BDxNryKvs
fix(importer): clamp names at PocketBase's default limit when Max is 0
Some checks failed
CI / go (push) Failing after 2m54s
CI / web (push) Successful in 2m7s
ae14894ed2
The trails and waypoints name fields have TextField.Max = 0, which
PocketBase treats as its 5000-character default, but clampTextField
read Max = 0 as "no limit" and never clamped: on the real schema the
name clamp was a no-op and an over-long external name still failed the
import. Fall back to 5000 like util.SanitizeHTMLFieldsWithLimits does,
and test it against a Max 0 field (the earlier test used Max 255).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01M1AaXnEghenJ4BDxNryKvs
test(importer): pass the media log context added to createWaypoints in v0.21.2
All checks were successful
CI / go (push) Successful in 20m11s
CI / web (push) Successful in 1m40s
212909d21c
Upstream v0.21.2 added a pluginMediaLogContext parameter to createWaypoints;
the waypoint clamp tests still called it with the old arity, so `go vet`
failed to compile the package.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01M1AaXnEghenJ4BDxNryKvs
Merge main (v0.21.2 + upstream-sync) into fix/waypoint-description-clamp
All checks were successful
CI / go (push) Successful in 23m50s
CI / web (push) Successful in 1m29s
9229f6f91c
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XMf4EKLnjYyjFp8QGWgFFq
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XMf4EKLnjYyjFp8QGWgFFq
test(route-editor): cover prepend, split insert and undo in the valhalla store
All checks were successful
CI / web (push) Successful in 54s
CI / go (push) Successful in 12m2s
f9f8cbf9af
Unit tests for the store operations behind smart insertion: insertIntoRoute
at index 0 prepends (it used to append), insertAnchorSplit replaces one
segment by two halves in a single undo step and refreshes totals, an
anchor-only change is undoable without touching the route, and
deleteFromRoute recomputes totals from the shortened route.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XMf4EKLnjYyjFp8QGWgFFq
ci: cache Go modules, build/test cache and the TinyGo .deb
All checks were successful
CI / go (push) Successful in 12m10s
CI / web (push) Successful in 53s
0d56e4dcd7
The go job ran fully cold every time (setup-go cache: false, TinyGo .deb
fetched from GitHub on every run), about 11-13 min.

Restore and save ~/go/pkg/mod, ~/.cache/go-build (which also holds the
go test results, so unchanged packages are not re-run) and TinyGo's
build cache with actions/cache@v4. There is one entry per commit, with
restore-keys on the go.sum set and the Go/TinyGo version. The TinyGo .deb
is cached separately, keyed on its version. Actions stay on the
node20-era majors this file already uses (checkout@v4, setup-go@v5).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XMf4EKNjKMd6bwCpS7K4jU
Brings deploy back in line with the fork trunk. main is upstream's release
line plus fork CI and upstreamable work; deploy is main plus the live-only
features, so main flows into deploy, never the other way.

Conflicts (route editor, de/en/fr locales, valhalla store, route_insertion)
resolved to deploy's side: deploy already carries the smart-insertion chain
(cfeb45dc..ab00270a, patch-equivalent to main's 6c469f72..6ee8ceb6) and has
since moved on (f9668d34 shortest-path insert by default + one undo step per
action, ba0a249a loop close, per-segment modes). main's "append-to-end" /
"insert-at-nearest" / "insert-modifier-hint" keys are unused on deploy, which
uses "append-only-mode" / "shortest-path-mode" / "mode-modifier-hint".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
test(e2e): drop main's append-by-default route-insertion spec on deploy
All checks were successful
CI / web (push) Successful in 1m4s
CI / go (push) Successful in 14m35s
66f7511a09
The spec came in with the main merge and asserts main's route-editor UI:
append by default, an "Adding to end of route" / "Inserting at nearest
point" toggle and Alt/⌘ to insert once. deploy inverted that in f9668d34
(shortest-path insert by default, "Shortest-path insertion" / "Appending
to end of route", Alt/⌘ = the other mode once) and added the loop close
(ba0a249a), so most cases here would fail against deploy. The Playwright
e2e suite is not run in CI and needs the full stack, so it cannot be
adapted and verified here; port it to deploy's semantics in a follow-up.
The store-level coverage from main (valhalla_store_insert.test.ts) stays
and passes on deploy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XMf4EGfBC9xbQ6rjD6HxgP
Author
Member

Shipped via batch PR #64 (deploy 0d0d85a4), which merged this branch head unchanged; live since 2026-11-05 ~19:30 CET in wanderer-web:deploy-676a7c62 (homelab-flux #843). Forgejo does not mark stacked PRs as merged, so I am closing this by hand.

🤖 Generated with Claude Code

Shipped via batch PR #64 (`deploy` 0d0d85a4), which merged this branch head unchanged; live since 2026-11-05 ~19:30 CET in `wanderer-web:deploy-676a7c62` (homelab-flux #843). Forgejo does not mark stacked PRs as merged, so I am closing this by hand. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
maximus closed this pull request 2026-11-05 19:10:44 +00:00
All checks were successful
CI / web (push) Successful in 1m4s
Required
Details
CI / go (push) Successful in 14m35s
Required
Details

Pull request closed

Sign in to join this conversation.
No reviewers
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!55
No description provided.