Skip to content

Remove Tauri backend code #511#513

Closed
raman118 wants to merge 1 commit into
AOSSIE-Org:mainfrom
raman118:fix/cleanup-tauri-code
Closed

Remove Tauri backend code #511#513
raman118 wants to merge 1 commit into
AOSSIE-Org:mainfrom
raman118:fix/cleanup-tauri-code

Conversation

@raman118
Copy link
Copy Markdown

@raman118 raman118 commented Sep 12, 2025

Description

This PR removes unwanted Tauri backend code since we've migrated to FastAPI. Changes include:

  • Removed repositories folder and contents
  • Removed services folder (except get_server_path function)
  • Removed utils folder and contents
  • Cleaned up main.rs to keep only essential imports and get_server_path service
  • Deleted models.rs file
  • Updated test files to remove deprecated Tauri tests
  • Removed Tauri test workflow from CI/CD
  • Updated documentation to reflect FastAPI migration

Testing:

  • Verified get_server_path functionality remains intact
  • Confirmed all tests pass
  • Checked documentation accuracy

Fixes #511

Summary by CodeRabbit

  • New Features
    • App now reads a configurable server URL with a safe default for improved connectivity setup.
  • Documentation
    • Added a Frontend Architecture guide with state management details and screenshots of key views.
  • Tests
    • Introduced tests to validate server URL resolution from environment variables and defaults.
  • Refactor
    • Streamlined app initialization by consolidating how the frontend accesses configuration.
  • Chores
    • Updated CI by removing the deprecated Tauri test job from PR checks.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 12, 2025

Walkthrough

Removes the Tauri test job from the PR workflow, adds frontend architecture docs, introduces a Tauri command get_server_path exposed via invoke_handler, and updates Tauri tests to validate this command (including a duplicated test block).

Changes

Cohort / File(s) Summary
GitHub Actions Workflow
.github/workflows/pr-check-tests.yml
Deleted the Tauri test job block; workflow now runs lint, frontend tests, and backend tests only.
Tauri Backend Core
frontend/src-tauri/src/main.rs
Added #[tauri::command] get_server_path returning SERVER_URL or default http://127.0.0.1:8000; registered via tauri::generate_handler!; removed prior service/plugin imports and initializers.
Tauri Tests
frontend/src-tauri/tests/mod_test.rs
Added tests for get_server_path with and without SERVER_URL; simplified imports; duplicated test module appears twice; retained helper scaffolding.
Docs: Frontend Architecture
docs/docs/frontend/architecture.md
Added documentation describing Redux slices (Auth, Image Processing, Settings) and a Screenshots section with described views.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor UI as Frontend (WebView)
  participant Tauri as Tauri Main (main.rs)
  participant Env as Environment

  UI->>Tauri: invoke("get_server_path")
  Tauri->>Env: read SERVER_URL
  alt SERVER_URL set
    Env-->>Tauri: value
    Tauri-->>UI: value
  else not set
    Tauri-->>UI: "http://127.0.0.1:8000"
  end

  note over Tauri,UI: New command exposed via invoke_handler
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

enhancement

Poem

