fix: package native watcher in desktop builds#412
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
✅ Files skipped from review due to trivial changes (3)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds native ChangesNative File Watcher Integration (desktop-electron)
Session Sizing & E2E Tests (app)
Sequence Diagram(s)(none) Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Review rate limit: 8/10 reviews remaining, refill in 6 minutes and 3 seconds. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/app/e2e/sidebar/sidebar-session-links.spec.ts (1)
23-23: ⚡ Quick winPrefer shared route assertion helpers over raw slug regexes
These route checks interpolate
slugdirectly in regexes. For cross-platform reliability (notably Windows canonicalization), route assertions should go through the shared helpers in../actionsrather than raw URL regex construction.As per coding guidelines: "When validating routing, assert against canonical or resolved workspace slugs using shared helpers from
../actionsto account for Windows canonicalization."Also applies to: 30-30
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/app/e2e/sidebar/sidebar-session-links.spec.ts` at line 23, The test uses a raw regex with interpolated slug in the page.toHaveURL assertion (expect(page).toHaveURL(new RegExp(`/${slug}/session/${two.id}...`))), which can fail on Windows; replace this by importing and using the shared route assertion/build helper(s) from ../actions (the canonical/resolved workspace slug helper) to construct or assert the session URL for slug and two.id, and update both occurrences (the current line and the similar one at 30) to call that helper instead of building the regex inline so routing checks use the shared canonicalization logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/app/e2e/sidebar/sidebar-session-links.spec.ts`:
- Around line 24-25: Replace the brittle page.waitForTimeout(100) by polling the
observable URL until it stabilizes: after the click, use expect.poll(() =>
page.url()).toMatch(new RegExp(`/${slug}/session/${two.id}(?:\\?|#|$)`)) (or use
expect(page).toHaveURL(...) with an explicit timeout) so the test waits on the
page's URL state instead of a wall-clock sleep; this ensures the URL check for
toHaveURL(new RegExp(`/${slug}/session/${two.id}(?:\\?|#|$)`)) is performed only
when navigation has actually completed.
---
Nitpick comments:
In `@packages/app/e2e/sidebar/sidebar-session-links.spec.ts`:
- Line 23: The test uses a raw regex with interpolated slug in the
page.toHaveURL assertion (expect(page).toHaveURL(new
RegExp(`/${slug}/session/${two.id}...`))), which can fail on Windows; replace
this by importing and using the shared route assertion/build helper(s) from
../actions (the canonical/resolved workspace slug helper) to construct or assert
the session URL for slug and two.id, and update both occurrences (the current
line and the similar one at 30) to call that helper instead of building the
regex inline so routing checks use the shared canonicalization logic.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 0a40d669-a88d-4f44-bff5-99257341d1d2
📒 Files selected for processing (3)
packages/app/e2e/sidebar/sidebar-session-links.spec.tspackages/desktop-electron/electron-builder-app-update.test.tspackages/desktop-electron/electron-builder.config.ts
There was a problem hiding this comment.
Code Review
This pull request introduces dynamic packaging for the @parcel/watcher native binding in the Electron builder configuration and adds a corresponding test case. It also updates E2E tests for sidebar session links. Feedback suggests improving the robustness of platform-specific logic by using a manifest file instead of hardcoded checks and avoiding the use of page.waitForTimeout() in tests to prevent flakiness.
b428958 to
ab85d69
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
packages/app/e2e/sidebar/sidebar-session-links.spec.ts (1)
23-25:⚠️ Potential issue | 🟠 Major | ⚡ Quick winReplace fixed sleep with observable URL stabilization.
Line 24 uses
page.waitForTimeout(100), which is brittle and can still race under slower CI conditions.Suggested change
await expect(page).toHaveURL(new RegExp(`/${slug}/session/${two.id}(?:\\?|#|$)`)) - await page.waitForTimeout(100) - await expect(page).toHaveURL(new RegExp(`/${slug}/session/${two.id}(?:\\?|#|$)`)) + await expect + .poll(() => page.url(), { timeout: 1_000 }) + .toMatch(new RegExp(`/${slug}/session/${two.id}(?:\\?|#|$)`))As per coding guidelines: "Never use wall-clock waits like
page.waitForTimeout(...)to make a test pass" and "Wait on observable state withexpect(...),expect.poll(...), or existing helpers instead of assuming work is finished after an action".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/app/e2e/sidebar/sidebar-session-links.spec.ts` around lines 23 - 25, The test uses a brittle fixed sleep (page.waitForTimeout(100)) between two URL asserts; remove that sleep and instead wait on an observable state — replace the pair of expects and the sleep with a single retryable wait such as using expect(page).toHaveURL(new RegExp(`/${slug}/session/${two.id}(?:\\?|#|$)`), { timeout: ... }) or use expect.poll to assert the page.url() stabilizes to the same RegExp, ensuring you reference the existing identifiers slug and two.id and remove page.waitForTimeout.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/desktop-electron/scripts/prepare-embedded-server.ts`:
- Line 7: The Bun install invocation await $`bun install --cwd ${opencodeRoot}
--os="*" --cpu="*" --frozen-lockfile` will not fetch both glibc and musl
variants; change the script to either (A) use an installer that supports
explicit libc flags (e.g., invoke pnpm or npm with --libc=glibc then
--libc=musl: run pnpm install --dir ${opencodeRoot} --libc=glibc && pnpm install
--dir ${opencodeRoot} --libc=musl to populate both variants) or (B) perform two
Bun installs inside separate containers (one glibc, one musl) to produce
node_modules for each and merge them before the build; update the command that
currently uses bun install (the template string containing ${opencodeRoot}) to
run the chosen dual-libc strategy so both `@parcel/watcher` linux variants are
present.
---
Duplicate comments:
In `@packages/app/e2e/sidebar/sidebar-session-links.spec.ts`:
- Around line 23-25: The test uses a brittle fixed sleep
(page.waitForTimeout(100)) between two URL asserts; remove that sleep and
instead wait on an observable state — replace the pair of expects and the sleep
with a single retryable wait such as using expect(page).toHaveURL(new
RegExp(`/${slug}/session/${two.id}(?:\\?|#|$)`), { timeout: ... }) or use
expect.poll to assert the page.url() stabilizes to the same RegExp, ensuring you
reference the existing identifiers slug and two.id and remove
page.waitForTimeout.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 3f150a23-0664-422b-803c-152d38b8282f
📒 Files selected for processing (8)
packages/app/e2e/commands/panels.spec.tspackages/app/e2e/sidebar/sidebar-session-links.spec.tspackages/app/src/pages/layout.tsxpackages/app/src/pages/session/helpers.test.tspackages/app/src/pages/session/helpers.tspackages/desktop-electron/electron-builder-app-update.test.tspackages/desktop-electron/electron-builder.config.tspackages/desktop-electron/scripts/prepare-embedded-server.ts
✅ Files skipped from review due to trivial changes (1)
- packages/app/src/pages/session/helpers.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/desktop-electron/electron-builder-app-update.test.ts
4dbd7ea to
8491af1
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
packages/app/e2e/sidebar/sidebar-session-links.spec.ts (1)
37-45:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAvoid interpolating
slugdirectly into the route regexp.If
slugever contains regex metacharacters or a non-canonical path form, this assertion can become brittle or match the wrong route. Please verify it is already escaped/canonicalized, or switch to a shared route helper.Verification script
#!/bin/bash rg -n -C3 '\bslug\b|escapeRegExp|waitSession\(' packages/app/e2e packages/app/srcExpected: confirm whether the fixture already normalizes
slugor whether an existing route helper should be used here instead of a rawRegExp.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/app/e2e/sidebar/sidebar-session-links.spec.ts` around lines 37 - 45, The test builds a RegExp for selectedSessionUrl by interpolating slug directly which can break if slug contains regex metacharacters; update the construction used in selectedSessionUrl (and the subsequent expect(page).toHaveURL call and expectUrlToStayMatched usage) to use a canonicalized/escaped slug or a shared route helper instead of raw interpolation—ensure you either escape slug (e.g., via an escapeRegExp utility) before embedding it in the RegExp or replace the RegExp construction with a route helper that returns the correct URL pattern for the session route.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@packages/app/e2e/sidebar/sidebar-session-links.spec.ts`:
- Around line 37-45: The test builds a RegExp for selectedSessionUrl by
interpolating slug directly which can break if slug contains regex
metacharacters; update the construction used in selectedSessionUrl (and the
subsequent expect(page).toHaveURL call and expectUrlToStayMatched usage) to use
a canonicalized/escaped slug or a shared route helper instead of raw
interpolation—ensure you either escape slug (e.g., via an escapeRegExp utility)
before embedding it in the RegExp or replace the RegExp construction with a
route helper that returns the correct URL pattern for the session route.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 8804cdef-3a9b-4d64-b8d6-6e6d6e8f1737
📒 Files selected for processing (8)
packages/app/e2e/commands/panels.spec.tspackages/app/e2e/sidebar/sidebar-session-links.spec.tspackages/app/src/pages/layout.tsxpackages/app/src/pages/session/helpers.test.tspackages/app/src/pages/session/helpers.tspackages/desktop-electron/electron-builder-app-update.test.tspackages/desktop-electron/electron-builder.config.tspackages/desktop-electron/scripts/prepare-embedded-server.ts
✅ Files skipped from review due to trivial changes (2)
- packages/desktop-electron/scripts/prepare-embedded-server.ts
- packages/app/src/pages/session/helpers.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/desktop-electron/electron-builder.config.ts
- packages/app/src/pages/session/helpers.ts
- packages/app/src/pages/layout.tsx
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 `@packages/app/e2e/commands/panels.spec.ts`:
- Around line 44-48: The test is using ID and testid selectors; update the
selectors to use guideline-approved attributes and/or semantic roles: replace
page.locator("#right-panel") (referenced as rightPanel) with a locator using a
data-component or role (e.g., data-component="right-panel" or getByRole if
applicable) and replace
page.locator('[data-testid="right-panel-resize-wrapper"]') with a data-action or
data-component selector (e.g., data-action="resize-right-panel"); if those
attributes don't exist yet, add the corresponding data-component/data-action
attributes to the component that renders the right panel and resize wrapper,
then update the test to use the new selectors and keep the same
interactions/assertions (modKey+Shift+R press,
expect(rightPanel).toHaveAttribute("aria-hidden","false"), and
dispatchEvent("pointerdown") on the new resize locator).
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 8202472b-1955-4ff6-8da5-be6051f122b9
📒 Files selected for processing (8)
packages/app/e2e/commands/panels.spec.tspackages/app/e2e/sidebar/sidebar-session-links.spec.tspackages/app/src/pages/layout.tsxpackages/app/src/pages/session/helpers.test.tspackages/app/src/pages/session/helpers.tspackages/desktop-electron/electron-builder-app-update.test.tspackages/desktop-electron/electron-builder.config.tspackages/desktop-electron/scripts/prepare-embedded-server.ts
✅ Files skipped from review due to trivial changes (1)
- packages/desktop-electron/electron-builder.config.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/desktop-electron/scripts/prepare-embedded-server.ts
- packages/app/src/pages/session/helpers.test.ts
- packages/desktop-electron/electron-builder-app-update.test.ts
8491af1 to
9c9845b
Compare
Summary
Packages all desktop
@parcel/watcher-*native bindings with desktop builds so the embedded sidecar can load its file watcher in packaged apps across macOS, Linux, and Windows targets.Also closes the resize click-deadlock path by making both layout-level sizing and session panel sizing stop on
mouseup,touchend, andtouchcancel, not only pointer events. Sidebar route coverage now verifies both route stability and visible new-session UI.Why
The packaged app log showed the embedded server failing to load
@parcel/watcher-darwin-arm64:That leaves the sidecar without native file watching in packaged builds, which can break session/file refresh behavior.
A second failure mode matched the reported app-wide click symptoms: resize wrappers start sizing on pointer events while
ResizeHandleends drag with mouse events. If sizing never stops, the app can remain in a drag/sizing interaction state after the user releases the mouse.Related Issue
No issue linked. This is an urgent packaged-build and clickability regression found from local app diagnostics.
Human Review Status
Pending. A human should make the final merge decision after reviewing the final diff and verification evidence.
Review Focus
Please check:
prepare-embedded-server.tsinstalling optional packages with--os="*" --cpu="*" --frozen-lockfileis the right build-time hooksizingStopEventscovers the mixed pointer/mouse/touch resize paths without broad behavior changesRisk Notes
Desktop packaging change. The app package includes more native watcher packages than the current host platform needs, trading package size for release safety across target platforms. No runtime behavior change outside packaged resource inclusion and resize sizing cleanup.
How To Verify
Screenshots or Recordings
Not applicable. This is a packaging/runtime fix plus interaction regression coverage, with no visible UI change.
Checklist
dev, and my PR title and commit messages use Conventional Commits in EnglishSummary by CodeRabbit
Tests
Bug Fixes / Improvements
Chores