Skip to content

fix: unblock Linux serial ACKs and harden mixed log parsing (PR #91 + review fixes) - #1

Closed
Woodii1998 wants to merge 4 commits into
mainfrom
cursor/pr91-review-fixes-6fe8
Closed

Woodii1998 wants to merge 4 commits into
mainfrom
cursor/pr91-review-fixes-6fe8

Conversation

@Woodii1998

Copy link
Copy Markdown
Owner

Summary

This branch carries PR #91 (by @Alxkcx) plus two review follow-up commits. It exists because the review bot cannot push to the contributor's fork; if the follow-up commits get applied to Alxkcx:formal-serial directly, this PR can be closed in favor of zhouxiyu1997#91.

What PR zhouxiyu1997#91 contains (unchanged, first two commits)

  • patch-package patch for @serialport/bindings-cpp@13.0.0 aligning with upstream serialport/bindings-cpp#239 (callback.Call → callback.MakeCallback), fixing multi-second ACK delays on Linux.
  • sender.ts hardening: strip ANSI escapes, recognize ESP-IDF log lines, and recover ACKs when a log is glued after the ACK on the same UART line.

Review fixes added on top (last two commits)

  1. Fix a regression in the log-before-ACK case: recognizing ESP-IDF log lines made sanitizeDeviceLine keep mixed lines like W (4652) BT_HCI: ...recvOK <sid> <seq> intact, which skipped the old tail-ACK fallback — the ACK was forwarded as a plain device log and the command timed out. waitForAck now extracts a trailing sequenced ACK from device log lines and forwards the leading log segment.
  2. Deduplicate ACK dispatch: both the direct and mixed-line ACK paths now go through a shared handleSequencedAck helper.
  3. Add unit tests (apps/desktop/test/serial-line-parsing.test.ts, 14 cases): ANSI stripping, ESP-IDF log recognition, embedded-log extraction, and end-to-end waitForAck behavior for OK/ERR ACKs mixed with logs (log-before and log-after), ignored out-of-sequence ACKs, and malformed-ACK rejection.
  4. Minimize the lockfile diff: rebased package-lock.json on main and merged in only the patch-package dependency closure, dropping the unrelated peer/optional flag churn from regenerating the whole lockfile with a different npm version. The diff is now purely additive (+351 lines).

Verification

  • npm ci from scratch: patch applies, @electron/rebuild compiles bindings-cpp from the patched source, and the runtime loads build/Release/bindings.node (verified by hash against the shipped prebuilds).
  • tsc --noEmit passes.
  • Full test suite: 115/115 pass (101 existing + 14 new).
Open in Web Open in Cursor 

Alxkcx and others added 4 commits August 17, 2026 14:24
- strip ANSI color codes and recognize ESP-IDF log lines
  (e.g. 'W (4652) BT_HCI: ...') so ACKs polluted by device logs parse
  correctly instead of being treated as malformed and triggering retry/reset
- when an ACK line is mixed with an embedded device log line, re-parse the
  ACK portion before dropping the line so the ACK is never lost
- patch @serialport/bindings-cpp unix-read with a 50ms poller fallback:
  on Linux the poller readable event can be missed (shared uv_poll,
  overriding registration), leaving serial data stranded in the fd for
  2-6s until the next device output arrives; the fallback re-tries fs.read
  so data is always read within 50ms

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- apply serialport/bindings-cpp#239 to deliver poller callbacks immediately
- keep the patch-package override on the native poller source
- strip complete common ANSI escape sequences before ACK parsing
- preserve ESP-IDF log recognition and mixed-line ACK recovery

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ling

Recognizing ESP-IDF log lines made sanitizeDeviceLine keep mixed
log-before-ACK lines intact, which skipped the old tail-ACK fallback and
dropped those ACKs as plain device logs. Extract a trailing sequenced
ACK from device log lines in waitForAck, forward the leading log
segment, and route both mixed-line paths through a shared
handleSequencedAck helper. Cover the line sanitizing and mixed-line ACK
recovery with unit tests.

Co-authored-by: Woodii <Woodii1998@users.noreply.github.com>
Rebase the lockfile on main and merge in only the patch-package
dependency closure, dropping the unrelated peer/optional flag churn
introduced by regenerating the whole lockfile with a different npm
version.

Co-authored-by: Woodii <Woodii1998@users.noreply.github.com>
@cursor
cursor Bot changed the base branch from main to cursor/tmp-rebase-trigger-6fe8 August 19, 2026 07:19
@cursor
cursor Bot changed the base branch from cursor/tmp-rebase-trigger-6fe8 to main August 19, 2026 07:19
@Woodii1998
Woodii1998 marked this pull request as ready for review August 19, 2026 07:20
@Woodii1998 Woodii1998 closed this Aug 19, 2026
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.

3 participants