Skip to content

fix: packaging smoke path, RF reconnect ownership, and CI build-channel stamps - #798

Merged
rinchen merged 4 commits into
mainfrom
build-failures
Aug 5, 2026
Merged

fix: packaging smoke path, RF reconnect ownership, and CI build-channel stamps#798
rinchen merged 4 commits into
mainfrom
build-failures

Conversation

@rinchen

@rinchen rinchen commented Aug 5, 2026

Copy link
Copy Markdown
Member

Summary

  • CI packaging smoke: Keep READ-ME-FIRST-test-build.md under release/ so upload-artifact LCA stays in release/ (fixes nested release/release/*.exe that broke x64 NSIS smoke in Build Binaries #31012456717).
  • RF reconnect ownership: Shared createRfReconnectController so MeshCore/Meshtastic TCP do not schedule a second connection-lost reconnect while a cycle is already active (n7eal dual attempt 2+3); TCP device_status no longer double-enters lost; DMG Applications link named explicitly.
  • Build channel stamps: Embed GitHub Actions run metadata at package time (scripts/ci-write-build-info-env.mjs + src/shared/buildInfo.ts) so support-bundle manifests and startup logs distinguish CI test builds from official releases without changing package.json semver.

Commits

  1. fix(ci): keep READ-ME-FIRST under release/ for packaging smoke
  2. fix: single-owner RF reconnect controller for MeshCore/Meshtastic TCP
  3. feat: stamp test vs release build channel into exports and logs

Test plan

  • pnpm exec vitest run src/main/windows-packaging.contract.test.ts
  • Unit coverage for rfReconnectController, MeshCore/Meshtastic reconnect contracts, buildInfo, and ci-write-build-info-env
  • Re-run Build Binaries (no release) and confirm Smoke test x64 NSIS install (and WoA/macOS/Linux smoke) find artifacts at release/ (not release/release/)
  • Confirm platform artifacts still include READ-ME-FIRST-test-build.md at the top of the download
  • Confirm CI test builds show build-channel / run metadata in support-bundle manifest and startup logs; release builds remain distinct

Summary by CodeRabbit

  • New Features

    • Added build metadata to packaged apps, runtime logs, support bundles, and troubleshooting information.
    • Support bundles now include build channel and available CI details.
    • Improved RF reconnection coordination to prevent overlapping attempts and handle connection-loss races more reliably.
  • Bug Fixes

    • Improved TCP disconnect handling to avoid duplicate reconnect flows.
    • Improved installer diagnostics when expected packages are missing.
    • Updated macOS disk image layout and staged test-build warnings consistently across platforms.
  • Documentation

    • Expanded CI/CD, packaging, and build-metadata troubleshooting guidance.

Mixing release-warnings into upload-artifact paths changed the LCA so
installers nested as release/release/*.exe and broke NSIS smoke downloads.
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@rinchen, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 45 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: QUIET

Plan: Pro Plus

Run ID: 31ba83fc-1b00-4f94-969b-52d9e8316a76

📥 Commits

Reviewing files that changed from the base of the PR and between 3e905c0 and 007df3b.

📒 Files selected for processing (8)
  • docs/ci-cd.md
  • scripts/ci-write-build-info-env.mjs
  • src/main/windows-packaging.contract.test.ts
  • src/renderer/lib/rfReconnectController.test.ts
  • src/renderer/runtime/useMeshcoreRuntime.reconnect.test.ts
  • src/renderer/runtime/useMeshcoreRuntime.ts
  • src/renderer/runtime/useMeshtasticRuntime.reconnect-hardening.test.ts
  • src/renderer/runtime/useMeshtasticRuntime.ts
📝 Walkthrough

Walkthrough

This PR adds CI build metadata stamping and exposes that metadata in bundles and logs. It also introduces a shared RF reconnect controller for MeshCore and Meshtastic, with staged packaging warnings and updated reconnect contract tests.

Changes

Build metadata and packaging

Layer / File(s) Summary
Build-info parsing and output contract
src/shared/buildInfo.ts, src/shared/buildInfo.test.ts
Adds build-channel parsing, normalization, log formatting, and support-bundle manifest metadata with local fallbacks.
CI stamping and bundle embedding
scripts/ci-write-build-info-env.mjs, scripts/ci-write-build-info-env.test.mjs, scripts/esbuild-main-build.mjs, .github/workflows/*.yaml
Validates CI metadata, writes MESH_CLIENT_BUILD_INFO, and embeds it into the main bundle.
Runtime and support-bundle metadata
src/main/log-service.*, src/main/support-bundle.*, docs/ci-cd.md, docs/troubleshooting.md
Adds build-channel and CI metadata to runtime logs, manifests, README files, and documentation.
Artifact warning staging and packaging diagnostics
.github/workflows/build.yaml, electron-builder.yml, scripts/test-win-nsis-install.mjs, src/main/windows-packaging.contract.test.ts
Stages warnings under release/, updates uploads and DMG entries, and expands missing-installer diagnostics.

RF reconnect ownership

Layer / File(s) Summary
Reconnect controller state machine
src/renderer/lib/rfReconnectController.ts, src/renderer/lib/rfReconnectController.test.ts
Adds single-owner reconnect state, generation tracking, dirty-state handling, lifecycle transitions, and coalesced scheduling.
MeshCore reconnect integration
src/renderer/runtime/useMeshcoreRuntime.ts, src/renderer/hooks/meshcore/meshcoreConnSideEffects.ts, src/renderer/runtime/*Meshcore*test.ts
Routes MeshCore reconnect handling through the controller and leaves TCP disconnect ownership with the native listener.
Meshtastic reconnect integration
src/renderer/runtime/useMeshtasticRuntime.ts, src/renderer/runtime/useMeshtasticRuntime.reconnect-hardening.test.ts
Uses the controller for reconnect ownership, attempt lifecycle, cancellation, and deferred scheduling.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CIWorkflow
  participant BuildInfoScript
  participant MainBuild
  participant Application
  CIWorkflow->>BuildInfoScript: Set channel and workflow metadata
  BuildInfoScript->>MainBuild: Write MESH_CLIENT_BUILD_INFO
  MainBuild->>Application: Embed compile-time build stamp
  Application->>Application: Add metadata to logs and support bundles
Loading
sequenceDiagram
  participant MeshCoreOrMeshtastic
  participant RfReconnectController
  participant ReconnectRuntime
  MeshCoreOrMeshtastic->>RfReconnectController: Report link loss
  RfReconnectController->>RfReconnectController: Select one owner and coalesce events
  RfReconnectController->>ReconnectRuntime: Schedule reconnect attempt
  ReconnectRuntime->>RfReconnectController: Begin, settle, or cancel attempt
  RfReconnectController->>ReconnectRuntime: Request deferred follow-up when dirty
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 44.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the three main changes: packaging smoke paths, RF reconnect ownership, and CI build-channel metadata.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch build-failures

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@rinchen
rinchen marked this pull request as draft August 5, 2026 14:20
rinchen added 2 commits August 5, 2026 08:54
Stop connection-lost from scheduling after await disconnect while a
reconnect cycle is already active (n7eal dual attempt 2+3). Shared
createRfReconnectController owns dirty/generation; TCP device_status
no longer double-enters lost; DMG Applications link named explicitly.
Embed GitHub Actions run metadata at package time so support-bundle
manifests and startup logs distinguish CI test builds from official
releases without changing package.json semver.
@rinchen rinchen changed the title fix(ci): keep READ-ME-FIRST under release/ for packaging smoke fix: packaging smoke path, RF reconnect ownership, and CI build-channel stamps Aug 5, 2026
@rinchen
rinchen marked this pull request as ready for review August 5, 2026 15:02

@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: 3

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

🟡 Other comments (2)
src/main/windows-packaging.contract.test.ts-160-166 (1)

160-166: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Assert staging order and upload coverage.

These assertions only verify that the strings exist somewhere in the workflow. The test still passes if staging moves below the uploads or if every upload omits release/READ-ME-FIRST-test-build.md. Scope the checks to each platform upload block and verify that staging occurs before the first upload.

🤖 Prompt for 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.

In `@src/main/windows-packaging.contract.test.ts` around lines 160 - 166,
Strengthen the assertions in the Windows packaging contract test around the
buildWorkflow staging and upload blocks: verify READ-ME-FIRST is staged before
the first platform upload, and confirm each platform upload includes
release/READ-ME-FIRST-test-build.md while excluding
release-warnings/READ-ME-FIRST-test-build.md. Scope the checks to the individual
upload blocks rather than matching strings anywhere in the workflow.
docs/ci-cd.md-102-109 (1)

102-109: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Correct the documented release order.

.github/workflows/release.yaml installs Linux dependencies and runs pnpm run rebuild before the stamp and Build and Publish steps. This section lists the build first, then dependency installation and rebuilding. Reorder the numbered steps, or label them as a phase summary, so maintainers do not follow a sequence that differs from CI.

As per path instructions: preserve packaging and build-metadata scope and keep packaging diagnostics aligned with the workflow.

🤖 Prompt for 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.

In `@docs/ci-cd.md` around lines 102 - 109, Update the numbered release workflow
summary in the section containing “Stamp CI build info” so it matches
`.github/workflows/release.yaml`: list Linux dependency installation and `pnpm
run rebuild` before the build-info stamp and parallel platform builds, while
preserving the existing packaging and build-metadata descriptions and
diagnostics.

Source: Path instructions

🤖 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 `@scripts/ci-write-build-info-env.mjs`:
- Around line 152-156: Replace the console.log call in the build-info status
output with process.stdout.write, preserving the existing message and
conditional channel, runId, and tag formatting while ensuring the output
includes the intended line termination.

In `@src/renderer/runtime/useMeshcoreRuntime.ts`:
- Line 2786: Update the retry-exhaustion branches in
src/renderer/runtime/useMeshcoreRuntime.ts:2786-2786 and
src/renderer/runtime/useMeshtasticRuntime.ts:2159-2159 to call
RfReconnectController.markExhausted() after clearing the legacy reconnect state.
When serial rediscovery begins another cycle, re-enter it through the controller
before scheduling, while preserving shared single-owner scheduling, generation
guards, cancellation, attempt settling, and manual-disconnect suppression. Add a
behavioral regression test covering reconnect after exhaustion.

In `@src/renderer/runtime/useMeshtasticRuntime.ts`:
- Around line 1997-2005: In
src/renderer/runtime/useMeshtasticRuntime.ts:1997-2005, guard
handleConnectionLost so explicit disconnects return before calling
meshtasticRfReconnectRef.current.onLinkLost(), and cancel the controller when
manual disconnect, power suspend, or manual connection replacement abandons a
cycle. In src/renderer/runtime/useMeshcoreRuntime.ts:567-570, apply equivalent
cancellation and teardown synchronization to the MeshCore persistent controller.
Preserve shared single-owner scheduling, generation guards, cancellation,
attempt settling, and manual-disconnect suppression, and add regression coverage
for explicit disconnect and suspend before the scheduled owner runs.

---

Other comments:
In `@docs/ci-cd.md`:
- Around line 102-109: Update the numbered release workflow summary in the
section containing “Stamp CI build info” so it matches
`.github/workflows/release.yaml`: list Linux dependency installation and `pnpm
run rebuild` before the build-info stamp and parallel platform builds, while
preserving the existing packaging and build-metadata descriptions and
diagnostics.

In `@src/main/windows-packaging.contract.test.ts`:
- Around line 160-166: Strengthen the assertions in the Windows packaging
contract test around the buildWorkflow staging and upload blocks: verify
READ-ME-FIRST is staged before the first platform upload, and confirm each
platform upload includes release/READ-ME-FIRST-test-build.md while excluding
release-warnings/READ-ME-FIRST-test-build.md. Scope the checks to the individual
upload blocks rather than matching strings anywhere in the workflow.
🪄 Autofix

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: Path: .coderabbit.yaml

Review profile: QUIET

Plan: Pro Plus

Run ID: fac101fb-ed0d-4e7a-8d96-76e1696b4296

📥 Commits

Reviewing files that changed from the base of the PR and between 1232b29 and 3e905c0.

📒 Files selected for processing (24)
  • .github/workflows/build.yaml
  • .github/workflows/release.yaml
  • docs/ci-cd.md
  • docs/troubleshooting.md
  • electron-builder.yml
  • scripts/ci-write-build-info-env.mjs
  • scripts/ci-write-build-info-env.test.mjs
  • scripts/esbuild-main-build.mjs
  • scripts/test-win-nsis-install.mjs
  • src/main/log-service.test.ts
  • src/main/log-service.ts
  • src/main/support-bundle.test.ts
  • src/main/support-bundle.ts
  • src/main/windows-packaging.contract.test.ts
  • src/renderer/hooks/meshcore/meshcoreConnSideEffects.ts
  • src/renderer/lib/rfReconnectController.test.ts
  • src/renderer/lib/rfReconnectController.ts
  • src/renderer/runtime/loraRfReconnectParity.contract.test.ts
  • src/renderer/runtime/useMeshcoreRuntime.reconnect.test.ts
  • src/renderer/runtime/useMeshcoreRuntime.ts
  • src/renderer/runtime/useMeshtasticRuntime.reconnect-hardening.test.ts
  • src/renderer/runtime/useMeshtasticRuntime.ts
  • src/shared/buildInfo.test.ts
  • src/shared/buildInfo.ts

Comment thread scripts/ci-write-build-info-env.mjs Outdated
Comment thread src/renderer/runtime/useMeshcoreRuntime.ts
Comment thread src/renderer/runtime/useMeshtasticRuntime.ts
…docs

Use stdout.write for CI build-info status, markExhausted + controller
re-entry after serial rediscovery, and cancel/guard on disconnect and
suspend so scheduled owners cannot restart after abandon.
@rinchen
rinchen merged commit 0c8864c into main Aug 5, 2026
12 checks passed
@rinchen
rinchen deleted the build-failures branch August 5, 2026 15:25
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.

1 participant