Skip to content

fix:Remove merge conflict#1285

Open
akshajtiwari wants to merge 11 commits into
AOSSIE-Org:mainfrom
akshajtiwari:fix-conflict-1158
Open

fix:Remove merge conflict#1285
akshajtiwari wants to merge 11 commits into
AOSSIE-Org:mainfrom
akshajtiwari:fix-conflict-1158

Conversation

@akshajtiwari
Copy link
Copy Markdown
Contributor

@akshajtiwari akshajtiwari commented May 24, 2026

Addressed Issues:

Fixes Issue : #592
merge conflicted PR : #1158

Screenshots/Recordings:

NA

Additional Notes:

NA

AI Usage Disclosure:

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact. AI slop is strongly discouraged and may lead to banning and blocking. Do not spam our repos with AI slop.

Check one of the checkboxes below:

  • This PR does not contain AI-generated code at all.
  • This PR contains AI-generated code. I have read the AI Usage Policy and this PR complies with this policy. I have tested the code locally and I am responsible for it.

I have used the following AI models and tools: claude

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • My code follows the project's code style and conventions
  • If applicable, I have made corresponding changes or additions to the documentation
  • If applicable, I have made corresponding changes or additions to tests
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contribution Guidelines
  • Once I submit my PR, CodeRabbit AI will automatically review it and I will address CodeRabbit's comments.
  • I have filled this PR template completely and carefully, and I understand that my PR may be closed without review otherwise.

Summary by CodeRabbit

  • New Features

    • Folders now include and surface a per-folder image count across the API and UI.
    • Settings show "Folder is empty" when a folder has no images; otherwise AI tagging progress and percentage with completion indicator are shown.
  • Documentation

    • API schema updated to include image count and explicit error response definitions.
  • Chores

    • CI workflows now support manual triggering.
    • Frontend dev deps updated.
  • Tests

    • Tests updated to reflect the new folder response shape.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 24, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds per-folder image counts end-to-end: DB query aggregates image counts; API route and FolderDetails include image_count; OpenAPI updated; frontend types and Settings UI use image_count to show empty-folder or AI-tagging progress; tests and CI/dev dependency edits included.

Changes

Folder Image Count Feature

Layer / File(s) Summary
Backend database aggregation
backend/app/database/folders.py
db_get_all_folder_details() LEFT JOINs images, returns COUNT(i.id) AS image_count grouped by f.folder_id; return type and docstring updated to include image_count int.
Backend schema and route integration
backend/app/schemas/folders.py, backend/app/routes/folders.py, backend/tests/test_folders.py
FolderDetails adds image_count field (default 0); get_all_folders() unpacks and passes image_count into the model; test fixture sample_folder_details updated with image counts.
API schema documentation
docs/backend/backend_python/openapi.json
OpenAPI FolderDetails gains image_count: integer (default 0); several ErrorResponse schemas added/extended under components/schemas.
Frontend types and folder management UI
frontend/src/types/Folder.ts, frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx
FolderDetails TypeScript interface adds image_count?: number; FolderManagementCard shows "Folder is empty" when image_count is falsy, otherwise displays AI tagging progress, percentage, and completion indicator.
CI triggers and dev dependency
.github/workflows/pr-check-build.yml, .github/workflows/pr-check-tests.yml, frontend/package.json
Added workflow_dispatch manual trigger to PR check workflows; added baseline-browser-mapping to frontend devDependencies.

Sequence Diagram(s)

sequenceDiagram
  participant Frontend
  participant API
  participant Database
  Frontend->>API: GET /all-folders
  API->>Database: db_get_all_folder_details() (folders LEFT JOIN images, COUNT)
  Database-->>API: list of folder tuples with image_count
  API-->>Frontend: FolderDetails[] (includes image_count)
  Frontend->>Frontend: render FolderManagementCard (uses image_count to show empty or progress)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • AOSSIE-Org/PictoPy#574: Changes to FolderManagementCard.tsx AI-tagging progress UI and related frontend behavior.

