Migrate importer path APIs and state to `pathlib.Path`
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 2.1k
- Avg merge
- 4d 21h
- Merged PRs (30d)
- 31
Description
Part of: #1409
Depends on: the library-directory Path migration.
## Problem
Importer code still passes paths through sessions, tasks, factories, and persisted import state using byte-oriented contracts. That keeps byte conversions scattered across import flow code and blocks tests from treating importer-owned paths as normal `Path` values.
## Expected behavior
- `ImportSession`, import tasks, task factories, and importer stages use `Path` for filesystem paths.
- `ImportTask.paths` and related task state expose `Path` values at runtime.
- `sorted_walk` and `albums_in_dir` use `Path` during importer directory discovery.
- Persisted import state decodes legacy byte/string values when loading and stores only through an explicit serialization boundary.
- Import UI and plugin event payloads receive `Path` values where they describe filesystem paths.
- Existing behavior for resumable imports, duplicate detection, art lookup, and plugin hooks is preserved.
## Suggested fix
Migrate importer state and task types together so each importer path has one runtime representation. Keep encoding and decoding local to state persistence and any external format that still requires primitive values.
## Acceptance criteria
- Importer path APIs no longer require caller-side `os.fsencode` or `os.fsdecode`.
- Importer directory discovery works with Path-based `sorted_walk` and `albums_in_dir`.
- Legacy import state remains readable.
- Importer tests and affected plugin tests use `Path` at the runtime boundary.
- `poe test` and `poe lint` pass with coverage at or above 80%.
Contributor guide
Research direction
Start by reviewing open pull request #6994, then trace ImportSession, import tasks and factories, importer stages, sorted_walk, and albums_in_dir to identify the runtime path boundaries. Verify that legacy import state still loads, serialization remains explicit, affected importer and plugin tests use Path values, and poe test and poe lint pass with at least 80% coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100