A hop, a skip—goodbye old trails,
New command squeaks, no rusty tales.
Env whispers paths, clear and bright,
Tauri replies: left or right.
Docs nibble Redux in tidy rows—
CI trimmed, and onward it goes. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning Most edits shown are within the scope of issue [#511] (CI workflow removal, main.rs reduction to get_server_path, frontend docs changes), however the duplicated #[cfg(test)] blocks in frontend/src-tauri/tests/mod_test.rs appear to be an unintended or out-of-scope regression that should be removed; no other clearly unrelated modifications are visible in the provided summaries. Remove the duplicated test block and any unrelated test scaffolding in frontend/src-tauri/tests/mod_test.rs (or delete the file if the tests were meant to be removed), verify no other unintended files were modified, and provide an updated diff so reviewers can confirm only intended scope changes remain before merging.
Linked Issues Check ❓ Inconclusive The changes partially address issue [#511]: the Tauri CI job removal, main.rs cleanup retaining get_server_path, and the frontend documentation updates (Redux slices and screenshots) are evident, but the provided per-file summaries do not confirm deletion of the repositories/, utils/, and services/ contents (except get_server_path) or models.rs, and frontend/src-tauri/tests/mod_test.rs still contains duplicated test blocks instead of having unwanted tests removed; because some deletions are claimed in the PR metadata but not verifiable in the raw file summaries, compliance cannot be fully confirmed from the supplied context. Please include or verify the diff/list of deleted paths (repositories/, services/ except get_server_path, utils/, models.rs), remove the duplicate test blocks in frontend/src-tauri/tests/mod_test.rs so only the intended tests remain, and confirm that backend docs were pruned to leave only get_server_path; after updating the PR with these confirmations, re-run CI and update the PR description to cite the actual deleted files.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "Remove Tauri backend code #511" concisely describes the primary change (removing Tauri backend code) and references the related issue, so it clearly communicates the PR's main intent to reviewers without noise or ambiguity.
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Caution

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

⚠️ Outside diff range comments (1)
frontend/src-tauri/src/main.rs (1)

20-55: Leftover builder chain after main; this won’t compile. Remove legacy block.
Stray plugins/setup/invoke_handler/run outside any function and referencing removed services/types.

Apply:

-        .plugin(tauri_plugin_dialog::init())
-        .plugin(tauri_plugin_process::init())
-        .setup(|app| {
-            let file_service = FileService::new();
-            let cache_service = CacheService::new();
-            let resource_path = app
-                .path()
-                .resolve("resources/backend", BaseDirectory::Resource)?;
-            println!("Resource path: {:?}", resource_path);
-            app.manage(file_service);
-            app.manage(cache_service);
-            Ok(())
-        })
-        .invoke_handler(tauri::generate_handler![
-            services::get_folders_with_images,
-            services::get_images_in_folder,
-            services::get_all_images_with_cache,
-            services::get_all_videos_with_cache,
-            services::delete_cache,
-            services::share_file,
-            services::save_edited_image,
-            services::get_server_path,
-            services::move_to_secure_folder,
-            services::create_secure_folder,
-            services::unlock_secure_folder,
-            services::get_secure_media,
-            services::remove_from_secure_folder,
-            services::check_secure_folder_status,
-            services::get_random_memories,
-            services::open_folder,
-            services::open_with,
-            services::set_wallpaper,
-        ])
-        .run(tauri::generate_context!())
-        .expect("error while running tauri application");
-}
+// removed legacy Tauri builder chain and services
🧹 Nitpick comments (3)
docs/docs/frontend/architecture.md (1)

3-15: Optional: link slices to code and note Redux toolkit usage.
Add links to the slice files and indicate if RTK/RTK Query is used for clarity.

frontend/src-tauri/tests/mod_test.rs (2)

1-16: Env var test can be flaky under parallel runner; guard or serialize it.
Rust runs tests in parallel; concurrent SERVER_URL mutation can race if similar tests are added later.

Example (outside this hunk) to guard with a global mutex:

use std::sync::{Mutex, OnceLock};
static ENV_LOCK: OnceLock<Mutex<()>> = OnceLock::new();

#[test]
fn test_get_server_path() {
    let _g = ENV_LOCK.get_or_init(|| Mutex::new(())).lock().unwrap();
    env::set_var("SERVER_URL", "http://test.com");
    assert_eq!(get_server_path(), "http://test.com");

    env::remove_var("SERVER_URL");
    assert_eq!(get_server_path(), "http://127.0.0.1:8000");
}

94-134: Dead test: async fn without #[tokio::test] will never run.
Either add the attribute or remove the function with the broader test cleanup.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d71a3e7 and c93b033.

📒 Files selected for processing (4)
  • .github/workflows/pr-check-tests.yml (0 hunks)
  • docs/docs/frontend/architecture.md (1 hunks)
  • frontend/src-tauri/src/main.rs (1 hunks)
  • frontend/src-tauri/tests/mod_test.rs (2 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/pr-check-tests.yml
🧰 Additional context used
🧬 Code graph analysis (2)
frontend/src-tauri/tests/mod_test.rs (2)
frontend/src-tauri/src/main.rs (1)
  • get_server_path (7-12)
frontend/src-tauri/src/services/mod.rs (1)
  • get_server_path (963-969)
frontend/src-tauri/src/main.rs (1)
frontend/src-tauri/src/services/mod.rs (1)
  • get_server_path (963-969)
🔇 Additional comments (4)
docs/docs/frontend/architecture.md (1)

1-29: Docs addition looks good and matches the FastAPI migration scope.
Clear and scoped. No blockers from me.

frontend/src-tauri/tests/mod_test.rs (1)

17-260: Incorrect — referenced services/types are present in src.

rg confirms FileService, CacheService and the named get_/secure_/encryption helpers are implemented/exported under frontend/src-tauri/src (notably: main.rs, services/mod.rs, services/file_service.rs, services/cache_service.rs). The original suggestion to prune these tests for missing symbols is incorrect.

Likely an incorrect or invalid review comment.

frontend/src-tauri/src/main.rs (2)

6-12: get_server_path command: OK.
Simple and correct fallback to http://127.0.0.1:8000.


15-19: Builder invoke_handler wiring: OK.
Handler registration matches the only remaining command.

Comment on lines +18 to +28
### Home Page
![Home Page](../assets/home-page.png)
*Home page with sample images loaded*

### Processing Results
![Processing Results](../assets/results-page.png)
*Face detection results on sample images*

### Settings
![Settings Page](../assets/settings-page.png)
*Application settings interface*
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify screenshot asset paths and presence in the repo.
Prevent broken images on the site by confirming the three PNGs exist at docs/docs/assets and the relative paths resolve from this page.

Run:


🏁 Script executed:

#!/bin/bash
set -euo pipefail
# Check files exist
for f in home-page.png results-page.png settings-page.png; do
  if [[ ! -f "docs/docs/assets/$f" ]]; then
    echo "Missing: docs/docs/assets/$f" && exit 1
  fi
done
# Validate markdown references point to ../assets/<file>
rg -n '\!\[[^]]+\]\(\.\./assets/(home-page|results-page|settings-page)\.png\)' docs/docs/frontend/architecture.md || {
  echo "Expected image references not found or paths differ"; exit 1; }
echo "Screenshots present and references OK."

Length of output: 59


🏁 Script executed:

#!/bin/bash
set -euo pipefail

files=(home-page.png results-page.png settings-page.png)
missing=()
found_elsewhere=()

for f in "${files[@]}"; do
  expected="docs/docs/assets/$f"
  if [ -f "$expected" ]; then
    continue
  fi
  found=$(find . -type f -name "$f" -print -quit || true)
  if [ -n "$found" ]; then
    found_elsewhere+=("$f -> $found")
  else
    missing+=("$expected")
  fi
done

if [ "${#missing[@]}" -ne 0 ]; then
  printf "Missing files at expected path:\n"
  printf "%s\n" "${missing[@]}"
fi

if [ "${#found_elsewhere[@]}" -ne 0 ]; then
  printf "Files found at other locations:\n"
  printf "%s\n" "${found_elsewhere[@]}"
fi

if [ "${#missing[@]}" -ne 0 ]; then
  echo "One or more expected files are missing from docs/docs/assets." >&2
  exit 1
fi

md="docs/docs/frontend/architecture.md"
if [ ! -f "$md" ]; then
  echo "Markdown file $md not found" >&2
  exit 1
fi

refs_missing=()
for f in "${files[@]}"; do
  if ! grep -nF "../assets/$f" "$md" >/dev/null 2>&1; then
    refs_missing+=("$f")
  fi
done

if [ "${#refs_missing[@]}" -ne 0 ]; then
  printf "Missing markdown references (../assets/<file>) in %s:\n" "$md"
  printf "%s\n" "${refs_missing[@]}"
  exit 1
fi

echo "Screenshots present in docs/docs/assets and markdown references OK."

Length of output: 193


Missing screenshot assets — add images to docs/docs/assets or update markdown paths.
docs/docs/frontend/architecture.md (lines 18–28) references ../assets/{home-page.png, results-page.png, settings-page.png} but the files are absent at:

  • docs/docs/assets/home-page.png
  • docs/docs/assets/results-page.png
  • docs/docs/assets/settings-page.png

Action: add the three PNGs to docs/docs/assets/ or update the markdown to point to the actual image locations.

🤖 Prompt for AI Agents
In docs/docs/frontend/architecture.md around lines 18 to 28 the markdown
references ../assets/home-page.png, ../assets/results-page.png and
../assets/settings-page.png but those files are missing; fix by either (A)
adding the three PNG files with those exact names into docs/docs/assets/, or (B)
updating the image paths in the markdown to point to the actual existing
locations/names of the images in the repo (ensure relative paths are correct),
then commit the added images or path changes and verify the images render in the
docs build.

Comment on lines +1 to +16
use std::env;
use tauri_backend::get_server_path;

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_get_server_path() {
env::set_var("SERVER_URL", "http://test.com");
assert_eq!(get_server_path(), "http://test.com");
env::remove_var("SERVER_URL");
assert_eq!(get_server_path(), "http://127.0.0.1:8000");
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Optional: replace entire file with a minimal, stable test.
Keeps only the single env-guarded test and removes all legacy Tauri tests.

Outside-the-hunk replacement suggestion:

use std::env;

#[cfg(test)]
mod tests {
    use super::*;
    use std::sync::{Mutex, OnceLock};

    static ENV_LOCK: OnceLock<Mutex<()>> = OnceLock::new();

    #[test]
    fn get_server_path_reads_env_or_defaults() {
        let _g = ENV_LOCK.get_or_init(|| Mutex::new(())).lock().unwrap();

        env::set_var("SERVER_URL", "http://test.com");
        assert_eq!(tauri_backend::get_server_path(), "http://test.com");

        env::remove_var("SERVER_URL");
        assert_eq!(tauri_backend::get_server_path(), "http://127.0.0.1:8000");
    }
}

I can push this as a patch if you want.

Also applies to: 261-274

🤖 Prompt for AI Agents
frontend/src-tauri/tests/mod_test.rs lines 1-16: replace the legacy multi-test
file with a single, stable env-guarded test that avoids race conditions by using
a global OnceLock<Mutex<()>>; within that test set SERVER_URL, assert
tauri_backend::get_server_path() returns the env value, remove the env var,
assert the default "http://127.0.0.1:8000" is returned, and remove all other
legacy Tauri tests so only this minimal deterministic test remains.

Comment on lines +1 to +2
use std::env;
use tauri_backend::get_server_path;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify crate path used in tests.
Ensure tauri_backend is the actual crate name in frontend/src-tauri/Cargo.toml; otherwise switch to crate::get_server_path.

Run:


🏁 Script executed:

#!/bin/bash
set -euo pipefail
toml=$(fd -HI Cargo.toml frontend/src-tauri -x cat {})
name=$(fd -HI Cargo.toml frontend/src-tauri -x rg -n '^name\s*=\s*".*"' {} | sed -E 's/.*"([^"]+)".*/\1/')
echo "Crate name: $name"
rg -nP "use\s+$name::get_server_path|use\s+crate::get_server_path" frontend/src-tauri/tests/mod_test.rs || {
  echo "Adjust test import to use crate name: $name"; exit 1; }

Length of output: 67


Replace test import to use crate name (picto_py)

frontend/src-tauri/tests/mod_test.rs — replace use tauri_backend::get_server_path; with use picto_py::get_server_path; (integration tests import the crate by its Cargo.toml name).

🤖 Prompt for AI Agents
In frontend/src-tauri/tests/mod_test.rs around lines 1 to 2, the test imports
the function from the library using the crate path tauri_backend which is
incorrect for integration tests; update the use statement to import
get_server_path from the crate name declared in Cargo.toml by replacing use
tauri_backend::get_server_path; with use picto_py::get_server_path; so the test
imports the crate by its package name.

Comment on lines +261 to +274
#[cfg(test)]
mod tests {
use std::env;
use tauri_backend::get_server_path;

#[test]
fn test_get_server_path() {
env::set_var("SERVER_URL", "http://test.com");
assert_eq!(get_server_path(), "http://test.com");

env::remove_var("SERVER_URL");
assert_eq!(get_server_path(), "http://127.0.0.1:8000");
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Duplicate #[cfg(test)] mod tests; remove this block.
Two modules named tests in the same scope cause a redefinition error.

Apply:

-#[cfg(test)]
-mod tests {
-    use std::env;
-    use tauri_backend::get_server_path;
-
-    #[test]
-    fn test_get_server_path() {
-        env::set_var("SERVER_URL", "http://test.com");
-        assert_eq!(get_server_path(), "http://test.com");
-        
-        env::remove_var("SERVER_URL");
-        assert_eq!(get_server_path(), "http://127.0.0.1:8000");
-    }
-}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#[cfg(test)]
mod tests {
use std::env;
use tauri_backend::get_server_path;
#[test]
fn test_get_server_path() {
env::set_var("SERVER_URL", "http://test.com");
assert_eq!(get_server_path(), "http://test.com");
env::remove_var("SERVER_URL");
assert_eq!(get_server_path(), "http://127.0.0.1:8000");
}
}
🤖 Prompt for AI Agents
In frontend/src-tauri/tests/mod_test.rs around lines 261 to 274, there is a
duplicate #[cfg(test)] mod tests block causing a redefinition error; remove this
entire duplicate tests module (the block from #[cfg(test)] mod tests { ... }) so
only a single tests module remains, and ensure any unique test cases inside are
merged into the remaining tests module if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove unwanted Tauri code and update documentation

2 participants