docs: add comprehensive docstrings to ipc_common module - #24

Merged
wilcorrea merged 1 commit into
mainfrom
docs/ipc-common-docstrings
Feb 25, 2026
Merged

docs: add comprehensive docstrings to ipc_common module#24
wilcorrea merged 1 commit into
mainfrom
docs/ipc-common-docstrings

Conversation

@iguit0

@iguit0iguit0 commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds module-level, struct-level, field-level, and function-level Rust docstrings to ipc_common.rs 
  • Brings documentation coverage from ~33% to 100%, exceeding the 80% threshold flagged by CodeRabbit

What’s documented

  • Module-level //! block: Purpose, wire protocol (newline-delimited JSON), supported commands table, platform compatibility notes
  • IpcCommand struct + fields: JSON examples, field descriptions (command name, optional path)
  • IpcResponse struct + fields: JSON examples, success/error semantics, serialization behavior
  • process_command() function: All three command variants ( open , ping , show ), parameters, return value, and error cases

Test plan

  • Verify cargo doc generates the expected documentation
  • Confirm CodeRabbit docstring coverage check passes (≥80%)

Closes#18

Summary by CodeRabbit

  • New Features
    • Enabled inter-process communication system supporting file operations, window management, and application commands
    • Added robust error handling for invalid file paths and missing resources
    • Implemented command processing for seamless operation handling

Add module-level, struct-level, field-level, and function-level
documentation to ipc_common.rs to meet the 80% docstring coverage
threshold flagged by CodeRabbit.
Documents the wire protocol (newline-delimited JSON), all three
supported IPC commands (open, ping, show), platform compatibility
notes, and JSON examples for both IpcCommand and IpcResponse.
Closes#18
@coderabbitai

coderabbitaiBot commented Feb 25, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This change introduces a public IPC command system in the ipc_common.rs module by exposing IpcCommand and IpcResponse structures alongside a process_command() function. The implementation handles three commands ("open", "ping", "show") with associated behaviors including path canonicalization, window focus management, and event emission.

Changes

Cohort / File(s)Summary
Shared IPC Command System
apps/tauri/src-tauri/src/ipc_common.rs
Added public IpcCommand struct with command and optional path fields, public IpcResponse struct with success flag and optional error message, and public process_command() function that dispatches "open", "ping", and "show" commands with path canonicalization, window focus management, and error handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

Possibly related PRs

Poem

