@@ -13,7 +13,7 @@ This document provides a detailed structured plan for implementing the Index Mod
1313| ** Estimated Effort** | 20-30 hours |
1414| ** Complexity** | Medium (system command execution, data persistence, async operations) |
1515| ** Dependencies** | ` types ` module, optional ` aur ` module for enrichment |
16- | ** Status** | ⏳ Planned - Not yet started |
16+ | ** Status** | 🚧 In Progress - Tasks 3.1, 3.2, and 3.3 complete |
1717
1818## Overview
1919
@@ -78,7 +78,7 @@ This module is foundational and used by other modules (deps, install) for packag
7878- ` OfficialIndex ` - Collection of official packages with name lookup
7979 ``` rust
8080 pub struct OfficialIndex {
81- pub packages : Vec <OfficialPackage >,
81+ pub pkgs : Vec <OfficialPackage >,
8282 // Internal: name_to_idx for O(1) lookups
8383 }
8484 ```
@@ -89,15 +89,23 @@ This module is foundational and used by other modules (deps, install) for packag
8989 pub fuzzy_score : Option <i64 >,
9090 }
9191 ```
92+ - ` InstalledPackagesMode ` - Filter mode for explicit package queries (added in Task 3.2)
93+ ``` rust
94+ pub enum InstalledPackagesMode {
95+ LeafOnly , // pacman -Qetq
96+ AllExplicit , // pacman -Qeq
97+ }
98+ ```
9299
93100** Estimated Effort** : 2-3 hours
94101
95102** Acceptance Criteria** :
96- - [ ] All types have rustdoc comments (What/Inputs/Output/Details)
97- - [ ] Types are serializable with serde
98- - [ ] ` OfficialIndex ` has ` rebuild_name_index() ` method
99- - [ ] Unit tests for type operations
100- - [ ] Code passes ` cargo fmt ` , ` cargo clippy ` , ` cargo check `
103+ - [x] All types have rustdoc comments (What/Inputs/Output/Details)
104+ - [x] Types are serializable with serde
105+ - [x] ` OfficialIndex ` has ` rebuild_name_index() ` method
106+ - [x] ` OfficialIndex ` has ` find_package_by_name() ` method
107+ - [x] Unit tests for type operations
108+ - [x] Code passes ` cargo fmt ` , ` cargo clippy ` , ` cargo check `
101109
102110---
103111
@@ -123,12 +131,12 @@ This module is foundational and used by other modules (deps, install) for packag
123131** Estimated Effort** : 3-4 hours
124132
125133** Acceptance Criteria** :
126- - [ ] Functions work without global state
127- - [ ] Graceful degradation when pacman unavailable
128- - [ ] Async operations use ` spawn_blocking ` correctly
129- - [ ] Unit tests for installed package queries
130- - [ ] Integration tests with mock pacman
131- - [ ] Code passes quality checks
134+ - [x ] Functions work without global state
135+ - [x ] Graceful degradation when pacman unavailable
136+ - [x ] Async operations use ` spawn_blocking ` correctly
137+ - [x ] Unit tests for installed package queries
138+ - [x ] Integration tests with mock pacman
139+ - [x ] Code passes quality checks
132140
133141#### Task 3.2.2: Port Explicit Package Tracking
134142
@@ -141,10 +149,10 @@ This module is foundational and used by other modules (deps, install) for packag
141149** Estimated Effort** : 1-2 hours
142150
143151** Acceptance Criteria** :
144- - [ ] Functions work without global state
145- - [ ] Graceful degradation when pacman unavailable
146- - [ ] Unit tests
147- - [ ] Code passes quality checks
152+ - [x ] Functions work without global state
153+ - [x ] Graceful degradation when pacman unavailable
154+ - [x ] Unit tests
155+ - [x ] Code passes quality checks
148156
149157---
150158
@@ -171,11 +179,11 @@ This module is foundational and used by other modules (deps, install) for packag
171179** Estimated Effort** : 4-5 hours
172180
173181** Acceptance Criteria** :
174- - [ ] Functions accept ` &OfficialIndex ` parameter (no global state)
175- - [ ] Fuzzy matching works correctly
176- - [ ] Case-insensitive substring matching works
177- - [ ] Unit tests for search functionality
178- - [ ] Code passes quality checks
182+ - [x ] Functions accept ` &OfficialIndex ` parameter (no global state)
183+ - [x ] Fuzzy matching works correctly
184+ - [x ] Case-insensitive substring matching works
185+ - [x ] Unit tests for search functionality
186+ - [x ] Code passes quality checks
179187
180188#### Task 3.3.2: Port Official Index Fetching
181189
@@ -194,12 +202,12 @@ This module is foundational and used by other modules (deps, install) for packag
194202** Estimated Effort** : 3-4 hours
195203
196204** Acceptance Criteria** :
197- - [ ] Uses ` reqwest ` via arch-toolkit client
198- - [ ] Respects rate limiting
199- - [ ] Handles errors gracefully
200- - [ ] Unit tests with mock HTTP responses
201- - [ ] Integration tests (optional, requires network)
202- - [ ] Code passes quality checks
205+ - [x ] Uses ` reqwest ` via arch-toolkit client
206+ - [x ] Respects rate limiting
207+ - [x ] Handles errors gracefully
208+ - [x ] Unit tests with mock HTTP responses
209+ - [x ] Integration tests (optional, requires network)
210+ - [x ] Code passes quality checks
203211
204212---
205213
@@ -306,11 +314,12 @@ This module is foundational and used by other modules (deps, install) for packag
306314** Estimated Effort** : 1-2 hours
307315
308316** Acceptance Criteria** :
309- - [ ] All public APIs exported
310- - [ ] Comprehensive module documentation
311- - [ ] Usage examples in rustdoc
312- - [ ] Feature flags documented
313- - [ ] Code passes quality checks
317+ - [x] All public APIs exported (for installed/explicit/query/fetch modules)
318+ - [x] Comprehensive module documentation
319+ - [x] Usage examples in rustdoc
320+ - [x] Feature flags documented
321+ - [x] Code passes quality checks
322+ - [ ] Additional exports for persist module (pending)
314323
315324---
316325
@@ -329,10 +338,11 @@ This module is foundational and used by other modules (deps, install) for packag
329338** Estimated Effort** : 3-4 hours
330339
331340** Acceptance Criteria** :
332- - [ ] All functions have unit tests
333- - [ ] Error cases covered
334- - [ ] Edge cases covered
335- - [ ] Tests pass with ` cargo test -- --test-threads=1 `
341+ - [x] All functions have unit tests (for installed/explicit/query/fetch modules)
342+ - [x] Error cases covered (for installed/explicit/query/fetch modules)
343+ - [x] Edge cases covered (for installed/explicit/query/fetch modules)
344+ - [x] Tests pass with ` cargo test -- --test-threads=1 ` (for completed modules)
345+ - [ ] Additional tests for persist module (pending)
336346
337347#### Task 3.8.2: Integration Tests
338348
@@ -347,9 +357,10 @@ This module is foundational and used by other modules (deps, install) for packag
347357** Estimated Effort** : 2-3 hours
348358
349359** Acceptance Criteria** :
350- - [ ] Integration tests cover main workflows
351- - [ ] Tests use mock commands where possible
352- - [ ] Tests pass with ` cargo test -- --test-threads=1 `
360+ - [x] Integration tests cover main workflows (for installed/explicit modules)
361+ - [x] Tests use mock commands where possible (mock pacman scripts)
362+ - [x] Tests pass with ` cargo test -- --test-threads=1 ` (for completed modules)
363+ - [ ] Additional integration tests for persist module (pending)
353364
354365#### Task 3.8.3: Documentation and Examples
355366
@@ -376,7 +387,7 @@ This module is foundational and used by other modules (deps, install) for packag
376387``` toml
377388[features ]
378389default = [" aur" ]
379- index = [] # No additional dependencies, uses std and serde
390+ index = [" dep:tokio " ] # For async operations with spawn_blocking
380391
381392[dependencies ]
382393# Index module dependencies (always included)
@@ -388,7 +399,7 @@ fuzzy-matcher = { version = "0.3", optional = true } # For fuzzy search
388399tokio = { version = " 1" , features = [" rt" , " time" ], optional = true } # For async operations
389400```
390401
391- ** Note** : The index module should work without async by default, but async operations are available when ` tokio ` feature is enabled.
402+ ** Note** : The index module includes tokio as a dependency for async operations. Async functions are available when the ` index ` feature is enabled.
392403
393404---
394405
@@ -466,30 +477,33 @@ Once the index module is complete, Pacsea can:
466477
467478The Index Module is complete when:
468479
469- - [ ] All core functionality ported (installed queries, official queries, persistence)
470- - [ ] No dependencies on Pacsea internals
471- - [ ] All functions have rustdoc documentation
472- - [ ] Unit tests pass
473- - [ ] Integration tests pass
480+ - [x] Installed package queries ported (Task 3.2)
481+ - [x] Explicit package tracking ported (Task 3.2)
482+ - [x] Official repository queries ported (Task 3.3)
483+ - [ ] Index persistence ported (Task 3.4)
484+ - [x] No dependencies on Pacsea internals (for completed tasks)
485+ - [x] All functions have rustdoc documentation (for completed tasks)
486+ - [x] Unit tests pass (for completed tasks)
487+ - [x] Integration tests pass (for completed tasks)
474488- [ ] Example program works
475- - [ ] Code passes ` cargo fmt ` , ` cargo clippy ` , ` cargo check `
489+ - [x ] Code passes ` cargo fmt ` , ` cargo clippy ` , ` cargo check ` (for completed tasks)
476490- [ ] README updated with index module documentation
477- - [ ] Module entry point complete
491+ - [x ] Module entry point created (Task 3.7 - partial, installed/explicit modules complete)
478492
479493---
480494
481495## Timeline
482496
483- | Task | Estimated Hours | Priority |
484- | ------| ----------------| ----------|
485- | 3.1: Define Types | 2-3 | High |
486- | 3.2: Installed Queries | 4-6 | High |
487- | 3.3: Official Queries | 7-9 | High |
497+ | Task | Estimated Hours | Priority | Status |
498+ | ------| ----------------| ----------| -------- |
499+ | 3.1: Define Types | 2-3 | High | ✅ Complete |
500+ | 3.2: Installed Queries | 4-6 | High | ✅ Complete |
501+ | 3.3: Official Queries | 7-9 | High | ✅ Complete |
488502| 3.4: Persistence | 2-3 | High |
489503| 3.5: Mirror Management | 2-3 | Medium (Optional) |
490504| 3.6: Background Updates | 2-3 | Low (Optional) |
491- | 3.7: Module Entry Point | 1-2 | High |
492- | 3.8: Testing & Docs | 7-10 | High |
505+ | 3.7: Module Entry Point | 1-2 | High | ✅ Partial (installed/explicit/query/fetch complete) |
506+ | 3.8: Testing & Docs | 7-10 | High | ✅ Partial (installed/explicit/query/fetch complete) |
493507| ** Total** | ** 27-39 hours** | |
494508
495509** Recommended Approach** : Start with high-priority tasks (3.1-3.4, 3.7-3.8), then add optional features (3.5-3.6) as needed.
0 commit comments