Skip to content

Local-only operation is the full product: no feature may require the relay or Sourceful services #1323

Open

Description

@HuggeK

Ask

Make it a stated product rule, with a test behind it, that FTW is the complete product when run locally. No feature a household needs to use FTW may depend on the relay, the escrow, the push path or any other Sourceful service being reachable. Someone who only wants a box on their LAN, with app_link off, gets everything. Someone who has the app loses nothing but remote reach when Sourceful's services are down, and keeps the whole product on the box if those services are ever retired.

Today this holds in the code. It is not written down as a rule, it is not tested, and the list of what is relay-only by nature is spread over package comments and an ADR. Without that list, the next app-first feature can quietly land on the relay side alone.

What holds today, with evidence

  • The app's request surface is a strict subset of the local API. Seven inbound message kinds (go/internal/appproto/messages.go), and every implemented cmd op is annotated Via(...) on the local route it shares: site.mode.set on POST /api/mode, loadpoint.hold, loadpoint.boost, loadpoint.soc.set and loadpoint.surplus_only.set on the /api/loadpoints/{id}/… routes.
  • api.passthrough runs the box's own api.Server handler in-process ("the same handler the LAN listener serves, trust boundary included", go/internal/appproto/passthrough.go). Its gate only refuses: E_USE_CMD, E_LOCAL_ONLY, E_WHOLE_DOCUMENT, non-/api/ paths. The app never sees a route the LAN does not.
  • Nothing local reads the uplink. main.go references it only for enrolment and the dead-man resync. Relay loss means one reconnecting goroutine with capped backoff and one log line.
  • README.md and docs/architecture.md both say it: "An unavailable relay leaves local control and local recovery intact."
  • The uplink is a switch, app_link.enabled, shown in Settings → FTW app. Fleet statistics is a separate switch.
  • The on-box UI has the everyday charging flow the roadmap credits to the webapp: plug-in view, SoC goal, schedule autosave, Charge now, battery boost (web/ev-plan.js, web/loadpoints.js and their tests).
  • Notifications have a provider that needs no Sourceful service: ntfy, any server including self-hosted.
What is relay- or cloud-dependent by nature, and should become the whole reviewed list
  • Remote reach itself. The webapp has only the relay carrier; the WebRTC LAN carrier is deferred in srcfl/ftw-webapp docs/architecture.md, and pairing redemption happens inside the Noise handshake over the relay only. The lan_hint in the QR payload is unused. So the app is a remote client, full stop, and that is fine as long as the box's own UI is complete.
  • box.unreachable push, the dead-man switch (go/internal/appuplink/deadman.go). Only the relay can say the box is gone. When the relay is down the switch simply cannot fire; nothing on the box changes.
  • Lock-screen push in practice. Web Push is posted straight to the browser vendor's push service, not through the relay, but only the app registers a subscription. The on-box UI has no service worker, so a local-only site uses ntfy for the same events.
  • Owner/viewer roles and invites. The LAN door is one house password with no per-person identity.
  • Escrow recovery of a phone's keys.

Questions this issue should settle

  1. Default-on uplink. With app_link absent the box dials wss://relay.ftw.energy at boot whether or not a phone is ever paired. That is a product choice (CHANGELOG 2.0.x), but a local-only site should be able to have no outbound connection to Sourceful at all, and setup should make the choice visible.
  2. DNS in identity resolution. gatewayidentity resolves relay.ftw.energy only to learn which interface would carry the uplink, and its comment records that an earlier dead name made identity resolution fail at the lookup. A lookup failure must never block boot, identity or control. Worth a test.
  3. Notifications when the app is closed is a roadmap acceptance item that only Web Push meets. Decide whether ntfy is the sanctioned local answer and say so in docs, or add a channel that needs no third party.
  4. Service downtime or retirement. The relay endpoint is a compile-time constant on purpose. If Sourceful's services are down, the app falls back to its cache carrier and the box carries on. If they are retired, the app is gone and the box must still be the whole product. The rule should say that plainly.

Proposed acceptance

  • A sentence in the product rules (AGENTS.md, mirrored in VISION.md): local-only operation is a supported configuration, and every feature needed to run FTW works with app_link off and with the relay, escrow and push services unreachable.
  • The relay-only list above lives in docs/architecture.md under Remote access boundary, so a reviewer can ask "why is this new thing on the relay-only list?" in a PR.
  • A test that boots Core with app_link on and the relay unresolvable or refusing, and asserts that control ticks, the on-box UI and /api/ routes behave exactly as with app_link off, with one honest status line and no log flood. A second case with DNS failing entirely covers the identity lookup.
  • A checklist line for contract changes: a new op or capability in contract/registry.yaml names its local route or UI, or is added to the relay-only list with the reason.
Why now

The roadmap's client table gives srcfl/ftw-webapp "fast everyday UI, charging interaction, intent/result feedback, notifications". That is the right split of responsibility, but it reads as if those things belong to the app. VISION says local operation survives loss of the caller or cloud. This issue asks for that to be explicit and tested before more app-first work lands.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions