Firstp1ck / Firstp1ck/Pacsea

[FEATURE] Add sequential multi-package scan support

Open
#95 0 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue help wanted
Dominant language
Rust
Stars
296
Forks
11
PR merge metrics
No merged PRs in 30d

Description

## Summary
Currently, AUR security scans are limited to processing only the first package when multiple packages are selected. Add support for scanning multiple packages sequentially rather than all at once, which would be useful for users who want to scan packages one by one to avoid overwhelming system resources.

## Files to modify
- `src/events/modals/scan.rs` (around line 238)
- `src/state/modal.rs` (potentially extend PreflightExec to track multi-package progress)

## Expected behavior
When multiple AUR packages are selected for scanning:
1. Create scan items for all packages, not just the first one
2. Process packages sequentially through the PreflightExec modal
3. Show progress indication for multi-package scans (e.g., "Package 2 of 5")
4. Display individual results for each scanned package
5. Allow users to see results of completed scans while subsequent packages are being processed
6. Provide clear indication when all packages have been scanned

## Implementation approach
1. **Modify scan initiation:**
- Instead of creating only one scan item, create scan items for all packages
- Add package index tracking to show "Package X of Y" progress

2. **Update PreflightExec modal:**
- Extend to handle sequential processing of multiple scan items
- Add progress tracking across packages
- Show individual results for each completed scan

3. **Sequential execution:**
- Process one package at a time to avoid resource contention
- Queue subsequent packages after the current one completes
- Maintain scan results for all packages

4. **UI enhancements:**
- Display progress indicator ("Scanning package 2 of 5: firefox")
- Show results summary for completed packages
- Allow navigation between individual package results

## Testing
- [ ] `cargo check` passes
- [ ] `cargo clippy --all-targets --all-features -- -D warnings` passes
- [ ] `cargo test -- --test-threads=1` passes
- [ ] Test scanning single package (existing behavior unchanged)
- [ ] Test scanning multiple packages sequentially
- [ ] Test progress indication shows correct package numbers
- [ ] Test results display for each individual package
- [ ] Test error handling when individual scans fail
- [ ] Test resource usage doesn't spike with multiple packages
- [ ] Test cancellation works properly during multi-package scans

## Additional context
Current implementation only scans the first package and logs a warning for additional packages:

```rust
// Handle each package sequentially (for now, just first package)
// TODO: Add support for sequential multi-package scans
let first_pkg = &names[0];
```

The PreflightExec modal already supports multiple items via the `items: Vec` field, so the infrastructure is in place. The key changes needed are:

1. Create scan items for all packages instead of just the first
2. Implement sequential processing logic in the scan handler
3. Add progress tracking and result aggregation
4. Update UI to show multi-package progress

This enhancement would significantly improve the user experience for bulk package scanning while maintaining resource efficiency through sequential processing.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.