Skip to content

feat: Integrate cleanup service into main server - #6

Merged
k8ika0s merged 1 commit into
mainfrom
feature/cleanup-server-integration
Jan 19, 2026
Merged

feat: Integrate cleanup service into main server#6
k8ika0s merged 1 commit into
mainfrom
feature/cleanup-server-integration

Conversation

@k8ika0s

@k8ika0s k8ika0s commented Jan 19, 2026

Copy link
Copy Markdown
Owner

Summary

Integrates the cleanup service into the main gRPC server, completing the server-side implementation.

Changes: 1 file, 33 lines added
Build: ✅ Compiles successfully

What's Included

  • ✅ CleanupService and LocationService registered
  • ✅ Dependencies wired (repositories, services, middleware)
  • ✅ Authorization and audit middleware integrated
  • ✅ Health checks configured
  • ✅ AES-256 encryption for credentials

Files Changed

backend/cmd/server/main.go:

  • Added cleanup and location service imports
  • Initialized crypto encryptor (AES-256)
  • Created location and cleanup repositories
  • Wired up services with dependencies
  • Added middleware chain (auth + audit)
  • Registered services with gRPC server

Testing

✅ Build verification: go build successful
✅ All imports resolve correctly
✅ Type safety verified

Configuration Notes

⚠️ TODO: Encryption key is hardcoded for development. Load from secure source in production.

Next Steps

  1. Unit tests
  2. Integration tests
  3. End-to-end tests
  4. Frontend UI

Checklist

  • Code compiles
  • Services wired
  • Middleware configured
  • Health checks registered
  • Tests (future PR)

Related: PR #5 (merged)

- Add cleanup service registration to main server
- Wire up cleanup dependencies (repository, location service)
- Integrate authorization and audit middleware
- Add health check for cleanup service
- Configure AES-256 encryption for credentials
- Register location service (dependency for cleanup)

Integration includes:
- CleanupService with full middleware chain
- LocationService for S3 provider management
- Authorization middleware for RBAC enforcement
- Audit middleware for operation logging
- Proper service health status registration

Build verified: Server compiles successfully with all services
@k8ika0s
k8ika0s merged commit 91641c0 into main Jan 19, 2026
6 of 7 checks passed
@k8ika0s
k8ika0s deleted the feature/cleanup-server-integration branch January 19, 2026 18:52
k8ika0s added a commit that referenced this pull request Jan 19, 2026
Implement comprehensive React components for storage cleanup feature:

## Components Created

### 1. CleanupDashboard (407 lines)
- Main dashboard with 3 tabs: Scan & Cleanup, Jobs, Analytics
- Scan configuration form with location, bucket, prefix selection
- Scan type selector: orphaned uploads, corrupt objects, versions, empty objects
- Conditional fields based on scan type (minAgeDays, keepVersions)
- Dry-run mode toggle for safe preview
- Break-glass mode indicator and validation
- Integration with all child components

### 2. ScanResults (318 lines)
- Displays scan results based on scan type
- Orphaned uploads table: bucket, key, age, parts, size
- Corrupt objects list: corruption type, error message, recoverability
- Orphaned versions table: version IDs, latest flag, size
- Empty objects simple table
- Formatted bytes and relative dates
- Severity indicators for corrupt objects

### 3. JobMonitor (268 lines)
- Active job card with real-time statistics
- Auto-refresh every 3 seconds for running jobs
- Job history list with status icons and badges
- Statistics: scanned, processed, failed, bytes freed
- Cancel job functionality with confirmation
- Dry-run and break-glass mode indicators
- Click to set active job for detailed view

### 4. StorageAnalytics (346 lines)
- Overview cards: total storage, bucket count, average object size
- Bucket statistics table with size distribution
- Object age distribution with visual progress bars
- Largest objects table
- Provider diagnostics: capabilities, recommendations, warnings
- Performance metrics: latency, throughput, error rate, availability

## Type Updates
- Updated OrphanedUpload: estimatedSizeBytes, storageClass, ageDays
- Updated CorruptObject: size, lastModified, corruptionType, errorMessage, isRecoverable
- Updated ObjectVersion: isDeleteMarker, ageDays
- Added EmptyObject type: bucket, key, versionId, lastModified, ageDays
- All types now match backend protobuf definitions exactly

## Features
- Real-time job monitoring with auto-refresh
- Comprehensive error handling and loading states
- Responsive design with Tailwind CSS
- Accessible UI with proper ARIA labels
- Type-safe with TypeScript
- Integration with Zustand store for state management

Part of storage cleanup feature implementation.
Related to #5, #6
k8ika0s added a commit that referenced this pull request Jan 19, 2026
Add Cleanup tab to AdminPage with the following changes:

- Add 'cleanup' to AdminTab type union
- Import CleanupDashboard component from cleanup module
- Import Trash2 icon from lucide-react for tab icon
- Fetch locations using React Query for cleanup dashboard
- Add Cleanup tab to navigation with Trash2 icon
- Render CleanupDashboard when cleanup tab is active
- Pass locations array to CleanupDashboard component

The Cleanup tab provides administrators with:
- Storage scanning capabilities (orphaned uploads, corrupt objects, versions, empty objects)
- Job monitoring with real-time updates
- Storage analytics and provider diagnostics
- Break-glass mode support for elevated access

Part of storage cleanup feature implementation.
Related to #5, #6
@k8ika0s k8ika0s mentioned this pull request Jan 19, 2026
10 tasks
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.

1 participant