Skip to content

chore: remove Tauri compatibility leftovers#93

Merged
Astro-Han merged 5 commits into
devfrom
codex/chore-remove-tauri
Apr 21, 2026
Merged

chore: remove Tauri compatibility leftovers#93
Astro-Han merged 5 commits into
devfrom
codex/chore-remove-tauri

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Apr 21, 2026

Copy link
Copy Markdown
Owner

Summary

Remove the remaining Tauri-era compatibility surfaces from the GUI-only Electron app:

  • delete the unused Electron-side Tauri data migration module
  • replace stale desktop README Tauri commands with Electron commands
  • rename renderer drag-region attributes from Tauri-specific names to shell-neutral names
  • remove legacy Tauri CORS origins from the embedded server
  • add focused regression tests to keep these Tauri compatibility paths from returning

Why

PawWork is GUI-only and no longer ships a Tauri shell. Keeping stale Tauri compatibility code makes upstream sync and cherry-pick review noisier without preserving a supported product path.

Related Issue

Part of #91.

How To Verify

bun test --cwd packages/desktop-electron src/main/tauri-cleanup.test.ts
bun test --cwd packages/app --preload ./happydom.ts src/components/titlebar-tauri-compat.test.ts
bun test --cwd packages/opencode test/server/cors-middleware.test.ts --timeout 30000
bun run --cwd packages/desktop-electron typecheck
bun run --cwd packages/app typecheck
bun run --cwd packages/ui typecheck
bun run --cwd packages/opencode typecheck
bun run --cwd packages/desktop-electron build
bun run --cwd packages/desktop-electron smoke:ci

Also ran a focused source audit to confirm Tauri strings remain only in the new regression tests.

Screenshots or Recordings

Not included. This cleanup preserves the existing Electron titlebar drag behavior and does not introduce visible UI changes.

Checklist

  • I ran the relevant verification steps
  • I tested visible changes manually when needed
  • I am targeting the dev branch

Summary by CodeRabbit

  • Documentation

    • Updated desktop documentation to reflect the new Electron-based workflow and packaging commands.
  • Refactor

    • Removed legacy platform-specific integrations and migration code.
    • Simplified titlebar behavior and switched drag-region handling to a platform-neutral attribute.
  • Bug Fixes

    • Tightened allowed-origin handling to stop implicitly accepting legacy/native origins.
  • Tests

    • Added tests to verify cleanup, drag-region neutrality, and CORS behavior.

@Astro-Han Astro-Han added enhancement New feature or request P3 Low priority upstream Tracked upstream or vendor behavior platform Electron shell, OS integration, packaging, updater, signing, paths, and permissions labels Apr 21, 2026
@coderabbitai

coderabbitai Bot commented Apr 21, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Removed Tauri-specific integrations across the app: titlebar logic and attributes, CSS drag selectors, a legacy Tauri→Electron migration module, and explicit CORS allowances for Tauri origins; updated docs to reference Electron and added tests ensuring Tauri artifacts are removed.

Changes

Cohort / File(s) Summary
Titlebar & tests
packages/app/src/components/titlebar.tsx, packages/app/src/components/titlebar-tauri-compat.test.ts
Stripped Tauri APIs, theme coupling, and window drag/maximize handlers. Replaced data-tauri-drag-region with data-shell-drag-region. Added test that the titlebar source contains no Tauri references and validates shell-neutral drag-region usage.
UI styles
packages/ui/src/styles/base.css
Replaced CSS selectors targeting data-tauri-drag-region with data-shell-drag-region, preserving app-region: drag / app-region: no-drag rules for interactive elements.
Desktop Electron docs & cleanup
packages/desktop-electron/README.md, packages/desktop-electron/src/main/migrate.ts, packages/desktop-electron/src/main/tauri-cleanup.test.ts
Renamed README references to Electron/PawWork Desktop and updated dev/build/package commands. Deleted the legacy Tauri→Electron migration module. Added tests asserting the migration module is removed and README contains Electron commands (no Tauri).
Server CORS
packages/opencode/src/server/middleware.ts, packages/opencode/test/server/cors-middleware.test.ts
Removed explicit acceptance of legacy Tauri origin strings from CORS origin handling. Added tests verifying localhost origins are allowed while Tauri origins do not receive access-control-allow-origin.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Suggested labels

P2

Poem

