Skip to content

fix: module config save crash, missing sendKeyVerification, and all 43 tsc errors in apps/web#1239

Open
Jarod1230 wants to merge 8 commits into
meshtastic:mainfrom
Jarod1230:fix/stale-apis-and-type-errors
Open

fix: module config save crash, missing sendKeyVerification, and all 43 tsc errors in apps/web#1239
Jarod1230 wants to merge 8 commits into
meshtastic:mainfrom
Jarod1230:fix/stale-apis-and-type-errors

Conversation

@Jarod1230

@Jarod1230 Jarod1230 commented Jul 3, 2026

Copy link
Copy Markdown

Description

This PR fixes two runtime crashes and clears all 43 tsc --noEmit errors in apps/web (the PR CI does not run a full typecheck, so these had accumulated silently):

  1. Saving four module config pages crashed. RemoteHardware, StatusMessage, Tak and TrafficManagement still destructured setChange/removeChange from useDevice(), which no longer exist on the device store — submitting any of these forms threw a TypeError. They are now migrated to the useConfigEditor/setModuleSection pattern already used by the other module config pages (Paxcounter, MQTT, …).
  2. Key verification crashed. NodeDetailsDialog and ClientNotificationDialog call connection.sendKeyVerification(), but the method was lost when the legacy MeshDevice facade was rebuilt on top of MeshClient. It is reintroduced as a thin wrapper sending the keyVerification admin message, matching the old @meshtastic/core signature.
  3. ResultType does not exist in better-result 2.9.2 (the exported type is Result) — every type-only import of it failed to resolve, cascading into result.error is of type unknown errors at the serial transport callsites. Renamed across sdk, sdk-react, transport-web-serial and sdk-preview.
  4. Two protobuf type trees coexisted. @meshtastic/sdk still pulled the JSR @meshtastic/protobufs release while the root already resolves it to the workspace package — breaking assignability wherever both met (LoRa serialHalOnly, sqlocal User, sdk-preview event types). The sdk now consumes workspace:*, and the last two @meshtastic/core imports in the app are switched to @meshtastic/sdk.
  5. ErrorPage assumed Error, but react-error-boundary types the caught value as unknown; non-Error throws are now normalized before rendering.

The last commit is oxfmt output for 12 files on which pnpm format was already failing on main (no manual edits).

Changes Made

  • Migrate RemoteHardware / StatusMessage / Tak / TrafficManagement module config pages to useConfigEditor (fixes save crash)
  • Add sendKeyVerification() to the legacy MeshDevice shim (fixes key verification crash)
  • Rename ResultTypeResult imports from better-result (34 files, type-only)
  • packages/sdk: depend on @meshtastic/protobufs via workspace:* instead of JSR 2.7.20; add new hasXeddsaSigned field to the NodeInfo test fixture
  • ErrorPage: accept unknown thrown values
  • oxfmt formatting for files that were failing pnpm format on main

Testing Done

  • pnpm test -- --run: 388/388 tests pass (69 files)
  • cd apps/web && npx tsc --noEmit: 0 errors (was 43 on main)
  • pnpm check (oxlint + oxfmt): passes; oxlint warnings unchanged from main
  • apps/web vite production build: green

Checklist

  • Code follows project style guidelines
  • Documentation has been updated or added (no documentation changes required — bug fixes only)
  • Tests have been added or updated
  • All i18n translation labels have been added (no new labels introduced — existing keys reused)

🤖 Generated with Claude Code using the Claude Fable 5 model

Summary by CodeRabbit

  • New Features
    • Added support for sending key verification messages from the device interface.
    • Module configuration pages now use a live editor workflow for improved save/apply behavior (remote hardware, status message, TAK, traffic management).
  • Bug Fixes
    • Fixed connection handling to use the latest saved state, preventing stale-closure issues when connecting immediately after adding.
    • Error pages now safely render unknown thrown values (not just Error instances).
    • Improved message composer readiness checks by waiting for “Connected” before enabling interaction.

Jarod1230 and others added 6 commits July 3, 2026 14:14
…/removeChange store API