Suggested labels

Python, TypeScript/JavaScript, Documentation

Suggested reviewers

  • rahulharpal1603

Poem

🐰 I count the pictures, one hop at a time,
From rows in the DB to the UI’s bright line,
If none are inside, I softly declare,
“Folder is empty” — no progress to share,
A tiny field ties backend and front in rhyme.

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title 'fix:Remove merge conflict' does not accurately describe the main changes in the changeset, which involve adding image_count functionality across backend, frontend, and test files. Update the title to reflect the primary change, such as 'feat: add image_count to folder details' or 'feat: include image count in folder response data'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@github-actions github-actions Bot added backend bug Something isn't working frontend labels May 24, 2026
@akshajtiwari akshajtiwari reopened this May 24, 2026
@akshajtiwari akshajtiwari marked this pull request as draft May 24, 2026 10:35
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: 1

Caution

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

⚠️ Outside diff range comments (1)
frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx (1)

90-172: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Remove duplicated AI Tagging Progress rendering in FolderManagementCard

  • frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx (around lines 90-172) renders two separate {folder.AI_Tagging && (...)} blocks with “AI Tagging Progress”; this duplicates the UI. Keep a single folder.AI_Tagging block and move the folder.image_count === 0 “Folder is empty” conditional inside it.
  • Add/update tests to cover the empty-folder branch and ensure the progress UI is rendered only once.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx` around
lines 90 - 172, The component duplicates the "AI Tagging Progress" UI by
rendering two separate folder.AI_Tagging blocks; consolidate them into a single
block (in FolderManagementCard) that contains the image_count === 0 check so the
"Folder is empty" branch is shown inside that same folder.AI_Tagging rendering;
update the single block to use
taggingStatus[folder.folder_id]?.tagging_percentage (and Progress / Check)
exactly once and remove the duplicate block; then add/update tests to cover the
empty-folder branch and assert the progress UI appears only once.
🧹 Nitpick comments (1)
frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx (1)

126-170: ⚡ Quick win

Add focused UI tests for empty vs non-empty folder states.

Please add automated component tests for both branches: image_count === 0 (shows “Folder is empty”) and image_count > 0 (shows progress/check behavior).

As per coding guidelines "**/*: Ensure that test code is automated, comprehensive, and follows testing best practices" and "Verify that all critical functionality is covered by tests".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx` around
lines 126 - 170, Add two automated component tests for FolderManagementCard
covering the empty and non-empty branches: render FolderManagementCard with
folder.AI_Tagging true and folder.image_count = 0 and assert the "Folder is
empty" text is shown and no Progress/check icon is rendered; then render with
folder.image_count > 0 and supply a mocked taggingStatus (via the same
prop/context/state used in the component) to assert the Progress component
receives the correct value, that the percentage text is shown, and that the
Check icon appears when tagging_percentage >= 100; use React Testing Library +
Jest (or the project's test utils), mock any external providers/hooks used by
FolderManagementCard, and assert DOM text, aria/role attributes or classnames
where needed (reference symbols: FolderManagementCard, folder.AI_Tagging,
image_count, taggingStatus, Progress, Check).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/package.json`:
- Line 91: The devDependency "baseline-browser-mapping" is unused in the repo
and should be removed or justified: remove "baseline-browser-mapping" from
devDependencies in package.json (and update the lockfile by running your package
manager to persist the change), or if it is required transitively by a specific
build tool, add a short justification comment in the repo (e.g., README or
contributing notes) explaining why "baseline-browser-mapping" v2.9.19 must
remain and which tool depends on it; ensure the package-lock.json/yarn.lock is
updated accordingly after removal or after adding the justification.

---

Outside diff comments:
In `@frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx`:
- Around line 90-172: The component duplicates the "AI Tagging Progress" UI by
rendering two separate folder.AI_Tagging blocks; consolidate them into a single
block (in FolderManagementCard) that contains the image_count === 0 check so the
"Folder is empty" branch is shown inside that same folder.AI_Tagging rendering;
update the single block to use
taggingStatus[folder.folder_id]?.tagging_percentage (and Progress / Check)
exactly once and remove the duplicate block; then add/update tests to cover the
empty-folder branch and assert the progress UI appears only once.

---

Nitpick comments:
In `@frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx`:
- Around line 126-170: Add two automated component tests for
FolderManagementCard covering the empty and non-empty branches: render
FolderManagementCard with folder.AI_Tagging true and folder.image_count = 0 and
assert the "Folder is empty" text is shown and no Progress/check icon is
rendered; then render with folder.image_count > 0 and supply a mocked
taggingStatus (via the same prop/context/state used in the component) to assert
the Progress component receives the correct value, that the percentage text is
shown, and that the Check icon appears when tagging_percentage >= 100; use React
Testing Library + Jest (or the project's test utils), mock any external
providers/hooks used by FolderManagementCard, and assert DOM text, aria/role
attributes or classnames where needed (reference symbols: FolderManagementCard,
folder.AI_Tagging, image_count, taggingStatus, Progress, Check).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 38ff822a-6391-4a5c-af7b-6247d17564cd

📥 Commits

Reviewing files that changed from the base of the PR and between a20c1bb and 4bba91b.

⛔ Files ignored due to path filters (2)
  • frontend/package-lock.json is excluded by !**/package-lock.json
  • scripts/rustup-init.exe is excluded by !**/*.exe
📒 Files selected for processing (8)
  • backend/app/database/folders.py
  • backend/app/routes/folders.py
  • backend/app/schemas/folders.py
  • docs/backend/backend_python/openapi.json
  • frontend/package.json
  • frontend/src-tauri/src/main.rs
  • frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx
  • frontend/src/types/Folder.ts
💤 Files with no reviewable changes (1)
  • frontend/src-tauri/src/main.rs

Comment thread frontend/package.json
@akshajtiwari akshajtiwari marked this pull request as ready for review May 24, 2026 21:46
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: 1

🧹 Nitpick comments (1)
frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx (1)

98-130: ⚡ Quick win

Extract repeated tagging percentage calculation.

The expression (taggingStatus[folder.folder_id]?.tagging_percentage ?? 0) is repeated 5 times within the same render. This creates unnecessary duplication and could impact performance.

♻️ Proposed refactor to extract the repeated expression
                     ) : (
                       <>
+                        {(() => {
+                          const taggingPercentage = taggingStatus[folder.folder_id]?.tagging_percentage ?? 0;
+                          const isComplete = taggingPercentage >= 100;
+                          const roundedPercentage = Math.round(taggingPercentage);
+                          
+                          return (
+                            <>
                         <div className="text-muted-foreground mb-1 flex items-center justify-between text-xs">
                           <span>AI Tagging Progress</span>
                           <span
                             className={
-                              (taggingStatus[folder.folder_id]
-                                ?.tagging_percentage ?? 0) >= 100
+                              isComplete
                                 ? 'flex items-center gap-1 text-green-500'
                                 : 'text-muted-foreground'
                             }
                           >
-                            {(taggingStatus[folder.folder_id]
-                              ?.tagging_percentage ?? 0) >= 100 && (
+                            {isComplete && (
                               <Check className="h-3 w-3" />
                             )}
-                            {Math.round(
-                              taggingStatus[folder.folder_id]
-                                ?.tagging_percentage ?? 0,
-                            )}
+                            {roundedPercentage}
                             %
                           </span>
                         </div>
                         <Progress
-                          value={
-                            taggingStatus[folder.folder_id]
-                              ?.tagging_percentage ?? 0
-                          }
+                          value={taggingPercentage}
                           indicatorClassName={
-                            (taggingStatus[folder.folder_id]
-                              ?.tagging_percentage ?? 0) >= 100
+                            isComplete
                               ? 'bg-green-500'
                               : 'bg-blue-500'
                           }
                         />
+                            </>
+                          );
+                        })()}
                       </>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx` around
lines 98 - 130, Extract the repeated tagging percentage lookup into a local
constant at the top of the render/functional scope to avoid recomputing
(taggingStatus[folder.folder_id]?.tagging_percentage ?? 0); replace all five
inline uses inside FolderManagementCard (references: taggingStatus,
folder.folder_id, the Progress prop value, indicatorClassName ternary, and the
percentage display that conditionally renders <Check />) with that constant so
the component reads the value once and reuses it.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx`:
- Around line 92-96: The conditional that currently checks folder.image_count
=== 0 will treat undefined as not-empty; update the check in
FolderManagementCard (where folder.image_count is referenced) to treat undefined
as empty by changing the condition to explicitly check for undefined as well
(e.g., folder.image_count === 0 || folder.image_count === undefined) so folders
with no image_count show the "Folder is empty" message instead of the progress
UI.

---

Nitpick comments:
In `@frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx`:
- Around line 98-130: Extract the repeated tagging percentage lookup into a
local constant at the top of the render/functional scope to avoid recomputing
(taggingStatus[folder.folder_id]?.tagging_percentage ?? 0); replace all five
inline uses inside FolderManagementCard (references: taggingStatus,
folder.folder_id, the Progress prop value, indicatorClassName ternary, and the
percentage display that conditionally renders <Check />) with that constant so
the component reads the value once and reuses it.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8c289b34-82bd-4f3c-b08a-bf48fab42c20

📥 Commits

Reviewing files that changed from the base of the PR and between 4bba91b and 428b886.

📒 Files selected for processing (4)
  • .github/workflows/pr-check-build.yml
  • .github/workflows/pr-check-tests.yml
  • backend/tests/test_folders.py
  • frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx
✅ Files skipped from review due to trivial changes (3)
  • .github/workflows/pr-check-tests.yml
  • .github/workflows/pr-check-build.yml
  • backend/tests/test_folders.py

Comment thread frontend/src/pages/SettingsPage/components/FolderManagementCard.tsx Outdated
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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/src/types/Folder.ts`:
- Line 8: The Folder type currently declares image_count as required which can
produce undefined at runtime; update the Folder interface in
frontend/src/types/Folder.ts to make image_count optional (image_count?: number)
OR, if you prefer keeping it required, add normalization in the fetch/adapter
layer (e.g., normalizeFolder or the function that maps API responses to Folder)
to set image_count = response.image_count ?? 0 and add a test for the
missing-field case; locate the Folder interface and the API-to-model mapping
function to apply the chosen fix.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 98fe3a66-27e2-41ba-94c8-26485781bfec

📥 Commits

Reviewing files that changed from the base of the PR and between 428b886 and 226fef4.

📒 Files selected for processing (1)
  • frontend/src/types/Folder.ts

Comment thread frontend/src/types/Folder.ts Outdated
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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/src/types/Folder.ts`:
- Line 8: The Folder type made image_count optional which breaks the
empty-folder check in FolderManagementCard.tsx; update the UI to treat undefined
as zero by changing the conditional that currently uses folder.image_count === 0
to a check that treats falsy/undefined as empty (e.g., !folder.image_count ||
folder.image_count === 0) in the component where it displays "Folder is empty"
(FolderManagementCard), or alternatively normalize the value to 0 when casting
folder data in useFolderOperations (so folder.image_count is always a number)
and keep the existing check.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 960dead3-12e9-4566-ad90-cb060c0b51b4

📥 Commits

Reviewing files that changed from the base of the PR and between 226fef4 and ef16094.

📒 Files selected for processing (1)
  • frontend/src/types/Folder.ts

Comment thread frontend/src/types/Folder.ts
Comment thread .github/workflows/pr-check-build.yml Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend bug Something isn't working frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: AI Tagging Shows 0% Progress for Empty Folders Instead of "No Images" Message

3 participants