Skip to content

Conversation

@alishair7071
Copy link

@alishair7071 alishair7071 commented Jan 26, 2026

Summary

Adds filesystem existence detection for saved folders and improves Settings → Folder Management UI to clearly indicate missing folders.

Changes

  • Backend: GET /folders/all-folders now returns exists for each folder (checked via filesystem).
  • Frontend: shows a red Missing badge for folders that no longer exist.
  • Frontend: disables AI tagging toggle for missing folders.
  • Frontend: highlights the delete button for missing folders to encourage cleanup.
  • Frontend: folder list refetches when opening Settings (so existence is re-checked).

How to test

  1. Add Folder A and Folder B in Settings.
  2. Delete Folder A from your file manager.
  3. Open Settings → Folder A shows Missing, AI toggle disabled, delete button highlighted.
  4. Click delete → Folder A is removed from PictoPy.
Screenshot 2026-01-26 183612

Closes #1081

Summary by CodeRabbit

  • New Features

    • System now detects and displays when folders no longer exist on the filesystem with a "Missing" badge indicator
    • AI Tagging toggle is disabled for missing folders to prevent operations on unavailable paths
    • Delete button is visually highlighted (red styling) when a folder is missing
  • Improvements

    • Settings page refreshes folder status validation when revisited to ensure real-time accuracy

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 26, 2026

📝 Walkthrough

Walkthrough

A new exists: bool field is added to the FolderDetails schema to track filesystem existence. The backend performs runtime os.path.isdir() checks when retrieving folders. The frontend displays a "Missing" badge when exists is false and disables tagging operations on missing folders.

Changes

Cohort / File(s) Summary
Backend Schema & Route Implementation
backend/app/schemas/folders.py, backend/app/routes/folders.py
Added exists: bool = True field to FolderDetails schema and implemented os.path.isdir() filesystem check in get_all_folders route to populate the exists attribute at retrieval time.
Backend Tests
backend/tests/test_folders.py
Added mock of os.path.isdir in test_get_all_folders_success; updated assertions to verify exists=True on returned folder objects and confirm isdir was called twice.
API Documentation
docs/backend/backend_python/openapi.json
Updated FolderDetails schema to include new exists: boolean property with default value true.
Frontend Type Definitions
frontend/src/types/Folder.ts
Added optional exists?: boolean property to FolderDetails interface.
Frontend Query Configuration
frontend/src/hooks/useFolderOperations.tsx
Added refetchOnMount: 'always' to folders query to re-validate filesystem existence when Settings page is revisited.
Frontend UI Component
frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx
Updated rendering logic to compute isMissing = folder.exists === false; added "Missing" badge display, disabled AI Tagging toggle for missing folders, and applied conditional red styling to delete button for missing folders.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested labels

backend, frontend

Poem

🐰 A rabbit hops through folders one by one,
Checking if each path still sees the sun—
"Missing!" it calls when the path's gone away,
So users can clean up their stale array!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'fix: highlight missing folders in settings' directly aligns with the main objective to detect missing folders and surface that state in the Settings UI.
Linked Issues check ✅ Passed The PR addresses all primary requirements from issue #1081: detects when folders no longer exist via filesystem check [backend/app/routes/folders.py], exposes the exists flag in response [backend/app/schemas/folders.py], and displays missing folders with a 'Missing' badge in the UI [FolderManagementCard.tsx] while disabling tagging and highlighting deletion.
Out of Scope Changes check ✅ Passed All changes directly support the objective of detecting and highlighting missing folders: backend filesystem checks, schema updates, frontend UI indicators, and refetch logic when Settings is revisited.
Docstring Coverage ✅ Passed Docstring 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

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.

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.

fix: Deleted/missing folders still appear in Settings folder list

1 participant