RemoteHardware, StatusMessage, Tak and TrafficManagement still destructured
setChange/removeChange from useDevice(), which no longer exist on the device
store — saving any of these module configs threw a TypeError at runtime.
Migrate them to the useConfigEditor/setModuleSection pattern already used by
the other module config pages (e.g. Paxcounter, MQTT).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
NodeDetailsDialog and ClientNotificationDialog call
connection.sendKeyVerification(), but the method was lost when the legacy
MeshDevice facade was rebuilt on top of MeshClient — initiating or answering
a key verification crashed with a TypeError. Reintroduce it as a thin wrapper
that sends the keyVerification admin message, matching the old
@meshtastic/core signature.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
better-result 2.9.2 exports the Result union type, not ResultType — every
type-only import of ResultType failed to resolve, which cascaded into
'result.error is of type unknown' errors at the transport callsites. Rename
the imports across sdk, sdk-react, transport-web-serial and sdk-preview, and
retype the sdk-preview slice against @meshtastic/sdk (the shim MeshDevice the
app actually passes in) instead of the stale JSR @meshtastic/core.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The app already resolves @meshtastic/protobufs to the workspace package
(root package.json), but @meshtastic/sdk still pulled the JSR release —
two incompatible protobuf type trees coexisted, breaking assignability
wherever both met (LoRa serialHalOnly, sqlocal User, sdk-preview events).
Point the sdk at the workspace package, finish the last two
@meshtastic/core imports in the app, and add the new hasXeddsaSigned
field to the NodeInfo test fixture.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
react-error-boundary types the caught value as unknown; ErrorPage assumed
Error, so App/PageLayout FallbackComponent props didn't typecheck and a
thrown non-Error would render nothing useful. Normalize before rendering.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
pnpm format was failing on main for 12 files (e2e helpers, playwright
config and a few sources); this is the oxfmt --fix output with no manual
edits.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@CLAassistant

CLAassistant commented Jul 3, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5f2fc45a-3ba9-4dbf-9c9c-afabbc9f9b13

📥 Commits

Reviewing files that changed from the base of the PR and between 10db0f7 and be71779.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • .github/workflows/release-packages.yml

📝 Walkthrough

Walkthrough

This PR migrates four module config components to signal-based editing, replaces ResultType with Result across SDK APIs, aligns protobuf imports with @meshtastic/sdk, adds key verification support, fixes error and connection handling, updates publishing, and reformats E2E tooling.

Changes

Configuration and SDK updates

