Skip to content

feat(plan): follow the box household planner prefs - #76

Draft
frahlg wants to merge 2 commits into
mainfrom
cursor/plan-household-prefs-1a28
Draft

frahlg wants to merge 2 commits into
mainfrom
cursor/plan-household-prefs-1a28

Conversation

@frahlg

@frahlg frahlg commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Contract-pair: srcfl/ftw@cursor/plan-household-prefs-1a28

Problem and result

The on-box Plan card no longer offers Passive arbitrage and Active arbitrage as buttons. Household planner prefs are the knobs: a safety-factor slider and whether the battery may sell. The phone app still showed the two old choices, and "Use the plan" picked the first primary catalogue entry.

The Plan screen now matches the box. The slider is safety_k (0–2, step 0.05). An unanswered battery_export shows the existing banner and Allow / Keep off. A known answer shows the existing checkbox. Manual modes stay behind Manual…. Planner keys and hidden-tier modes are not buttons. "Use the plan" is shown only while a manual mode is driving, and it sends mapped_mode from GET /api/planner/prefs, falling back to planner_passive_arbitrage when that read fails.

Prefs are written with planner.prefs.set. The app does not turn an export permission into a mode itself.

The manual mode whose key is idle is labelled Stop batteries, with the box's current tooltip. The old "Idle" / "Do nothing — no dispatch." wording is gone from the simulator catalogue.

Paired with srcfl/ftw#1479, which adds that command. contract/registry.yaml is the same file in both.

Scope and safety

The box remains the authority for mapped_mode. A failed prefs read on "Use the plan" lands on passive arbitrage, which never sells from the battery. A prefs write while a manual mode is driving does not leave that mode; only "Use the plan" does.

Open PR #72 also edits src/lib/sim/api.ts and docs/protocol.md for the charging schedule. This change adds the planner-prefs routes beside that and does not touch the schedule step-up.

Verification

  • npx vitest run src/lib/format/plan-prefs.test.ts src/lib/state/plan.test.ts src/views/Plan.svelte.test.ts tests/plan-e2e.test.ts tests/registry-contract.test.ts passed.
  • npm run check and npm run build passed.
  • Full npm test: plan and contract tests passed. 33 failures are in passkey/escrow suites (SubtleCrypto / escrow unsupported) and are unrelated to this change.
  • Browser, live demo at the Plan screen: slider, unknown-export banner, Allow turning into the checkbox, Manual… without Passive/Active, and Use the plan only while Self (manual) is driving.
  • Manual list in the live demo shows Stop batteries, not Idle.

Manual list with Stop batteries
manual-stop-batteries.mp4

Checklist

  • The change follows the product principle: the box decides, the app shows intent.
  • Overlapping PRs checked. fix(ev): change ready time without a second passkey #72 shares src/lib/sim/api.ts and docs/protocol.md.
  • Tests cover mapped_mode, the passive fallback, the hidden planner keys, and the Stop batteries label.
  • A human still needs to look at the rendered Plan screen. A browser pass of the live demo is attached.
  • Changeset included.
  • Commit has a DCO sign-off.

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

The Plan screen uses the forecast slider and battery-export choice
already on the box. Passive and Active are no longer buttons. Use the
plan asks for the mode the box maps from those prefs.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
ftw-webapp 0ad0173 Commit Preview URL

Branch Preview URL
Sep 29 2026, 07:20 PM

The simulator catalogue still called idle "Idle". The box renamed the
label and tooltip; the key is still idle.

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: Fredrik Ahlgren <fredrik@sourceful-labs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants