Fix log slowdown, add scroll to bottom button, upload build artifact for testing#2
Conversation
- Batch serial data in 50ms intervals before sending to webview to prevent IPC message queue flooding at high baud rates - Cancel pending flush and discard buffer on disconnect to prevent queued messages from draining for minutes after device is unplugged - Use requestAnimationFrame for autoscroll to avoid forced layout reflows on every incoming message - Use serialLines.slice(-maxLines) instead of repeated shift() (O(n²)) - Use replaceChildren() for single-DOM-operation node trimming Co-authored-by: h2zero <32826625+h2zero@users.noreply.github.com>
…artifact Co-authored-by: h2zero <32826625+h2zero@users.noreply.github.com>
Removed the publish job from the GitHub Actions workflow.
Co-authored-by: h2zero <32826625+h2zero@users.noreply.github.com>
Co-authored-by: h2zero <32826625+h2zero@users.noreply.github.com>
…rominent Co-authored-by: h2zero <32826625+h2zero@users.noreply.github.com>
…roll flag Co-authored-by: h2zero <32826625+h2zero@users.noreply.github.com>
This reverts commit 1fd7c08.
Co-authored-by: h2zero <32826625+h2zero@users.noreply.github.com>
Co-authored-by: h2zero <32826625+h2zero@users.noreply.github.com>
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughBatches serial data in the extension and sends merged payloads to the webview; adds a scroll-to-bottom UI and RAF-based autoscroll guards; cancels pending serial flushes on disconnect/dispose; updates GitHub Actions to upload the compiled VSIX and make publish depend on build; adds CHANGELOG for v0.6.0. Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Set environment variable for VSCE_TOKEN in the publish step.
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
.github/workflows/build.yml (1)
32-36: Use the uploaded VSIX as the publish input.
publishnow waits forbuild, but it still packages a fresh extension in its own job. That means the Marketplace upload can diverge from theesp-decoder-vsixartifact reviewers download from CI, especially with the current build step deletingpackage-lock.jsonbefore install. Reusing the uploaded artifact here would keep test and release output aligned.Also applies to: 39-43
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/build.yml around lines 32 - 36, The publish job is re-building the VSIX instead of reusing the uploaded artifact, causing possible divergence; modify the workflow so the job that currently recreates the package uses the previously uploaded artifact named "esp-decoder-vsix" (uploaded via the "Upload vsix artifact" step using actions/upload-artifact@v4) as its input; update the "publish" job to add a download-artifact step (actions/download-artifact) to fetch "esp-decoder-vsix" and use that VSIX for Marketplace upload instead of running the packaging steps that delete package-lock.json and repack, ensuring the artifact reviewers download matches what is published.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/webviewPanel.ts`:
- Around line 271-281: The cancelSerialFlush method currently clears the timer
and resets pendingSerialData but doesn't reset the lineBuffer, so buffered bytes
can still be flushed later; modify cancelSerialFlush to also zero/reset
lineBuffer (the same way the existing clear logic does) or call the shared reset
logic used by clear so both pendingSerialData and lineBuffer are cleared and
serialFlushTimer is nulled in cancelSerialFlush.
- Around line 1244-1251: The current DOM trimming uses childNodes.length which
no longer reflects rendered log size; update the trimming logic in
webviewPanel.ts (the block manipulating serialOutput.replaceChildren(...keep))
to enforce a line/character budget instead: compute the total lines/characters
represented by serialOutput.childNodes (or, better, consult the already-trimmed
buffer like serialMonitor.maxLines / the serial monitor's line window if
available), then drop oldest nodes until the budget is satisfied and call
replaceChildren with the remaining nodes; ensure you measure per-node line
counts (or character counts) so a single large node can't bypass the limit and
keep references to symbols serialOutput and serialMonitor.maxLines (or the
monitor's trimmed line buffer) when locating and replacing the logic.
- Around line 123-128: Introduce a connection-generation token (e.g.,
this.serialGen) that is incremented whenever onConnectionChange(false) runs;
capture the current generation at the start of handleSerialData() and
flushSerialData() and ignore any data/timers whose captured generation does not
match the current this.serialGen so late onData callbacks are dropped. In
handleSerialData() store the generation with any buffered work and only
schedule/execute flushSerialData() if the generation matches; in
flushSerialData() verify the generation before sending to the webview. Also
update the "clear" message handler to reset pendingSerialData, clear
serialFlushTimer, and bump the generation so cleared sessions cannot be
repopulated by delayed callbacks. Ensure all references use the existing
method/field names (handleSerialData, flushSerialData, pendingSerialData,
serialFlushTimer, onConnectionChange/clear handler) so the guards are applied
consistently.
---
Nitpick comments:
In @.github/workflows/build.yml:
- Around line 32-36: The publish job is re-building the VSIX instead of reusing
the uploaded artifact, causing possible divergence; modify the workflow so the
job that currently recreates the package uses the previously uploaded artifact
named "esp-decoder-vsix" (uploaded via the "Upload vsix artifact" step using
actions/upload-artifact@v4) as its input; update the "publish" job to add a
download-artifact step (actions/download-artifact) to fetch "esp-decoder-vsix"
and use that VSIX for Marketplace upload instead of running the packaging steps
that delete package-lock.json and repack, ensuring the artifact reviewers
download matches what is published.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 54efc318-0f62-4cc0-a48c-4fe0fbdfaaf5
📒 Files selected for processing (3)
.github/workflows/build.ymlCHANGELOG.mdsrc/webviewPanel.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/build.yml:
- Around line 32-36: The publish job is rebuilding the VSIX instead of using the
CI-produced artifact; update the publish job to download the previously uploaded
artifact (matching the name used in the build job: esp-decoder-vsix) via
actions/download-artifact@v4 and call vsce publish with the --packagePath
pointing to the downloaded esp-decoder-*.vsix (so the publish step consumes the
exact artifact uploaded by the "Upload vsix artifact" step rather than
re-running the package/build steps).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 88778554-21df-4740-ac40-279a7d234936
📒 Files selected for processing (1)
.github/workflows/build.yml
Updated artifact paths and publishing steps in the build workflow.
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
|
@coderabbitai What do you think about: DOM trimming (line 1244): The 10,000-node cap is a reasonable DOM safety limit; the actual line budget is enforced server-side via serialLines/maxLines. No change needed. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chainLet me inspect the relevant code sections before forming an opinion. 🏁 Script executed: Length of output: 3241
DOM trimming (line 1248): Connection-generation token (line 123): Both assessments are well-reasoned — agreed on both counts. ✏️ Learnings added
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/webviewPanel.ts`:
- Around line 1489-1498: The linkifyPaths function currently escapes the whole
text before running the file-path regex, which causes captured file paths (used
for data-file) to contain HTML entities and break file opening; update
linkifyPaths to run the regex against the raw input first to capture the real
file path (from the original text) and only escape values when inserting into
the DOM attributes and visible text (use escapeAttr for data-file/data-line and
escapeHtml for displayed shortFile:line), or perform a two-pass approach:
replace path matches in the raw text with placeholders wrapped in properly
escaped HTML while escaping only the non-matched portions. Ensure this change is
made in the linkifyPaths function and continue to use escapeAttr/escapeHtml for
their respective outputs.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: fed360b1-4f23-4a50-b8a2-8ee53c54364d
📒 Files selected for processing (2)
.github/workflows/build.ymlsrc/webviewPanel.ts
Refactor linkifyPaths function to handle raw text for file paths and ensure HTML entities do not corrupt data-file attributes.
Summary by CodeRabbit
New Features
Changed / Improved
Bug Fixes
Chores