🐰 I hopped through code with careful paws,
Nibbled Tauri traces from the drawers.
Now shells unite with neutral flag,
Drag regions sing — no Tauri tag.
Electron hums; the rabbit bows. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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
Title check ✅ Passed The title clearly summarizes the main objective—removing Tauri compatibility code—and is concise and specific.
Description check ✅ Passed The description includes all required template sections: Summary, Why, Related Issue, How To Verify, Screenshots/Recordings, and a completed Checklist.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/chore-remove-tauri

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 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/src/components/titlebar-tauri-compat.test.ts`:
- Around line 3-4: The test reads files into titlebarSource and baseCssSource
using Bun.file(...).text() with a hardcoded relative path
"../../../ui/src/styles/base.css"; update the test to document the expected
monorepo layout (add a brief comment near baseCssSource) and wrap the
Bun.file(...) call for baseCssSource in a defensive check/try-catch that
verifies existence or catches the file-not-found error and throws a clear,
descriptive message indicating the expected path and how to adjust it; keep the
titlebarSource read unchanged but ensure both reads use the same defensive
pattern around Bun.file(...).text() so CI failures show a clear diagnostic
instead of a raw file-not-found.

In `@packages/desktop-electron/src/main/tauri-cleanup.test.ts`:
- Around line 18-19: The test contains two assertions using
expect(readme).not.toMatch(...); remove the redundant, more specific assertion
expect(readme).not.toMatch(/packages\/desktop\s+tauri/) and keep the general
case expect(readme).not.toMatch(/tauri/i) so failures are clearer and not
duplicated; update the test in tauri-cleanup.test.ts by deleting the expect with
/packages\/desktop\s+tauri/.

In `@packages/opencode/test/server/cors-middleware.test.ts`:
- Around line 7-34: Replace raw bun:test "test" usages with the repository's
testEffect harness: import and call testEffect to get "it", then convert the two
tests ("allows localhost browser origins" and "does not allow legacy Tauri
origins") to use it.live or it.effect as appropriate and wrap their bodies in
Effect.gen(function* () { ... }); inside each generator yield the
Server.Default() service to obtain app (referencing Server.Default().app) and
perform the same app.request("/global/health", { headers: { Origin: ... } })
checks; keep the same assertions on response.status and
response.headers.get("access-control-allow-origin") but run them inside the
Effect.gen context so tests use the shared effect runtime and service injection
pattern.
🪄 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: ASSERTIVE

Plan: Pro Plus

Run ID: 530737f6-e348-47cb-b5e2-9c2cf7054896

📥 Commits

Reviewing files that changed from the base of the PR and between 4fed0ca and 1b849f8.

📒 Files selected for processing (8)
  • packages/app/src/components/titlebar-tauri-compat.test.ts
  • packages/app/src/components/titlebar.tsx
  • packages/desktop-electron/README.md
  • packages/desktop-electron/src/main/migrate.ts
  • packages/desktop-electron/src/main/tauri-cleanup.test.ts
  • packages/opencode/src/server/middleware.ts
  • packages/opencode/test/server/cors-middleware.test.ts
  • packages/ui/src/styles/base.css
💤 Files with no reviewable changes (2)
  • packages/opencode/src/server/middleware.ts
  • packages/desktop-electron/src/main/migrate.ts

Comment thread packages/app/src/components/titlebar-tauri-compat.test.ts Outdated
Comment thread packages/desktop-electron/src/main/tauri-cleanup.test.ts Outdated
Comment thread packages/opencode/test/server/cors-middleware.test.ts Outdated

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request migrates the desktop application from Tauri to Electron by removing Tauri-specific APIs, types, and configurations across the codebase. Key changes include updating the titlebar component to use shell-neutral drag regions, removing Tauri-specific CORS origins, and updating the desktop documentation and build scripts. New tests have been added to verify the cleanup of Tauri references. Feedback suggests removing a redundant drag region attribute in the titlebar and refining a broad regex check in the cleanup tests to avoid potential false positives in the future.

Comment thread packages/app/src/components/titlebar.tsx Outdated
Comment thread packages/desktop-electron/src/main/tauri-cleanup.test.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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/opencode/test/server/cors-middleware.test.ts`:
- Around line 15-23: The test unnecessarily wraps an existing promise with
Promise.resolve inside Effect.promise; update the calls that use
Effect.promise(() => Promise.resolve(app.request(...))) to instead call
Effect.promise(() => app.request(...)) (remove the Promise.resolve wrapper) for
the instances that call app.request with Origin header (both occurrences around
the app.request("/global/health", ...) and the other similar call), ensuring you
only remove the redundant wrapper and leave the Effect.promise and app.request
usage and headers intact.
🪄 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: ASSERTIVE

Plan: Pro Plus

Run ID: 08216b82-365e-451c-b1d3-2e5345e77ed7

📥 Commits

Reviewing files that changed from the base of the PR and between 1b849f8 and 68afc72.

📒 Files selected for processing (4)
  • packages/app/src/components/titlebar-tauri-compat.test.ts
  • packages/app/src/components/titlebar.tsx
  • packages/desktop-electron/src/main/tauri-cleanup.test.ts
  • packages/opencode/test/server/cors-middleware.test.ts

Comment thread packages/opencode/test/server/cors-middleware.test.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request P3 Low priority platform Electron shell, OS integration, packaging, updater, signing, paths, and permissions upstream Tracked upstream or vendor behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant