Skip to content

fix: image counts are incorrectly calculated#1760

Merged
kmendell merged 1 commit intomainfrom
fix/image-counts-wrong
Feb 18, 2026
Merged

fix: image counts are incorrectly calculated#1760
kmendell merged 1 commit intomainfrom
fix/image-counts-wrong

Conversation

@kmendell
Copy link
Copy Markdown
Member

@kmendell kmendell commented Feb 15, 2026

What This PR Implements

Related issue

Related Issue

Fixes # #1712

Changes Made

Testing Done

  • Development environment started: ./scripts/development/dev.sh start
  • Frontend verified at http://localhost:3000
  • Backend verified at http://localhost:3552
  • Manual testing completed (describe):
  • No linting errors (e.g., just lint all)
  • Backend tests pass: just test backend

Checklist

  • This PR is not opened from my fork’s main branch

AI Tool Used (if applicable)

AI Tool:
Assistance Level:
What AI helped with:
I reviewed and edited all AI-generated output:
I ran all required tests and manually verified changes:

Additional Context

Disclaimer Greptiles Reviews use AI, make sure to check over its work.

To better help train Greptile on our codebase, if the comment is useful and valid Like the comment, if its not helpful or invalid Dislike

Greptile Overview

Greptile Summary

Fixed incorrect image count calculations by replacing unreliable image.Containers field with proper container-to-image ID matching. The PR addresses two key issues:

  • Image usage tracking: Now fetches all containers and builds a map of in-use image IDs, then checks each image against this map. Previously relied on image.Containers field which was producing incorrect counts (showing -1, 0, or 99 values).
  • Update summary accuracy: GetUpdateSummary now filters counts to only live Docker images, preventing stale database records from inflating statistics.

The changes include comprehensive test coverage verifying the fixes work correctly, and integration tests to ensure the API counts align with the actual image data.

Confidence Score: 5/5

  • This PR is safe to merge with no identified risks
  • The changes are well-architected with proper error handling, comprehensive unit tests demonstrating the fix works correctly, and integration tests validating end-to-end behavior. The root cause is clearly addressed by replacing unreliable data with proper container-to-image ID matching
  • No files require special attention

Important Files Changed

Filename Overview
backend/internal/services/docker_client_service.go Fixed image usage counting by checking container ImageIDs instead of unreliable image.Containers field
backend/internal/services/image_service.go Refactored prune cleanup logic into smaller functions and added orphaned record cleanup
backend/internal/services/image_update_service.go Fixed GetUpdateSummary to only count live Docker images, preventing stale data from inflating counts

Last reviewed commit: 19c5c57

@kmendell kmendell marked this pull request as ready for review February 15, 2026 01:11
@kmendell kmendell requested a review from a team February 15, 2026 01:11
Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 15, 2026

🔍 Deadcode Analysis

Found 3 unreachable functions in the backend.

View details
internal/services/auth_service.go:753:23: unreachable func: AuthService.GetAutoLoginConfig
internal/services/auth_service.go:787:23: unreachable func: AuthService.GetAutoLoginPassword
internal/utils/ws/hub.go:27:15: unreachable func: Hub.ClientCount

Only remove deadcode that you know is 100% no longer used.

Analysis from commit 5c31dc4

@getarcaneappbot
Copy link
Copy Markdown
Contributor

getarcaneappbot commented Feb 15, 2026

Container images for this PR have been built successfully!

  • Manager: ghcr.io/getarcaneapp/arcane:pr-1760
  • Agent: ghcr.io/getarcaneapp/arcane-headless:pr-1760

Built from commit 593863e

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

8 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment thread backend/internal/services/docker_client_service.go Outdated
Comment thread backend/internal/services/image_update_service.go Outdated
@kmendell kmendell force-pushed the fix/image-counts-wrong branch from d57b9d0 to 19c5c57 Compare February 15, 2026 01:50
@kmendell
Copy link
Copy Markdown
Member Author

@greptileai

@kmendell kmendell force-pushed the fix/image-counts-wrong branch 6 times, most recently from 93eabb4 to f8efc83 Compare February 18, 2026 04:51
@kmendell kmendell force-pushed the fix/image-counts-wrong branch from f8efc83 to 593863e Compare February 18, 2026 05:32
@kmendell kmendell merged commit 0efdd80 into main Feb 18, 2026
14 checks passed
@kmendell kmendell deleted the fix/image-counts-wrong branch February 18, 2026 05:54
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.

2 participants