Layer / File(s) Summary
Module config editor migration
apps/web/src/components/PageComponents/ModuleConfig/*.tsx
Module forms derive effective values from editor signals and write sections through editor.setModuleSection.
SDK import and config type alignment
apps/web/src/sdk-preview/**, apps/web/src/validation/moduleConfig/tak.ts, apps/web/src/components/Dialog/...
Protobuf, Types, and MeshDevice imports use @meshtastic/sdk; preview config APIs use Result.
SDK Result API standardization
packages/sdk/**, packages/sdk-react/**, packages/transport-web-serial/**
Public methods and use cases replace ResultType return annotations with Result.

Runtime fixes and release maintenance

Layer / File(s) Summary
Runtime API and state fixes
apps/web/src/components/UI/ErrorPage.tsx, apps/web/src/pages/Connections/useConnections.ts, packages/sdk/src/shim/legacyMeshDevice.ts
Error values are normalized, connection lookup reads live Zustand state, and MeshDevice gains sendKeyVerification.
E2E and Playwright formatting
e2e/**, playwright.config.ts
Formatting is changed without altering test or configuration behavior.
Package publishing update
.github/workflows/release-packages.yml, packages/sdk/package.json
Package publishing uses pnpm, and the protobuf dependency uses a workspace link.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Component as Module Config Component
  participant Editor as useConfigEditor
  participant Signal as useSignal
  participant Form as DynamicForm

  Component->>Editor: useConfigEditor()
  Component->>Signal: Read editor modules
  Signal-->>Component: Effective module section
  Component->>Form: Provide effective values
  Form-->>Component: Submit configuration
  Component->>Editor: setModuleSection(section, data)
Loading

Poem

A rabbit hops through config trees,
Signals sway among the keys,
ResultType turns into Result,
SDK imports bloom and glisten,
Tests stand neat in tidy lines —
Hop, hop, all the code aligns!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main fixes: module config saves, sendKeyVerification, and TypeScript errors in apps/web.
Description check ✅ Passed The description matches the template well with Description, Changes Made, Testing Done, and Checklist sections filled in.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/web/src/components/PageComponents/ModuleConfig/RemoteHardware.tsx`:
- Around line 36-48: `RemoteHardware` can render without a config editor because
`useWaitForConfig()` only guarantees module config, so the form currently
accepts edits that are never persisted. Update the `RemoteHardware` component to
guard against a missing `useConfigEditor()` result by disabling the form
controls or rendering an explicit error/empty state until `editor` exists. Make
sure the submit path in `onSubmit` and any editable inputs are blocked when
`editor` is undefined, so no local-only changes can be made.

In `@packages/sdk/package.json`:
- Line 51: The release flow for packages/sdk is using raw npm publish, so the
`@meshtastic/protobufs` workspace:* dependency may be published without being
rewritten. Update the release workflow to use pnpm publish or pnpm pack for the
sdk package, or add a publish-time rewrite step before publishing. Make sure the
fix is applied in the publishing path that handles packages/sdk and its
dependency declarations.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 578cb98d-c666-443c-9042-ab2d4f32c879

📥 Commits

Reviewing files that changed from the base of the PR and between 3ec58d8 and 10db0f7.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (53)
  • apps/web/src/components/Dialog/ClientNotificationDialog/ClientNotificationDialog.tsx
  • apps/web/src/components/PageComponents/ModuleConfig/RemoteHardware.tsx
  • apps/web/src/components/PageComponents/ModuleConfig/StatusMessage.tsx
  • apps/web/src/components/PageComponents/ModuleConfig/Tak.tsx
  • apps/web/src/components/PageComponents/ModuleConfig/TrafficManagement.tsx
  • apps/web/src/components/UI/ErrorPage.tsx
  • apps/web/src/components/generic/Filter/useFilterNode.test.ts
  • apps/web/src/pages/Connections/useConnections.ts
  • apps/web/src/sdk-preview/adapters/fromMeshDevice.ts
  • apps/web/src/sdk-preview/core/client/MeshClientPort.ts
  • apps/web/src/sdk-preview/features/config/__tests__/ConfigEditor.test.ts
  • apps/web/src/sdk-preview/features/config/application/ConfigUseCases.ts
  • apps/web/src/sdk-preview/features/config/domain/ConfigEditor.ts
  • apps/web/src/sdk-preview/features/config/domain/ModuleConfig.ts
  • apps/web/src/sdk-preview/features/config/domain/RadioConfig.ts
  • apps/web/src/sdk-preview/features/config/infrastructure/ConfigMapper.ts
  • apps/web/src/sdk-preview/features/config/infrastructure/configBuilders.ts
  • apps/web/src/validation/moduleConfig/tak.ts
  • e2e/fixtures/peer.ts
  • e2e/global-setup.ts
  • e2e/global-teardown.ts
  • e2e/pages/ConnectionPage.ts
  • e2e/pages/MessagesPage.ts
  • e2e/tests/messaging.broadcast.spec.ts
  • e2e/tests/messaging.direct.spec.ts
  • packages/sdk-react/src/hooks/useChat.ts
  • packages/sdk-react/src/hooks/useDirectChat.ts
  • packages/sdk-react/src/hooks/useFavoriteNode.ts
  • packages/sdk-react/src/hooks/useIgnoreNode.ts
  • packages/sdk/package.json
  • packages/sdk/src/features/channels/ChannelsClient.ts
  • packages/sdk/src/features/channels/application/ChannelUseCases.ts
  • packages/sdk/src/features/chat/ChatClient.send.test.ts
  • packages/sdk/src/features/chat/ChatClient.ts
  • packages/sdk/src/features/chat/application/SendTextUseCase.ts
  • packages/sdk/src/features/chat/application/SendWaypointUseCase.ts
  • packages/sdk/src/features/config/ConfigClient.ts
  • packages/sdk/src/features/config/application/ConfigUseCases.ts
  • packages/sdk/src/features/config/domain/ConfigEditor.ts
  • packages/sdk/src/features/files/FilesClient.ts
  • packages/sdk/src/features/nodes/NodesClient.test.ts
  • packages/sdk/src/features/nodes/NodesClient.ts
  • packages/sdk/src/features/nodes/application/FavoriteNodeUseCase.ts
  • packages/sdk/src/features/nodes/application/IgnoreNodeUseCase.ts
  • packages/sdk/src/features/nodes/application/RemoveNodeUseCase.ts
  • packages/sdk/src/features/nodes/application/SetOwnerUseCase.ts
  • packages/sdk/src/features/position/PositionClient.ts
  • packages/sdk/src/features/position/application/PositionUseCases.ts
  • packages/sdk/src/features/traceroute/TraceRouteClient.ts
  • packages/sdk/src/features/traceroute/application/TraceRouteUseCase.ts
  • packages/sdk/src/shim/legacyMeshDevice.ts
  • packages/transport-web-serial/src/transport.ts
  • playwright.config.ts

Comment thread packages/sdk/package.json
@vercel

vercel Bot commented Jul 6, 2026

Copy link
Copy Markdown

@Jarod1230 is attempting to deploy a commit to the Meshtastic Team on Vercel.

A member of the Team first needs to authorize it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web-test Ready Ready Preview, Comment Jul 11, 2026 11:07pm

Request Review

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants