feat(hostcheck): run plugin bundles inside the wanderer host #1

Merged
maximus merged 1 commit from feat/hostcheck into main 2026-11-01 14:03:09 +00:00
Member

Closes nothing by itself; part of public/wanderer#9 (M0.4).

What #9 asked for, and what was already there

#9: "scaffold a plugin from plugins/sdk; wire a build → .wasm → runtime-install path".

Checked against the code, not the ticket comments:

  • Scaffold: example/ (list_routes_v1 + get_route_detail_v1) on SDK v0.21.2 (a241d1b3). It mirrors upstream's komoot/strava plugins: same tinygo build -target=wasi -scheduler=none -no-debug, manifestcheck, and fail() convention.
  • Build → .wasm: make build/package. CI run 13697 on fc201fb built it green.
  • Runtime-install path: make install-local writes <data>/plugins/<id>/, the directory the db scans (pluginsystem.PluginDir → /data/plugins). homelab-flux #670 mounts the wanderer-plugins PVC there.
  • Missing: proof that the wanderer host actually loads and runs the bundle. manifestcheck only validates the JSON schema.

This PR: make hostcheck

hostcheck/ is a Go program built against db/ of the pinned wanderer release (sparse checkout in .wanderer, v0.21.2 = a241d1b3). Prod runs the upstream flomp/wanderer-db:v0.21.2 image, so this is the exact host code.

  1. It installs every bundle like install-local, then discovers them with pluginsystem.DiscoverLocalPlugins, the loader the db runs on startup.
  2. It calls list_* → get_*_detail through wanderer's plugin worker. The worker re-execs the binary as plugin-worker, like the db's main.go. The calls use the sync's input shapes, the output is decoded strictly into the host types, and the importer's GPX rules are applied.
  3. It calls a list export with invalid input to check the error path.

Finding: plugin error codes are lost on wanderer v0.21.2

Upstream plugins report errors with pdk.SetErrorString(json) + return 1. On v0.21.2, extism hands that back as a Go error, and the worker treats it as fatal:

  • the session is killed;
  • the code (auth_failed, rate_limited, ...) never reaches InstanceStatusForPluginError;
  • so an instance whose token expired shows a generic provider_unavailable instead of needs_reauth.

