Expand description
Save-path token expansion (M173 Lane A — Decision 5). Save-path token expansion (M173 Lane A — Decision 5).
Implements the locked five-token grammar that expands the on-disk
CategoryRegistry save_path template into a concrete download
directory at torrent-add time. The grammar is intentionally small and
frozen: additions go through a separate plan (and a separate version
bump). qBt-parity is the design constraint.
§Grammar
| Token | Source | Example |
|---|---|---|
{category} | CategoryRegistry lookup of the named category | Linux |
{tracker} | TorrentSavePathContext::primary_tracker_host() (lowercased hostname) | archlinux.org |
{yyyy} | UTC year of TorrentSavePathContext::added_at | 2026 |
{mm} | UTC two-digit month of TorrentSavePathContext::added_at | 04 |
{content_type} | TorrentSavePathContext::classified_content_type() | Audio |
Unknown tokens return ExpandSavePathError::UnknownToken — never a
silent literal pass-through, never an empty string. This is the
[REGRESSION CRITICAL] failure-mode test pinned in the master plan
“Required test coverage” section.
§Lane purity
This module is the only addition Lane A makes inside irontide-session.
It is invisible to apply_settings, never spins up any actor, never
mutates session state, and exposes no async API. The session crate’s
public surface gains:
pub mod save_path;(re-export inlib.rs).- The five public symbols below:
expand_save_path_template,expand_save_path_for_category,TorrentSavePathContext,SimpleContentType,ExpandSavePathError.
See the master plan Decision 5 for the rationale (eng-review §1: the
session owns CategoryRegistry + the global download_dir, so token
expansion lives in irontide-session rather than a new crate or the
GUI).
Structs§
- Torrent
Save Path Context - Per-torrent context used to expand
{tracker}/{yyyy}/{mm}/{content_type}tokens.
Enums§
- Expand
Save Path Error - Errors from save-path expansion.
- Simple
Content Type - Coarse content-type classification surfaced as
{content_type}.
Functions§
- expand_
save_ path_ for_ category - Convenience wrapper that pulls the
save_pathtemplate out of aCategoryRegistrythen delegates toexpand_save_path_template. - expand_
save_ path_ template - Expand the five locked tokens inside
templateagainstctx.