🐰 A shared IPC path now gleams so bright,
With commands hopping left and right,
Public structs that talk and play,
Processes ping throughout the day!
Thump thump goes the dev's delight! 🎉

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check nameStatusExplanationResolution
Title check⚠️ WarningThe PR title states it adds docstrings, but the actual changes include new public API structures (IpcCommand, IpcResponse, process_command function) beyond documentation.Update the title to reflect the full scope of changes, such as 'feat: add IPC command processing API with comprehensive docstrings' or 'refactor: expose shared IPC API with documentation'.
Out of Scope Changes check⚠️ WarningThe PR introduces new public API structures (IpcCommand, IpcResponse, process_command) that appear to be code changes beyond the documentation-only scope stated in the PR objectives.Clarify whether publicizing the IPC API is intentional. If so, update PR title and objectives to reflect API exposure; if not, separate API changes into a distinct PR.
✅ Passed checks (3 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check✅ PassedThe PR implements all documented requirements from issue #18: module-level docs, struct documentation, function documentation, and docstring coverage improvement to meet 80% threshold.
Docstring Coverage✅ PassedDocstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs/ipc-common-docstrings

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 and usage tips.

@coderabbitaicoderabbitaiBot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
apps/tauri/src-tauri/src/ipc_common.rs (2)

111-111: ⚠️ Potential issue | 🟡 Minor

std::fs::canonicalize fails on non-existent paths — doc and error message could be misleading.

std::fs::canonicalize requires the path to already exist on the filesystem (it resolves symlinks and calls realpath/GetFullPathName under the hood). If a caller passes a syntactically valid but non-existent path, the OS error returned is NotFound, yet the response surfaces as "Invalid path: {e}" — which implies the path string itself is malformed rather than absent.

Two related gaps:

  1. The process_command doc (line 89) says "invalid" path but doesn't note the existence requirement imposed by canonicalize.
  2. The error message "Invalid path: …" conflates "path doesn't exist" with "path is syntactically invalid".

Consider distinguishing the two cases or updating the doc to call out the existence requirement:

💡 Suggested improvement
 Err(e) => IpcResponse {
success: false,
- error: Some(format!("Invalid path: {}", e)),+ error: Some(format!("Path not found or inaccessible: {}", e)),
},

And in the docstring:

-/// Returns an error if the path is missing, invalid, or the event-/// fails to emit.+/// Returns an error if the path field is absent, the path does not exist on+/// disk (or is otherwise inaccessible to `std::fs::canonicalize`), or the+/// event fails to emit.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/tauri/src-tauri/src/ipc_common.rs` at line 111, Update the
process_command documentation to state that std::fs::canonicalize requires the
path to exist (it resolves symlinks/real paths) and then change the canonicalize
error handling in the match where std::fs::canonicalize(&path) is called: detect
io::ErrorKind::NotFound and return an explicit "path does not exist" error
message, while preserving a separate "invalid path" or generic message for other
error kinds; reference the process_command docstring and the canonicalize match
branch to make the two cases distinct.

148-158: ⚠️ Potential issue | 🟡 Minor

show silently no-ops and returns success: true when the main window is absent.

If get_webview_window("main") returns None (e.g., during app teardown or if the window label changes), the show command does nothing at all yet still reports success. The doc accurately says "Always returns success: true", but the behavior is a silent no-op that callers cannot distinguish from a genuine window-focus operation.

The same pattern exists in the open branch (lines 115–119): window focus is silently skipped if the window isn't found, yet the open-file event is still emitted — which could cause the frontend to try to open a file in a hidden/minimized window.

Consider returning an error (or at minimum logging a warning) when the window cannot be found:

💡 Suggested improvement for `show`
 "show" => {
- if let Some(window) = app.get_webview_window("main") {- let _ = window.unminimize();- let _ = window.show();- let _ = window.set_focus();+ match app.get_webview_window("main") {+ Some(window) => {+ let _ = window.unminimize();+ let _ = window.show();+ let _ = window.set_focus();+ }+ None => {+ return IpcResponse {+ success: false,+ error: Some("Main window not found".to_string()),+ };+ }
}
IpcResponse {
success: true,
error: None,
}
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/tauri/src-tauri/src/ipc_common.rs` around lines 148 - 158, The "show"
branch currently silently no-ops and returns IpcResponse { success: true } when
app.get_webview_window("main") is None; change this so that when
get_webview_window("main") returns None you either return IpcResponse with
success: false and an explanatory error message or at minimum log a warning
before returning success=false; update the same pattern in the "open" branch
(where the open-file event is emitted) to detect a missing window and return an
error/log instead of proceeding silently. Locate the branches using
get_webview_window("main") and the IpcResponse construction to implement the
check and adjust return values/messages accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@apps/tauri/src-tauri/src/ipc_common.rs`:
- Line 111: Update the process_command documentation to state that
std::fs::canonicalize requires the path to exist (it resolves symlinks/real
paths) and then change the canonicalize error handling in the match where
std::fs::canonicalize(&path) is called: detect io::ErrorKind::NotFound and
return an explicit "path does not exist" error message, while preserving a
separate "invalid path" or generic message for other error kinds; reference the
process_command docstring and the canonicalize match branch to make the two
cases distinct.
- Around line 148-158: The "show" branch currently silently no-ops and returns
IpcResponse { success: true } when app.get_webview_window("main") is None;
change this so that when get_webview_window("main") returns None you either
return IpcResponse with success: false and an explanatory error message or at
minimum log a warning before returning success=false; update the same pattern in
the "open" branch (where the open-file event is emitted) to detect a missing
window and return an error/log instead of proceeding silently. Locate the
branches using get_webview_window("main") and the IpcResponse construction to
implement the check and adjust return values/messages accordingly.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a218d4b and 815adeb.

📒 Files selected for processing (1)
  • apps/tauri/src-tauri/src/ipc_common.rs

@wilcorrea
wilcorrea merged commit c33a952 into mainFeb 25, 2026
1 check passed
@wilcorrea
wilcorrea deleted the docs/ipc-common-docstrings branch February 25, 2026 08:21
Sign up for freeto 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.

docs: Add docstrings to ipc_common module

2 participants

@iguit0@wilcorrea
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

docs: add comprehensive docstrings to ipc_common module - #24

Merged
wilcorrea merged 1 commit into
mainfrom
docs/ipc-common-docstrings
Feb 25, 2026
Merged

docs: add comprehensive docstrings to ipc_common module#24
wilcorrea merged 1 commit into
mainfrom
docs/ipc-common-docstrings

Conversation

@iguit0

@iguit0iguit0 commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds module-level, struct-level, field-level, and function-level Rust docstrings to ipc_common.rs 
  • Brings documentation coverage from ~33% to 100%, exceeding the 80% threshold flagged by CodeRabbit

What’s documented

  • Module-level //! block: Purpose, wire protocol (newline-delimited JSON), supported commands table, platform compatibility notes
  • IpcCommand struct + fields: JSON examples, field descriptions (command name, optional path)
  • IpcResponse struct + fields: JSON examples, success/error semantics, serialization behavior
  • process_command() function: All three command variants ( open , ping , show ), parameters, return value, and error cases

Test plan

  • Verify cargo doc generates the expected documentation
  • Confirm CodeRabbit docstring coverage check passes (≥80%)

Closes#18

Summary by CodeRabbit

  • New Features
    • Enabled inter-process communication system supporting file operations, window management, and application commands
    • Added robust error handling for invalid file paths and missing resources
    • Implemented command processing for seamless operation handling

Add module-level, struct-level, field-level, and function-level
documentation to ipc_common.rs to meet the 80% docstring coverage
threshold flagged by CodeRabbit.
Documents the wire protocol (newline-delimited JSON), all three
supported IPC commands (open, ping, show), platform compatibility
notes, and JSON examples for both IpcCommand and IpcResponse.
Closes#18
@coderabbitai

coderabbitaiBot commented Feb 25, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This change introduces a public IPC command system in the ipc_common.rs module by exposing IpcCommand and IpcResponse structures alongside a process_command() function. The implementation handles three commands ("open", "ping", "show") with associated behaviors including path canonicalization, window focus management, and event emission.

Changes

Cohort / File(s)Summary
Shared IPC Command System
apps/tauri/src-tauri/src/ipc_common.rs
Added public IpcCommand struct with command and optional path fields, public IpcResponse struct with success flag and optional error message, and public process_command() function that dispatches "open", "ping", and "show" commands with path canonicalization, window focus management, and error handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

Possibly related PRs

Poem

🐰 A shared IPC path now gleams so bright,
With commands hopping left and right,
Public structs that talk and play,
Processes ping throughout the day!
Thump thump goes the dev's delight! 🎉

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check nameStatusExplanationResolution
Title check⚠️ WarningThe PR title states it adds docstrings, but the actual changes include new public API structures (IpcCommand, IpcResponse, process_command function) beyond documentation.Update the title to reflect the full scope of changes, such as 'feat: add IPC command processing API with comprehensive docstrings' or 'refactor: expose shared IPC API with documentation'.
Out of Scope Changes check⚠️ WarningThe PR introduces new public API structures (IpcCommand, IpcResponse, process_command) that appear to be code changes beyond the documentation-only scope stated in the PR objectives.Clarify whether publicizing the IPC API is intentional. If so, update PR title and objectives to reflect API exposure; if not, separate API changes into a distinct PR.
✅ Passed checks (3 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check✅ PassedThe PR implements all documented requirements from issue #18: module-level docs, struct documentation, function documentation, and docstring coverage improvement to meet 80% threshold.
Docstring Coverage✅ PassedDocstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs/ipc-common-docstrings

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 and usage tips.

@coderabbitaicoderabbitaiBot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
apps/tauri/src-tauri/src/ipc_common.rs (2)

111-111: ⚠️ Potential issue | 🟡 Minor

std::fs::canonicalize fails on non-existent paths — doc and error message could be misleading.

std::fs::canonicalize requires the path to already exist on the filesystem (it resolves symlinks and calls realpath/GetFullPathName under the hood). If a caller passes a syntactically valid but non-existent path, the OS error returned is NotFound, yet the response surfaces as "Invalid path: {e}" — which implies the path string itself is malformed rather than absent.

Two related gaps:

  1. The process_command doc (line 89) says "invalid" path but doesn't note the existence requirement imposed by canonicalize.
  2. The error message "Invalid path: …" conflates "path doesn't exist" with "path is syntactically invalid".

Consider distinguishing the two cases or updating the doc to call out the existence requirement:

💡 Suggested improvement
 Err(e) => IpcResponse {
success: false,
- error: Some(format!("Invalid path: {}", e)),+ error: Some(format!("Path not found or inaccessible: {}", e)),
},

And in the docstring:

-/// Returns an error if the path is missing, invalid, or the event-/// fails to emit.+/// Returns an error if the path field is absent, the path does not exist on+/// disk (or is otherwise inaccessible to `std::fs::canonicalize`), or the+/// event fails to emit.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/tauri/src-tauri/src/ipc_common.rs` at line 111, Update the
process_command documentation to state that std::fs::canonicalize requires the
path to exist (it resolves symlinks/real paths) and then change the canonicalize
error handling in the match where std::fs::canonicalize(&path) is called: detect
io::ErrorKind::NotFound and return an explicit "path does not exist" error
message, while preserving a separate "invalid path" or generic message for other
error kinds; reference the process_command docstring and the canonicalize match
branch to make the two cases distinct.

148-158: ⚠️ Potential issue | 🟡 Minor

show silently no-ops and returns success: true when the main window is absent.

If get_webview_window("main") returns None (e.g., during app teardown or if the window label changes), the show command does nothing at all yet still reports success. The doc accurately says "Always returns success: true", but the behavior is a silent no-op that callers cannot distinguish from a genuine window-focus operation.

The same pattern exists in the open branch (lines 115–119): window focus is silently skipped if the window isn't found, yet the open-file event is still emitted — which could cause the frontend to try to open a file in a hidden/minimized window.

Consider returning an error (or at minimum logging a warning) when the window cannot be found:

💡 Suggested improvement for `show`
 "show" => {
- if let Some(window) = app.get_webview_window("main") {- let _ = window.unminimize();- let _ = window.show();- let _ = window.set_focus();+ match app.get_webview_window("main") {+ Some(window) => {+ let _ = window.unminimize();+ let _ = window.show();+ let _ = window.set_focus();+ }+ None => {+ return IpcResponse {+ success: false,+ error: Some("Main window not found".to_string()),+ };+ }
}
IpcResponse {
success: true,
error: None,
}
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/tauri/src-tauri/src/ipc_common.rs` around lines 148 - 158, The "show"
branch currently silently no-ops and returns IpcResponse { success: true } when
app.get_webview_window("main") is None; change this so that when
get_webview_window("main") returns None you either return IpcResponse with
success: false and an explanatory error message or at minimum log a warning
before returning success=false; update the same pattern in the "open" branch
(where the open-file event is emitted) to detect a missing window and return an
error/log instead of proceeding silently. Locate the branches using
get_webview_window("main") and the IpcResponse construction to implement the
check and adjust return values/messages accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@apps/tauri/src-tauri/src/ipc_common.rs`:
- Line 111: Update the process_command documentation to state that
std::fs::canonicalize requires the path to exist (it resolves symlinks/real
paths) and then change the canonicalize error handling in the match where
std::fs::canonicalize(&path) is called: detect io::ErrorKind::NotFound and
return an explicit "path does not exist" error message, while preserving a
separate "invalid path" or generic message for other error kinds; reference the
process_command docstring and the canonicalize match branch to make the two
cases distinct.
- Around line 148-158: The "show" branch currently silently no-ops and returns
IpcResponse { success: true } when app.get_webview_window("main") is None;
change this so that when get_webview_window("main") returns None you either
return IpcResponse with success: false and an explanatory error message or at
minimum log a warning before returning success=false; update the same pattern in
the "open" branch (where the open-file event is emitted) to detect a missing
window and return an error/log instead of proceeding silently. Locate the
branches using get_webview_window("main") and the IpcResponse construction to
implement the check and adjust return values/messages accordingly.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a218d4b and 815adeb.

📒 Files selected for processing (1)
  • apps/tauri/src-tauri/src/ipc_common.rs

@wilcorrea
wilcorrea merged commit c33a952 into mainFeb 25, 2026
1 check passed
@wilcorrea
wilcorrea deleted the docs/ipc-common-docstrings branch February 25, 2026 08:21
Sign up for freeto 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.

docs: Add docstrings to ipc_common module

2 participants

@iguit0@wilcorrea
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

docs: add comprehensive docstrings to ipc_common module - #24

Merged
wilcorrea merged 1 commit into
mainfrom
docs/ipc-common-docstrings
Feb 25, 2026
Merged

docs: add comprehensive docstrings to ipc_common module#24
wilcorrea merged 1 commit into
mainfrom
docs/ipc-common-docstrings

Conversation

@iguit0

@iguit0iguit0 commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds module-level, struct-level, field-level, and function-level Rust docstrings to ipc_common.rs 
  • Brings documentation coverage from ~33% to 100%, exceeding the 80% threshold flagged by CodeRabbit

What’s documented

  • Module-level //! block: Purpose, wire protocol (newline-delimited JSON), supported commands table, platform compatibility notes
  • IpcCommand struct + fields: JSON examples, field descriptions (command name, optional path)
  • IpcResponse struct + fields: JSON examples, success/error semantics, serialization behavior
  • process_command() function: All three command variants ( open , ping , show ), parameters, return value, and error cases

Test plan

  • Verify cargo doc generates the expected documentation
  • Confirm CodeRabbit docstring coverage check passes (≥80%)

Closes#18

Summary by CodeRabbit

  • New Features
    • Enabled inter-process communication system supporting file operations, window management, and application commands
    • Added robust error handling for invalid file paths and missing resources
    • Implemented command processing for seamless operation handling

Add module-level, struct-level, field-level, and function-level
documentation to ipc_common.rs to meet the 80% docstring coverage
threshold flagged by CodeRabbit.
Documents the wire protocol (newline-delimited JSON), all three
supported IPC commands (open, ping, show), platform compatibility
notes, and JSON examples for both IpcCommand and IpcResponse.
Closes#18
@coderabbitai

coderabbitaiBot commented Feb 25, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This change introduces a public IPC command system in the ipc_common.rs module by exposing IpcCommand and IpcResponse structures alongside a process_command() function. The implementation handles three commands ("open", "ping", "show") with associated behaviors including path canonicalization, window focus management, and event emission.

Changes

Cohort / File(s)Summary
Shared IPC Command System
apps/tauri/src-tauri/src/ipc_common.rs
Added public IpcCommand struct with command and optional path fields, public IpcResponse struct with success flag and optional error message, and public process_command() function that dispatches "open", "ping", and "show" commands with path canonicalization, window focus management, and error handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

Possibly related PRs

Poem

🐰 A shared IPC path now gleams so bright,
With commands hopping left and right,
Public structs that talk and play,
Processes ping throughout the day!
Thump thump goes the dev's delight! 🎉

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check nameStatusExplanationResolution
Title check⚠️ WarningThe PR title states it adds docstrings, but the actual changes include new public API structures (IpcCommand, IpcResponse, process_command function) beyond documentation.Update the title to reflect the full scope of changes, such as 'feat: add IPC command processing API with comprehensive docstrings' or 'refactor: expose shared IPC API with documentation'.
Out of Scope Changes check⚠️ WarningThe PR introduces new public API structures (IpcCommand, IpcResponse, process_command) that appear to be code changes beyond the documentation-only scope stated in the PR objectives.Clarify whether publicizing the IPC API is intentional. If so, update PR title and objectives to reflect API exposure; if not, separate API changes into a distinct PR.
✅ Passed checks (3 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check✅ PassedThe PR implements all documented requirements from issue #18: module-level docs, struct documentation, function documentation, and docstring coverage improvement to meet 80% threshold.
Docstring Coverage✅ PassedDocstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs/ipc-common-docstrings

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 and usage tips.

@coderabbitaicoderabbitaiBot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
apps/tauri/src-tauri/src/ipc_common.rs (2)

111-111: ⚠️ Potential issue | 🟡 Minor

std::fs::canonicalize fails on non-existent paths — doc and error message could be misleading.

std::fs::canonicalize requires the path to already exist on the filesystem (it resolves symlinks and calls realpath/GetFullPathName under the hood). If a caller passes a syntactically valid but non-existent path, the OS error returned is NotFound, yet the response surfaces as "Invalid path: {e}" — which implies the path string itself is malformed rather than absent.

Two related gaps:

  1. The process_command doc (line 89) says "invalid" path but doesn't note the existence requirement imposed by canonicalize.
  2. The error message "Invalid path: …" conflates "path doesn't exist" with "path is syntactically invalid".

Consider distinguishing the two cases or updating the doc to call out the existence requirement:

💡 Suggested improvement
 Err(e) => IpcResponse {
success: false,
- error: Some(format!("Invalid path: {}", e)),+ error: Some(format!("Path not found or inaccessible: {}", e)),
},

And in the docstring:

-/// Returns an error if the path is missing, invalid, or the event-/// fails to emit.+/// Returns an error if the path field is absent, the path does not exist on+/// disk (or is otherwise inaccessible to `std::fs::canonicalize`), or the+/// event fails to emit.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/tauri/src-tauri/src/ipc_common.rs` at line 111, Update the
process_command documentation to state that std::fs::canonicalize requires the
path to exist (it resolves symlinks/real paths) and then change the canonicalize
error handling in the match where std::fs::canonicalize(&path) is called: detect
io::ErrorKind::NotFound and return an explicit "path does not exist" error
message, while preserving a separate "invalid path" or generic message for other
error kinds; reference the process_command docstring and the canonicalize match
branch to make the two cases distinct.

148-158: ⚠️ Potential issue | 🟡 Minor

show silently no-ops and returns success: true when the main window is absent.

If get_webview_window("main") returns None (e.g., during app teardown or if the window label changes), the show command does nothing at all yet still reports success. The doc accurately says "Always returns success: true", but the behavior is a silent no-op that callers cannot distinguish from a genuine window-focus operation.

The same pattern exists in the open branch (lines 115–119): window focus is silently skipped if the window isn't found, yet the open-file event is still emitted — which could cause the frontend to try to open a file in a hidden/minimized window.

Consider returning an error (or at minimum logging a warning) when the window cannot be found:

💡 Suggested improvement for `show`
 "show" => {
- if let Some(window) = app.get_webview_window("main") {- let _ = window.unminimize();- let _ = window.show();- let _ = window.set_focus();+ match app.get_webview_window("main") {+ Some(window) => {+ let _ = window.unminimize();+ let _ = window.show();+ let _ = window.set_focus();+ }+ None => {+ return IpcResponse {+ success: false,+ error: Some("Main window not found".to_string()),+ };+ }
}
IpcResponse {
success: true,
error: None,
}
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/tauri/src-tauri/src/ipc_common.rs` around lines 148 - 158, The "show"
branch currently silently no-ops and returns IpcResponse { success: true } when
app.get_webview_window("main") is None; change this so that when
get_webview_window("main") returns None you either return IpcResponse with
success: false and an explanatory error message or at minimum log a warning
before returning success=false; update the same pattern in the "open" branch
(where the open-file event is emitted) to detect a missing window and return an
error/log instead of proceeding silently. Locate the branches using
get_webview_window("main") and the IpcResponse construction to implement the
check and adjust return values/messages accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@apps/tauri/src-tauri/src/ipc_common.rs`:
- Line 111: Update the process_command documentation to state that
std::fs::canonicalize requires the path to exist (it resolves symlinks/real
paths) and then change the canonicalize error handling in the match where
std::fs::canonicalize(&path) is called: detect io::ErrorKind::NotFound and
return an explicit "path does not exist" error message, while preserving a
separate "invalid path" or generic message for other error kinds; reference the
process_command docstring and the canonicalize match branch to make the two
cases distinct.
- Around line 148-158: The "show" branch currently silently no-ops and returns
IpcResponse { success: true } when app.get_webview_window("main") is None;
change this so that when get_webview_window("main") returns None you either
return IpcResponse with success: false and an explanatory error message or at
minimum log a warning before returning success=false; update the same pattern in
the "open" branch (where the open-file event is emitted) to detect a missing
window and return an error/log instead of proceeding silently. Locate the
branches using get_webview_window("main") and the IpcResponse construction to
implement the check and adjust return values/messages accordingly.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a218d4b and 815adeb.

📒 Files selected for processing (1)
  • apps/tauri/src-tauri/src/ipc_common.rs

@wilcorrea
wilcorrea merged commit c33a952 into mainFeb 25, 2026
1 check passed
@wilcorrea
wilcorrea deleted the docs/ipc-common-docstrings branch February 25, 2026 08:21
Sign up for freeto 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.

docs: Add docstrings to ipc_common module

2 participants

@iguit0@wilcorrea
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

docs: add comprehensive docstrings to ipc_common module - #24

Merged
wilcorrea merged 1 commit into
mainfrom
docs/ipc-common-docstrings
Feb 25, 2026
Merged

docs: add comprehensive docstrings to ipc_common module#24
wilcorrea merged 1 commit into
mainfrom
docs/ipc-common-docstrings

Conversation

@iguit0

@iguit0iguit0 commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds module-level, struct-level, field-level, and function-level Rust docstrings to ipc_common.rs 
  • Brings documentation coverage from ~33% to 100%, exceeding the 80% threshold flagged by CodeRabbit

What’s documented

  • Module-level //! block: Purpose, wire protocol (newline-delimited JSON), supported commands table, platform compatibility notes
  • IpcCommand struct + fields: JSON examples, field descriptions (command name, optional path)
  • IpcResponse struct + fields: JSON examples, success/error semantics, serialization behavior
  • process_command() function: All three command variants ( open , ping , show ), parameters, return value, and error cases

Test plan

  • Verify cargo doc generates the expected documentation
  • Confirm CodeRabbit docstring coverage check passes (≥80%)

Closes#18

Summary by CodeRabbit

  • New Features
    • Enabled inter-process communication system supporting file operations, window management, and application commands
    • Added robust error handling for invalid file paths and missing resources
    • Implemented command processing for seamless operation handling

Add module-level, struct-level, field-level, and function-level
documentation to ipc_common.rs to meet the 80% docstring coverage
threshold flagged by CodeRabbit.
Documents the wire protocol (newline-delimited JSON), all three
supported IPC commands (open, ping, show), platform compatibility
notes, and JSON examples for both IpcCommand and IpcResponse.
Closes#18
@coderabbitai

coderabbitaiBot commented Feb 25, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This change introduces a public IPC command system in the ipc_common.rs module by exposing IpcCommand and IpcResponse structures alongside a process_command() function. The implementation handles three commands ("open", "ping", "show") with associated behaviors including path canonicalization, window focus management, and event emission.

Changes

Cohort / File(s)Summary
Shared IPC Command System
apps/tauri/src-tauri/src/ipc_common.rs
Added public IpcCommand struct with command and optional path fields, public IpcResponse struct with success flag and optional error message, and public process_command() function that dispatches "open", "ping", and "show" commands with path canonicalization, window focus management, and error handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

Possibly related PRs

Poem

🐰 A shared IPC path now gleams so bright,
With commands hopping left and right,
Public structs that talk and play,
Processes ping throughout the day!
Thump thump goes the dev's delight! 🎉

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check nameStatusExplanationResolution
Title check⚠️ WarningThe PR title states it adds docstrings, but the actual changes include new public API structures (IpcCommand, IpcResponse, process_command function) beyond documentation.Update the title to reflect the full scope of changes, such as 'feat: add IPC command processing API with comprehensive docstrings' or 'refactor: expose shared IPC API with documentation'.
Out of Scope Changes check⚠️ WarningThe PR introduces new public API structures (IpcCommand, IpcResponse, process_command) that appear to be code changes beyond the documentation-only scope stated in the PR objectives.Clarify whether publicizing the IPC API is intentional. If so, update PR title and objectives to reflect API exposure; if not, separate API changes into a distinct PR.
✅ Passed checks (3 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check✅ PassedThe PR implements all documented requirements from issue #18: module-level docs, struct documentation, function documentation, and docstring coverage improvement to meet 80% threshold.
Docstring Coverage✅ PassedDocstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs/ipc-common-docstrings

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 and usage tips.

@coderabbitaicoderabbitaiBot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
apps/tauri/src-tauri/src/ipc_common.rs (2)

111-111: ⚠️ Potential issue | 🟡 Minor

std::fs::canonicalize fails on non-existent paths — doc and error message could be misleading.

std::fs::canonicalize requires the path to already exist on the filesystem (it resolves symlinks and calls realpath/GetFullPathName under the hood). If a caller passes a syntactically valid but non-existent path, the OS error returned is NotFound, yet the response surfaces as "Invalid path: {e}" — which implies the path string itself is malformed rather than absent.

Two related gaps:

  1. The process_command doc (line 89) says "invalid" path but doesn't note the existence requirement imposed by canonicalize.
  2. The error message "Invalid path: …" conflates "path doesn't exist" with "path is syntactically invalid".

Consider distinguishing the two cases or updating the doc to call out the existence requirement:

💡 Suggested improvement
 Err(e) => IpcResponse {
success: false,
- error: Some(format!("Invalid path: {}", e)),+ error: Some(format!("Path not found or inaccessible: {}", e)),
},

And in the docstring:

-/// Returns an error if the path is missing, invalid, or the event-/// fails to emit.+/// Returns an error if the path field is absent, the path does not exist on+/// disk (or is otherwise inaccessible to `std::fs::canonicalize`), or the+/// event fails to emit.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/tauri/src-tauri/src/ipc_common.rs` at line 111, Update the
process_command documentation to state that std::fs::canonicalize requires the
path to exist (it resolves symlinks/real paths) and then change the canonicalize
error handling in the match where std::fs::canonicalize(&path) is called: detect
io::ErrorKind::NotFound and return an explicit "path does not exist" error
message, while preserving a separate "invalid path" or generic message for other
error kinds; reference the process_command docstring and the canonicalize match
branch to make the two cases distinct.

148-158: ⚠️ Potential issue | 🟡 Minor

show silently no-ops and returns success: true when the main window is absent.

If get_webview_window("main") returns None (e.g., during app teardown or if the window label changes), the show command does nothing at all yet still reports success. The doc accurately says "Always returns success: true", but the behavior is a silent no-op that callers cannot distinguish from a genuine window-focus operation.

The same pattern exists in the open branch (lines 115–119): window focus is silently skipped if the window isn't found, yet the open-file event is still emitted — which could cause the frontend to try to open a file in a hidden/minimized window.

Consider returning an error (or at minimum logging a warning) when the window cannot be found:

💡 Suggested improvement for `show`
 "show" => {
- if let Some(window) = app.get_webview_window("main") {- let _ = window.unminimize();- let _ = window.show();- let _ = window.set_focus();+ match app.get_webview_window("main") {+ Some(window) => {+ let _ = window.unminimize();+ let _ = window.show();+ let _ = window.set_focus();+ }+ None => {+ return IpcResponse {+ success: false,+ error: Some("Main window not found".to_string()),+ };+ }
}
IpcResponse {
success: true,
error: None,
}
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/tauri/src-tauri/src/ipc_common.rs` around lines 148 - 158, The "show"
branch currently silently no-ops and returns IpcResponse { success: true } when
app.get_webview_window("main") is None; change this so that when
get_webview_window("main") returns None you either return IpcResponse with
success: false and an explanatory error message or at minimum log a warning
before returning success=false; update the same pattern in the "open" branch
(where the open-file event is emitted) to detect a missing window and return an
error/log instead of proceeding silently. Locate the branches using
get_webview_window("main") and the IpcResponse construction to implement the
check and adjust return values/messages accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@apps/tauri/src-tauri/src/ipc_common.rs`:
- Line 111: Update the process_command documentation to state that
std::fs::canonicalize requires the path to exist (it resolves symlinks/real
paths) and then change the canonicalize error handling in the match where
std::fs::canonicalize(&path) is called: detect io::ErrorKind::NotFound and
return an explicit "path does not exist" error message, while preserving a
separate "invalid path" or generic message for other error kinds; reference the
process_command docstring and the canonicalize match branch to make the two
cases distinct.
- Around line 148-158: The "show" branch currently silently no-ops and returns
IpcResponse { success: true } when app.get_webview_window("main") is None;
change this so that when get_webview_window("main") returns None you either
return IpcResponse with success: false and an explanatory error message or at
minimum log a warning before returning success=false; update the same pattern in
the "open" branch (where the open-file event is emitted) to detect a missing
window and return an error/log instead of proceeding silently. Locate the
branches using get_webview_window("main") and the IpcResponse construction to
implement the check and adjust return values/messages accordingly.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a218d4b and 815adeb.

📒 Files selected for processing (1)
  • apps/tauri/src-tauri/src/ipc_common.rs

@wilcorrea
wilcorrea merged commit c33a952 into mainFeb 25, 2026
1 check passed
@wilcorrea
wilcorrea deleted the docs/ipc-common-docstrings branch February 25, 2026 08:21
Sign up for freeto 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.

docs: Add docstrings to ipc_common module

2 participants

@iguit0@wilcorrea
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

docs: add comprehensive docstrings to ipc_common module - #24

Merged
wilcorrea merged 1 commit into
mainfrom
docs/ipc-common-docstrings
Feb 25, 2026
Merged

docs: add comprehensive docstrings to ipc_common module#24
wilcorrea merged 1 commit into
mainfrom
docs/ipc-common-docstrings

Conversation

@iguit0

@iguit0iguit0 commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds module-level, struct-level, field-level, and function-level Rust docstrings to ipc_common.rs 
  • Brings documentation coverage from ~33% to 100%, exceeding the 80% threshold flagged by CodeRabbit

What’s documented

  • Module-level //! block: Purpose, wire protocol (newline-delimited JSON), supported commands table, platform compatibility notes
  • IpcCommand struct + fields: JSON examples, field descriptions (command name, optional path)
  • IpcResponse struct + fields: JSON examples, success/error semantics, serialization behavior
  • process_command() function: All three command variants ( open , ping , show ), parameters, return value, and error cases

Test plan

  • Verify cargo doc generates the expected documentation
  • Confirm CodeRabbit docstring coverage check passes (≥80%)

Closes#18

Summary by CodeRabbit

  • New Features
    • Enabled inter-process communication system supporting file operations, window management, and application commands
    • Added robust error handling for invalid file paths and missing resources
    • Implemented command processing for seamless operation handling

Add module-level, struct-level, field-level, and function-level
documentation to ipc_common.rs to meet the 80% docstring coverage
threshold flagged by CodeRabbit.
Documents the wire protocol (newline-delimited JSON), all three
supported IPC commands (open, ping, show), platform compatibility
notes, and JSON examples for both IpcCommand and IpcResponse.
Closes#18
@coderabbitai

coderabbitaiBot commented Feb 25, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This change introduces a public IPC command system in the ipc_common.rs module by exposing IpcCommand and IpcResponse structures alongside a process_command() function. The implementation handles three commands ("open", "ping", "show") with associated behaviors including path canonicalization, window focus management, and event emission.

Changes

Cohort / File(s)Summary
Shared IPC Command System
apps/tauri/src-tauri/src/ipc_common.rs
Added public IpcCommand struct with command and optional path fields, public IpcResponse struct with success flag and optional error message, and public process_command() function that dispatches "open", "ping", and "show" commands with path canonicalization, window focus management, and error handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

Possibly related PRs

Poem

🐰 A shared IPC path now gleams so bright,
With commands hopping left and right,
Public structs that talk and play,
Processes ping throughout the day!
Thump thump goes the dev's delight! 🎉

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check nameStatusExplanationResolution
Title check⚠️ WarningThe PR title states it adds docstrings, but the actual changes include new public API structures (IpcCommand, IpcResponse, process_command function) beyond documentation.Update the title to reflect the full scope of changes, such as 'feat: add IPC command processing API with comprehensive docstrings' or 'refactor: expose shared IPC API with documentation'.
Out of Scope Changes check⚠️ WarningThe PR introduces new public API structures (IpcCommand, IpcResponse, process_command) that appear to be code changes beyond the documentation-only scope stated in the PR objectives.Clarify whether publicizing the IPC API is intentional. If so, update PR title and objectives to reflect API exposure; if not, separate API changes into a distinct PR.
✅ Passed checks (3 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check✅ PassedThe PR implements all documented requirements from issue #18: module-level docs, struct documentation, function documentation, and docstring coverage improvement to meet 80% threshold.
Docstring Coverage✅ PassedDocstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs/ipc-common-docstrings

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 and usage tips.

@coderabbitaicoderabbitaiBot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
apps/tauri/src-tauri/src/ipc_common.rs (2)

111-111: ⚠️ Potential issue | 🟡 Minor

std::fs::canonicalize fails on non-existent paths — doc and error message could be misleading.

std::fs::canonicalize requires the path to already exist on the filesystem (it resolves symlinks and calls realpath/GetFullPathName under the hood). If a caller passes a syntactically valid but non-existent path, the OS error returned is NotFound, yet the response surfaces as "Invalid path: {e}" — which implies the path string itself is malformed rather than absent.

Two related gaps:

  1. The process_command doc (line 89) says "invalid" path but doesn't note the existence requirement imposed by canonicalize.
  2. The error message "Invalid path: …" conflates "path doesn't exist" with "path is syntactically invalid".

Consider distinguishing the two cases or updating the doc to call out the existence requirement:

💡 Suggested improvement
 Err(e) => IpcResponse {
success: false,
- error: Some(format!("Invalid path: {}", e)),+ error: Some(format!("Path not found or inaccessible: {}", e)),
},

And in the docstring:

-/// Returns an error if the path is missing, invalid, or the event-/// fails to emit.+/// Returns an error if the path field is absent, the path does not exist on+/// disk (or is otherwise inaccessible to `std::fs::canonicalize`), or the+/// event fails to emit.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/tauri/src-tauri/src/ipc_common.rs` at line 111, Update the
process_command documentation to state that std::fs::canonicalize requires the
path to exist (it resolves symlinks/real paths) and then change the canonicalize
error handling in the match where std::fs::canonicalize(&path) is called: detect
io::ErrorKind::NotFound and return an explicit "path does not exist" error
message, while preserving a separate "invalid path" or generic message for other
error kinds; reference the process_command docstring and the canonicalize match
branch to make the two cases distinct.

148-158: ⚠️ Potential issue | 🟡 Minor

show silently no-ops and returns success: true when the main window is absent.

If get_webview_window("main") returns None (e.g., during app teardown or if the window label changes), the show command does nothing at all yet still reports success. The doc accurately says "Always returns success: true", but the behavior is a silent no-op that callers cannot distinguish from a genuine window-focus operation.

The same pattern exists in the open branch (lines 115–119): window focus is silently skipped if the window isn't found, yet the open-file event is still emitted — which could cause the frontend to try to open a file in a hidden/minimized window.

Consider returning an error (or at minimum logging a warning) when the window cannot be found:

💡 Suggested improvement for `show`
 "show" => {
- if let Some(window) = app.get_webview_window("main") {- let _ = window.unminimize();- let _ = window.show();- let _ = window.set_focus();+ match app.get_webview_window("main") {+ Some(window) => {+ let _ = window.unminimize();+ let _ = window.show();+ let _ = window.set_focus();+ }+ None => {+ return IpcResponse {+ success: false,+ error: Some("Main window not found".to_string()),+ };+ }
}
IpcResponse {
success: true,
error: None,
}
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/tauri/src-tauri/src/ipc_common.rs` around lines 148 - 158, The "show"
branch currently silently no-ops and returns IpcResponse { success: true } when
app.get_webview_window("main") is None; change this so that when
get_webview_window("main") returns None you either return IpcResponse with
success: false and an explanatory error message or at minimum log a warning
before returning success=false; update the same pattern in the "open" branch
(where the open-file event is emitted) to detect a missing window and return an
error/log instead of proceeding silently. Locate the branches using
get_webview_window("main") and the IpcResponse construction to implement the
check and adjust return values/messages accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@apps/tauri/src-tauri/src/ipc_common.rs`:
- Line 111: Update the process_command documentation to state that
std::fs::canonicalize requires the path to exist (it resolves symlinks/real
paths) and then change the canonicalize error handling in the match where
std::fs::canonicalize(&path) is called: detect io::ErrorKind::NotFound and
return an explicit "path does not exist" error message, while preserving a
separate "invalid path" or generic message for other error kinds; reference the
process_command docstring and the canonicalize match branch to make the two
cases distinct.
- Around line 148-158: The "show" branch currently silently no-ops and returns
IpcResponse { success: true } when app.get_webview_window("main") is None;
change this so that when get_webview_window("main") returns None you either
return IpcResponse with success: false and an explanatory error message or at
minimum log a warning before returning success=false; update the same pattern in
the "open" branch (where the open-file event is emitted) to detect a missing
window and return an error/log instead of proceeding silently. Locate the
branches using get_webview_window("main") and the IpcResponse construction to
implement the check and adjust return values/messages accordingly.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a218d4b and 815adeb.

📒 Files selected for processing (1)
  • apps/tauri/src-tauri/src/ipc_common.rs

@wilcorrea
wilcorrea merged commit c33a952 into mainFeb 25, 2026
1 check passed
@wilcorrea
wilcorrea deleted the docs/ipc-common-docstrings branch February 25, 2026 08:21
Sign up for freeto 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.

docs: Add docstrings to ipc_common module

2 participants

@iguit0@wilcorrea
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

docs: add comprehensive docstrings to ipc_common module - #24

Merged
wilcorrea merged 1 commit into
mainfrom
docs/ipc-common-docstrings
Feb 25, 2026
Merged

docs: add comprehensive docstrings to ipc_common module#24
wilcorrea merged 1 commit into
mainfrom
docs/ipc-common-docstrings

Conversation

@iguit0

@iguit0iguit0 commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds module-level, struct-level, field-level, and function-level Rust docstrings to ipc_common.rs 
  • Brings documentation coverage from ~33% to 100%, exceeding the 80% threshold flagged by CodeRabbit

What’s documented

  • Module-level //! block: Purpose, wire protocol (newline-delimited JSON), supported commands table, platform compatibility notes
  • IpcCommand struct + fields: JSON examples, field descriptions (command name, optional path)
  • IpcResponse struct + fields: JSON examples, success/error semantics, serialization behavior
  • process_command() function: All three command variants ( open , ping , show ), parameters, return value, and error cases

Test plan

  • Verify cargo doc generates the expected documentation
  • Confirm CodeRabbit docstring coverage check passes (≥80%)

Closes#18

Summary by CodeRabbit

  • New Features
    • Enabled inter-process communication system supporting file operations, window management, and application commands
    • Added robust error handling for invalid file paths and missing resources
    • Implemented command processing for seamless operation handling

Add module-level, struct-level, field-level, and function-level
documentation to ipc_common.rs to meet the 80% docstring coverage
threshold flagged by CodeRabbit.
Documents the wire protocol (newline-delimited JSON), all three
supported IPC commands (open, ping, show), platform compatibility
notes, and JSON examples for both IpcCommand and IpcResponse.
Closes#18
@coderabbitai

coderabbitaiBot commented Feb 25, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This change introduces a public IPC command system in the ipc_common.rs module by exposing IpcCommand and IpcResponse structures alongside a process_command() function. The implementation handles three commands ("open", "ping", "show") with associated behaviors including path canonicalization, window focus management, and event emission.

Changes

Cohort / File(s)Summary
Shared IPC Command System
apps/tauri/src-tauri/src/ipc_common.rs
Added public IpcCommand struct with command and optional path fields, public IpcResponse struct with success flag and optional error message, and public process_command() function that dispatches "open", "ping", and "show" commands with path canonicalization, window focus management, and error handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

Possibly related PRs

Poem

🐰 A shared IPC path now gleams so bright,
With commands hopping left and right,
Public structs that talk and play,
Processes ping throughout the day!
Thump thump goes the dev's delight! 🎉

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check nameStatusExplanationResolution
Title check⚠️ WarningThe PR title states it adds docstrings, but the actual changes include new public API structures (IpcCommand, IpcResponse, process_command function) beyond documentation.Update the title to reflect the full scope of changes, such as 'feat: add IPC command processing API with comprehensive docstrings' or 'refactor: expose shared IPC API with documentation'.
Out of Scope Changes check⚠️ WarningThe PR introduces new public API structures (IpcCommand, IpcResponse, process_command) that appear to be code changes beyond the documentation-only scope stated in the PR objectives.Clarify whether publicizing the IPC API is intentional. If so, update PR title and objectives to reflect API exposure; if not, separate API changes into a distinct PR.
✅ Passed checks (3 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check✅ PassedThe PR implements all documented requirements from issue #18: module-level docs, struct documentation, function documentation, and docstring coverage improvement to meet 80% threshold.
Docstring Coverage✅ PassedDocstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs/ipc-common-docstrings

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 and usage tips.

@coderabbitaicoderabbitaiBot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
apps/tauri/src-tauri/src/ipc_common.rs (2)

111-111: ⚠️ Potential issue | 🟡 Minor

std::fs::canonicalize fails on non-existent paths — doc and error message could be misleading.

std::fs::canonicalize requires the path to already exist on the filesystem (it resolves symlinks and calls realpath/GetFullPathName under the hood). If a caller passes a syntactically valid but non-existent path, the OS error returned is NotFound, yet the response surfaces as "Invalid path: {e}" — which implies the path string itself is malformed rather than absent.

Two related gaps:

  1. The process_command doc (line 89) says "invalid" path but doesn't note the existence requirement imposed by canonicalize.
  2. The error message "Invalid path: …" conflates "path doesn't exist" with "path is syntactically invalid".

Consider distinguishing the two cases or updating the doc to call out the existence requirement:

💡 Suggested improvement
 Err(e) => IpcResponse {
success: false,
- error: Some(format!("Invalid path: {}", e)),+ error: Some(format!("Path not found or inaccessible: {}", e)),
},

And in the docstring:

-/// Returns an error if the path is missing, invalid, or the event-/// fails to emit.+/// Returns an error if the path field is absent, the path does not exist on+/// disk (or is otherwise inaccessible to `std::fs::canonicalize`), or the+/// event fails to emit.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/tauri/src-tauri/src/ipc_common.rs` at line 111, Update the
process_command documentation to state that std::fs::canonicalize requires the
path to exist (it resolves symlinks/real paths) and then change the canonicalize
error handling in the match where std::fs::canonicalize(&path) is called: detect
io::ErrorKind::NotFound and return an explicit "path does not exist" error
message, while preserving a separate "invalid path" or generic message for other
error kinds; reference the process_command docstring and the canonicalize match
branch to make the two cases distinct.

148-158: ⚠️ Potential issue | 🟡 Minor

show silently no-ops and returns success: true when the main window is absent.

If get_webview_window("main") returns None (e.g., during app teardown or if the window label changes), the show command does nothing at all yet still reports success. The doc accurately says "Always returns success: true", but the behavior is a silent no-op that callers cannot distinguish from a genuine window-focus operation.

The same pattern exists in the open branch (lines 115–119): window focus is silently skipped if the window isn't found, yet the open-file event is still emitted — which could cause the frontend to try to open a file in a hidden/minimized window.

Consider returning an error (or at minimum logging a warning) when the window cannot be found:

💡 Suggested improvement for `show`
 "show" => {
- if let Some(window) = app.get_webview_window("main") {- let _ = window.unminimize();- let _ = window.show();- let _ = window.set_focus();+ match app.get_webview_window("main") {+ Some(window) => {+ let _ = window.unminimize();+ let _ = window.show();+ let _ = window.set_focus();+ }+ None => {+ return IpcResponse {+ success: false,+ error: Some("Main window not found".to_string()),+ };+ }
}
IpcResponse {
success: true,
error: None,
}
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/tauri/src-tauri/src/ipc_common.rs` around lines 148 - 158, The "show"
branch currently silently no-ops and returns IpcResponse { success: true } when
app.get_webview_window("main") is None; change this so that when
get_webview_window("main") returns None you either return IpcResponse with
success: false and an explanatory error message or at minimum log a warning
before returning success=false; update the same pattern in the "open" branch
(where the open-file event is emitted) to detect a missing window and return an
error/log instead of proceeding silently. Locate the branches using
get_webview_window("main") and the IpcResponse construction to implement the
check and adjust return values/messages accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@apps/tauri/src-tauri/src/ipc_common.rs`:
- Line 111: Update the process_command documentation to state that
std::fs::canonicalize requires the path to exist (it resolves symlinks/real
paths) and then change the canonicalize error handling in the match where
std::fs::canonicalize(&path) is called: detect io::ErrorKind::NotFound and
return an explicit "path does not exist" error message, while preserving a
separate "invalid path" or generic message for other error kinds; reference the
process_command docstring and the canonicalize match branch to make the two
cases distinct.
- Around line 148-158: The "show" branch currently silently no-ops and returns
IpcResponse { success: true } when app.get_webview_window("main") is None;
change this so that when get_webview_window("main") returns None you either
return IpcResponse with success: false and an explanatory error message or at
minimum log a warning before returning success=false; update the same pattern in
the "open" branch (where the open-file event is emitted) to detect a missing
window and return an error/log instead of proceeding silently. Locate the
branches using get_webview_window("main") and the IpcResponse construction to
implement the check and adjust return values/messages accordingly.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a218d4b and 815adeb.

📒 Files selected for processing (1)
  • apps/tauri/src-tauri/src/ipc_common.rs

@wilcorrea
wilcorrea merged commit c33a952 into mainFeb 25, 2026
1 check passed
@wilcorrea
wilcorrea deleted the docs/ipc-common-docstrings branch February 25, 2026 08:21
Sign up for freeto 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.

docs: Add docstrings to ipc_common module

2 participants

@iguit0@wilcorrea
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

docs: add comprehensive docstrings to ipc_common module - #24

Merged
wilcorrea merged 1 commit into
mainfrom
docs/ipc-common-docstrings
Feb 25, 2026
Merged

docs: add comprehensive docstrings to ipc_common module#24
wilcorrea merged 1 commit into
mainfrom
docs/ipc-common-docstrings

Conversation

@iguit0

@iguit0iguit0 commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds module-level, struct-level, field-level, and function-level Rust docstrings to ipc_common.rs 
  • Brings documentation coverage from ~33% to 100%, exceeding the 80% threshold flagged by CodeRabbit

What’s documented

  • Module-level //! block: Purpose, wire protocol (newline-delimited JSON), supported commands table, platform compatibility notes
  • IpcCommand struct + fields: JSON examples, field descriptions (command name, optional path)
  • IpcResponse struct + fields: JSON examples, success/error semantics, serialization behavior
  • process_command() function: All three command variants ( open , ping , show ), parameters, return value, and error cases

Test plan

  • Verify cargo doc generates the expected documentation
  • Confirm CodeRabbit docstring coverage check passes (≥80%)

Closes#18

Summary by CodeRabbit

  • New Features
    • Enabled inter-process communication system supporting file operations, window management, and application commands
    • Added robust error handling for invalid file paths and missing resources
    • Implemented command processing for seamless operation handling

Add module-level, struct-level, field-level, and function-level
documentation to ipc_common.rs to meet the 80% docstring coverage
threshold flagged by CodeRabbit.
Documents the wire protocol (newline-delimited JSON), all three
supported IPC commands (open, ping, show), platform compatibility
notes, and JSON examples for both IpcCommand and IpcResponse.
Closes#18
@coderabbitai

coderabbitaiBot commented Feb 25, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This change introduces a public IPC command system in the ipc_common.rs module by exposing IpcCommand and IpcResponse structures alongside a process_command() function. The implementation handles three commands ("open", "ping", "show") with associated behaviors including path canonicalization, window focus management, and event emission.

Changes

Cohort / File(s)Summary
Shared IPC Command System
apps/tauri/src-tauri/src/ipc_common.rs
Added public IpcCommand struct with command and optional path fields, public IpcResponse struct with success flag and optional error message, and public process_command() function that dispatches "open", "ping", and "show" commands with path canonicalization, window focus management, and error handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

Possibly related PRs

Poem

🐰 A shared IPC path now gleams so bright,
With commands hopping left and right,
Public structs that talk and play,
Processes ping throughout the day!
Thump thump goes the dev's delight! 🎉

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check nameStatusExplanationResolution
Title check⚠️ WarningThe PR title states it adds docstrings, but the actual changes include new public API structures (IpcCommand, IpcResponse, process_command function) beyond documentation.Update the title to reflect the full scope of changes, such as 'feat: add IPC command processing API with comprehensive docstrings' or 'refactor: expose shared IPC API with documentation'.
Out of Scope Changes check⚠️ WarningThe PR introduces new public API structures (IpcCommand, IpcResponse, process_command) that appear to be code changes beyond the documentation-only scope stated in the PR objectives.Clarify whether publicizing the IPC API is intentional. If so, update PR title and objectives to reflect API exposure; if not, separate API changes into a distinct PR.
✅ Passed checks (3 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check✅ PassedThe PR implements all documented requirements from issue #18: module-level docs, struct documentation, function documentation, and docstring coverage improvement to meet 80% threshold.
Docstring Coverage✅ PassedDocstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs/ipc-common-docstrings

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 and usage tips.

@coderabbitaicoderabbitaiBot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
apps/tauri/src-tauri/src/ipc_common.rs (2)

111-111: ⚠️ Potential issue | 🟡 Minor

std::fs::canonicalize fails on non-existent paths — doc and error message could be misleading.

std::fs::canonicalize requires the path to already exist on the filesystem (it resolves symlinks and calls realpath/GetFullPathName under the hood). If a caller passes a syntactically valid but non-existent path, the OS error returned is NotFound, yet the response surfaces as "Invalid path: {e}" — which implies the path string itself is malformed rather than absent.

Two related gaps:

  1. The process_command doc (line 89) says "invalid" path but doesn't note the existence requirement imposed by canonicalize.
  2. The error message "Invalid path: …" conflates "path doesn't exist" with "path is syntactically invalid".

Consider distinguishing the two cases or updating the doc to call out the existence requirement:

💡 Suggested improvement
 Err(e) => IpcResponse {
success: false,
- error: Some(format!("Invalid path: {}", e)),+ error: Some(format!("Path not found or inaccessible: {}", e)),
},

And in the docstring:

-/// Returns an error if the path is missing, invalid, or the event-/// fails to emit.+/// Returns an error if the path field is absent, the path does not exist on+/// disk (or is otherwise inaccessible to `std::fs::canonicalize`), or the+/// event fails to emit.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/tauri/src-tauri/src/ipc_common.rs` at line 111, Update the
process_command documentation to state that std::fs::canonicalize requires the
path to exist (it resolves symlinks/real paths) and then change the canonicalize
error handling in the match where std::fs::canonicalize(&path) is called: detect
io::ErrorKind::NotFound and return an explicit "path does not exist" error
message, while preserving a separate "invalid path" or generic message for other
error kinds; reference the process_command docstring and the canonicalize match
branch to make the two cases distinct.

148-158: ⚠️ Potential issue | 🟡 Minor

show silently no-ops and returns success: true when the main window is absent.

If get_webview_window("main") returns None (e.g., during app teardown or if the window label changes), the show command does nothing at all yet still reports success. The doc accurately says "Always returns success: true", but the behavior is a silent no-op that callers cannot distinguish from a genuine window-focus operation.

The same pattern exists in the open branch (lines 115–119): window focus is silently skipped if the window isn't found, yet the open-file event is still emitted — which could cause the frontend to try to open a file in a hidden/minimized window.

Consider returning an error (or at minimum logging a warning) when the window cannot be found:

💡 Suggested improvement for `show`
 "show" => {
- if let Some(window) = app.get_webview_window("main") {- let _ = window.unminimize();- let _ = window.show();- let _ = window.set_focus();+ match app.get_webview_window("main") {+ Some(window) => {+ let _ = window.unminimize();+ let _ = window.show();+ let _ = window.set_focus();+ }+ None => {+ return IpcResponse {+ success: false,+ error: Some("Main window not found".to_string()),+ };+ }
}
IpcResponse {
success: true,
error: None,
}
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/tauri/src-tauri/src/ipc_common.rs` around lines 148 - 158, The "show"
branch currently silently no-ops and returns IpcResponse { success: true } when
app.get_webview_window("main") is None; change this so that when
get_webview_window("main") returns None you either return IpcResponse with
success: false and an explanatory error message or at minimum log a warning
before returning success=false; update the same pattern in the "open" branch
(where the open-file event is emitted) to detect a missing window and return an
error/log instead of proceeding silently. Locate the branches using
get_webview_window("main") and the IpcResponse construction to implement the
check and adjust return values/messages accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@apps/tauri/src-tauri/src/ipc_common.rs`:
- Line 111: Update the process_command documentation to state that
std::fs::canonicalize requires the path to exist (it resolves symlinks/real
paths) and then change the canonicalize error handling in the match where
std::fs::canonicalize(&path) is called: detect io::ErrorKind::NotFound and
return an explicit "path does not exist" error message, while preserving a
separate "invalid path" or generic message for other error kinds; reference the
process_command docstring and the canonicalize match branch to make the two
cases distinct.
- Around line 148-158: The "show" branch currently silently no-ops and returns
IpcResponse { success: true } when app.get_webview_window("main") is None;
change this so that when get_webview_window("main") returns None you either
return IpcResponse with success: false and an explanatory error message or at
minimum log a warning before returning success=false; update the same pattern in
the "open" branch (where the open-file event is emitted) to detect a missing
window and return an error/log instead of proceeding silently. Locate the
branches using get_webview_window("main") and the IpcResponse construction to
implement the check and adjust return values/messages accordingly.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a218d4b and 815adeb.

📒 Files selected for processing (1)
  • apps/tauri/src-tauri/src/ipc_common.rs

@wilcorrea
wilcorrea merged commit c33a952 into mainFeb 25, 2026
1 check passed
@wilcorrea
wilcorrea deleted the docs/ipc-common-docstrings branch February 25, 2026 08:21
Sign up for freeto 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.

docs: Add docstrings to ipc_common module

2 participants

@iguit0@wilcorrea
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

docs: add comprehensive docstrings to ipc_common module - #24

Merged
wilcorrea merged 1 commit into
mainfrom
docs/ipc-common-docstrings
Feb 25, 2026
Merged

docs: add comprehensive docstrings to ipc_common module#24
wilcorrea merged 1 commit into
mainfrom
docs/ipc-common-docstrings

Conversation

@iguit0

@iguit0iguit0 commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds module-level, struct-level, field-level, and function-level Rust docstrings to ipc_common.rs 
  • Brings documentation coverage from ~33% to 100%, exceeding the 80% threshold flagged by CodeRabbit

What’s documented

  • Module-level //! block: Purpose, wire protocol (newline-delimited JSON), supported commands table, platform compatibility notes
  • IpcCommand struct + fields: JSON examples, field descriptions (command name, optional path)
  • IpcResponse struct + fields: JSON examples, success/error semantics, serialization behavior
  • process_command() function: All three command variants ( open , ping , show ), parameters, return value, and error cases

Test plan

  • Verify cargo doc generates the expected documentation
  • Confirm CodeRabbit docstring coverage check passes (≥80%)

Closes#18

Summary by CodeRabbit

  • New Features
    • Enabled inter-process communication system supporting file operations, window management, and application commands
    • Added robust error handling for invalid file paths and missing resources
    • Implemented command processing for seamless operation handling

Add module-level, struct-level, field-level, and function-level
documentation to ipc_common.rs to meet the 80% docstring coverage
threshold flagged by CodeRabbit.
Documents the wire protocol (newline-delimited JSON), all three
supported IPC commands (open, ping, show), platform compatibility
notes, and JSON examples for both IpcCommand and IpcResponse.
Closes#18
@coderabbitai

coderabbitaiBot commented Feb 25, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This change introduces a public IPC command system in the ipc_common.rs module by exposing IpcCommand and IpcResponse structures alongside a process_command() function. The implementation handles three commands ("open", "ping", "show") with associated behaviors including path canonicalization, window focus management, and event emission.

Changes

Cohort / File(s)Summary
Shared IPC Command System
apps/tauri/src-tauri/src/ipc_common.rs
Added public IpcCommand struct with command and optional path fields, public IpcResponse struct with success flag and optional error message, and public process_command() function that dispatches "open", "ping", and "show" commands with path canonicalization, window focus management, and error handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

Possibly related PRs

Poem

🐰 A shared IPC path now gleams so bright,
With commands hopping left and right,
Public structs that talk and play,
Processes ping throughout the day!
Thump thump goes the dev's delight! 🎉

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check nameStatusExplanationResolution
Title check⚠️ WarningThe PR title states it adds docstrings, but the actual changes include new public API structures (IpcCommand, IpcResponse, process_command function) beyond documentation.Update the title to reflect the full scope of changes, such as 'feat: add IPC command processing API with comprehensive docstrings' or 'refactor: expose shared IPC API with documentation'.
Out of Scope Changes check⚠️ WarningThe PR introduces new public API structures (IpcCommand, IpcResponse, process_command) that appear to be code changes beyond the documentation-only scope stated in the PR objectives.Clarify whether publicizing the IPC API is intentional. If so, update PR title and objectives to reflect API exposure; if not, separate API changes into a distinct PR.
✅ Passed checks (3 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check✅ PassedThe PR implements all documented requirements from issue #18: module-level docs, struct documentation, function documentation, and docstring coverage improvement to meet 80% threshold.
Docstring Coverage✅ PassedDocstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs/ipc-common-docstrings

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 and usage tips.

@coderabbitaicoderabbitaiBot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
apps/tauri/src-tauri/src/ipc_common.rs (2)

111-111: ⚠️ Potential issue | 🟡 Minor

std::fs::canonicalize fails on non-existent paths — doc and error message could be misleading.

std::fs::canonicalize requires the path to already exist on the filesystem (it resolves symlinks and calls realpath/GetFullPathName under the hood). If a caller passes a syntactically valid but non-existent path, the OS error returned is NotFound, yet the response surfaces as "Invalid path: {e}" — which implies the path string itself is malformed rather than absent.

Two related gaps:

  1. The process_command doc (line 89) says "invalid" path but doesn't note the existence requirement imposed by canonicalize.
  2. The error message "Invalid path: …" conflates "path doesn't exist" with "path is syntactically invalid".

Consider distinguishing the two cases or updating the doc to call out the existence requirement:

💡 Suggested improvement
 Err(e) => IpcResponse {
success: false,
- error: Some(format!("Invalid path: {}", e)),+ error: Some(format!("Path not found or inaccessible: {}", e)),
},

And in the docstring:

-/// Returns an error if the path is missing, invalid, or the event-/// fails to emit.+/// Returns an error if the path field is absent, the path does not exist on+/// disk (or is otherwise inaccessible to `std::fs::canonicalize`), or the+/// event fails to emit.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/tauri/src-tauri/src/ipc_common.rs` at line 111, Update the
process_command documentation to state that std::fs::canonicalize requires the
path to exist (it resolves symlinks/real paths) and then change the canonicalize
error handling in the match where std::fs::canonicalize(&path) is called: detect
io::ErrorKind::NotFound and return an explicit "path does not exist" error
message, while preserving a separate "invalid path" or generic message for other
error kinds; reference the process_command docstring and the canonicalize match
branch to make the two cases distinct.

148-158: ⚠️ Potential issue | 🟡 Minor

show silently no-ops and returns success: true when the main window is absent.

If get_webview_window("main") returns None (e.g., during app teardown or if the window label changes), the show command does nothing at all yet still reports success. The doc accurately says "Always returns success: true", but the behavior is a silent no-op that callers cannot distinguish from a genuine window-focus operation.

The same pattern exists in the open branch (lines 115–119): window focus is silently skipped if the window isn't found, yet the open-file event is still emitted — which could cause the frontend to try to open a file in a hidden/minimized window.

Consider returning an error (or at minimum logging a warning) when the window cannot be found:

💡 Suggested improvement for `show`
 "show" => {
- if let Some(window) = app.get_webview_window("main") {- let _ = window.unminimize();- let _ = window.show();- let _ = window.set_focus();+ match app.get_webview_window("main") {+ Some(window) => {+ let _ = window.unminimize();+ let _ = window.show();+ let _ = window.set_focus();+ }+ None => {+ return IpcResponse {+ success: false,+ error: Some("Main window not found".to_string()),+ };+ }
}
IpcResponse {
success: true,
error: None,
}
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@apps/tauri/src-tauri/src/ipc_common.rs` around lines 148 - 158, The "show"
branch currently silently no-ops and returns IpcResponse { success: true } when
app.get_webview_window("main") is None; change this so that when
get_webview_window("main") returns None you either return IpcResponse with
success: false and an explanatory error message or at minimum log a warning
before returning success=false; update the same pattern in the "open" branch
(where the open-file event is emitted) to detect a missing window and return an
error/log instead of proceeding silently. Locate the branches using
get_webview_window("main") and the IpcResponse construction to implement the
check and adjust return values/messages accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@apps/tauri/src-tauri/src/ipc_common.rs`:
- Line 111: Update the process_command documentation to state that
std::fs::canonicalize requires the path to exist (it resolves symlinks/real
paths) and then change the canonicalize error handling in the match where
std::fs::canonicalize(&path) is called: detect io::ErrorKind::NotFound and
return an explicit "path does not exist" error message, while preserving a
separate "invalid path" or generic message for other error kinds; reference the
process_command docstring and the canonicalize match branch to make the two
cases distinct.
- Around line 148-158: The "show" branch currently silently no-ops and returns
IpcResponse { success: true } when app.get_webview_window("main") is None;
change this so that when get_webview_window("main") returns None you either
return IpcResponse with success: false and an explanatory error message or at
minimum log a warning before returning success=false; update the same pattern in
the "open" branch (where the open-file event is emitted) to detect a missing
window and return an error/log instead of proceeding silently. Locate the
branches using get_webview_window("main") and the IpcResponse construction to
implement the check and adjust return values/messages accordingly.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a218d4b and 815adeb.

📒 Files selected for processing (1)
  • apps/tauri/src-tauri/src/ipc_common.rs

@wilcorrea
wilcorrea merged commit c33a952 into mainFeb 25, 2026
1 check passed
@wilcorrea
wilcorrea deleted the docs/ipc-common-docstrings branch February 25, 2026 08:21
Sign up for freeto 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.

docs: Add docstrings to ipc_common module

2 participants

@iguit0@wilcorrea