Upstream fixed this today on dev (open-wanderer/wanderer#1424 / #1425, db017977), after v0.21.2. hostcheck accepts the v0.21.2 behaviour with a WARN and expects the structured error once the pin moves past it.

Tests (run on spl-vm03; nothing on the NAS)

  • make hostcheck at v0.21.2: pass. Output:
    == example 0.1.0 (.../.hostcheck-data/plugins/example/plugin.wasm): manifest accepted by the wanderer loader
       list_routes_v1: 1 item(s), hasMore=false
       get_route_detail_v1(demo-1): "Example Loop", GPX parsed
       WARN list_routes_v1 with invalid input: this host turns the plugin's structured error into a fatal worker error (open-wanderer/wanderer#1424, fixed after v0.21.2); the plugin side is correct
    
  • Against upstream dev (db017977, with #1425): pass, and the error path returns plugin error "invalid_request".
  • Negative checks, both fail as intended:
    • a bundle without plugin.wasm is rejected by the loader (runtime_entrypoint_missing);
    • a manifest export the wasm lacks fails with unknown function: list_routes_v9.
  • gofmt clean, go vet clean, go mod tidy is a no-op (go.mod/go.sum came from the VM).

CI note

build.yml runs only on pushes to main (and dispatch). This branch push started nothing. After merge, the run adds a sparse GitHub clone plus a pocketbase-dependency compile (several CPU-minutes) on the NAS runner, so merge in a quiet window or once the CI VM is up.

README

  • States the v0.21.2 plugin scope: trail-provider connectors only.
  • Drops the "personal-pace plugin" example, which #9's own analysis showed cannot be a plugin.
  • Notes upstream's unmerged routing plugin type.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XMf4EKLnjYyjFp8QGWgFFq

Closes nothing by itself; part of public/wanderer#9 (M0.4). ## What #9 asked for, and what was already there #9: "scaffold a plugin from `plugins/sdk`; wire a build → `.wasm` → runtime-install path". Checked against the code, not the ticket comments: - **Scaffold:** `example/` (`list_routes_v1` + `get_route_detail_v1`) on SDK v0.21.2 (a241d1b3). It mirrors upstream's komoot/strava plugins: same `tinygo build -target=wasi -scheduler=none -no-debug`, `manifestcheck`, and `fail()` convention. - **Build → `.wasm`:** `make build`/`package`. CI run 13697 on fc201fb built it green. - **Runtime-install path:** `make install-local` writes `<data>/plugins/<id>/`, the directory the db scans (`pluginsystem.PluginDir` → `/data/plugins`). homelab-flux #670 mounts the `wanderer-plugins` PVC there. - **Missing:** proof that the wanderer host actually loads and runs the bundle. `manifestcheck` only validates the JSON schema. ## This PR: `make hostcheck` `hostcheck/` is a Go program built against `db/` of the pinned wanderer release (sparse checkout in `.wanderer`, v0.21.2 = a241d1b3). Prod runs the upstream `flomp/wanderer-db:v0.21.2` image, so this is the exact host code. 1. It installs every bundle like `install-local`, then discovers them with `pluginsystem.DiscoverLocalPlugins`, the loader the db runs on startup. 2. It calls `list_*` → `get_*_detail` through wanderer's plugin worker. The worker re-execs the binary as `plugin-worker`, like the db's `main.go`. The calls use the sync's input shapes, the output is decoded strictly into the host types, and the importer's GPX rules are applied. 3. It calls a list export with invalid input to check the error path. ### Finding: plugin error codes are lost on wanderer v0.21.2 Upstream plugins report errors with `pdk.SetErrorString(json)` + `return 1`. On v0.21.2, extism hands that back as a Go error, and the worker treats it as fatal: - the session is killed; - the code (`auth_failed`, `rate_limited`, ...) never reaches `InstanceStatusForPluginError`; - so an instance whose token expired shows a generic `provider_unavailable` instead of `needs_reauth`. Upstream fixed this today on `dev` (open-wanderer/wanderer#1424 / #1425, db017977), after v0.21.2. hostcheck accepts the v0.21.2 behaviour with a WARN and expects the structured error once the pin moves past it. ## Tests (run on spl-vm03; nothing on the NAS) - `make hostcheck` at v0.21.2: **pass**. Output: ``` == example 0.1.0 (.../.hostcheck-data/plugins/example/plugin.wasm): manifest accepted by the wanderer loader list_routes_v1: 1 item(s), hasMore=false get_route_detail_v1(demo-1): "Example Loop", GPX parsed WARN list_routes_v1 with invalid input: this host turns the plugin's structured error into a fatal worker error (open-wanderer/wanderer#1424, fixed after v0.21.2); the plugin side is correct ``` - Against upstream `dev` (db017977, with #1425): **pass**, and the error path returns `plugin error "invalid_request"`. - Negative checks, both fail as intended: - a bundle without `plugin.wasm` is rejected by the loader (`runtime_entrypoint_missing`); - a manifest export the wasm lacks fails with `unknown function: list_routes_v9`. - `gofmt` clean, `go vet` clean, `go mod tidy` is a no-op (go.mod/go.sum came from the VM). ## CI note `build.yml` runs only on pushes to `main` (and dispatch). This branch push started nothing. After merge, the run adds a sparse GitHub clone plus a pocketbase-dependency compile (several CPU-minutes) on the NAS runner, so merge in a quiet window or once the CI VM is up. ## README - States the v0.21.2 plugin scope: trail-provider connectors only. - Drops the "personal-pace plugin" example, which #9's own analysis showed cannot be a plugin. - Notes upstream's unmerged `routing` plugin type. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01XMf4EKLnjYyjFp8QGWgFFq
feat(hostcheck): run plugin bundles inside the wanderer host
All checks were successful
Build plugins / build (push) Successful in 1m27s
00acdc5e05
Add hostcheck, a Go program built against db/ of the pinned wanderer
release (v0.21.2, sparse checkout in .wanderer). make hostcheck installs
every bundle the way install-local does, discovers it with the db's own
loader (pluginsystem.DiscoverLocalPlugins), calls each import capability
pair through wanderer's plugin worker with the sync's input shapes,
decodes the output strictly into the host types and applies the
importer's GPX rules.

It also exercises the error path. wanderer v0.21.2 turns a plugin's
structured error (SetError + return 1, upstream's convention) into a
fatal worker error and loses the code (open-wanderer/wanderer#1424,
fixed on dev by #1425); hostcheck warns about that instead of failing.

CI runs it after packaging. The README now says what a plugin can be in
v0.21.2 (trail-provider connector, no UI or analysis hook) and drops the
personal-pace example, which cannot be a plugin.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XMf4EKLnjYyjFp8QGWgFFq
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-plugins!1
No description provided.