Enforce feature isolation and expand copy_count test coverage

- Gate env_logger init behind #[cfg(feature = "bin-logging")] in
  records.rs main() so the binary respects the feature flag
- Set default-features = false on the dev-dependency self-reference
  in Cargo.toml; previously default features were silently re-enabled
  during tests, making feature isolation accidental rather than real
- Bind guid.to_string() once per card in user_data.rs deck loop and
  reuse it via clone, replacing three allocations per locked card
- Add per-field help text to the Track subcommand args clarifying
  human-readable names ("Laguna Seca", "Dry") vs raw codes
- Document write_details_csv DashMap snapshot memory tradeoff
  (full clone, roughly doubled peak memory during the write)
- Extend my_cars fixture test: duplicate guids count as 2 copies
  with per-copy configs, and incomplete-tune cards still count in
  copy_count
This commit is contained in:
Jan-Peter von Hunnius 2026-08-15 21:30:38 +02:00
parent 1a844e7aa8
commit ec8be9d138
5 changed files with 35 additions and 9 deletions

View file

@ -67,8 +67,9 @@ pub fn load_my_cars_data(path: &str) -> Result<MyCarsData, AppError> {
for card in deck {
if card.get("locked").and_then(|v| v.as_bool()).unwrap_or(false) {
if let Some(guid) = card.get("cardId").and_then(|v| v.as_str()) {
owned.insert(guid.to_string());
*copy_count.entry(guid.to_string()).or_insert(0) += 1;
let guid = guid.to_string();
owned.insert(guid.clone());
*copy_count.entry(guid.clone()).or_insert(0) += 1;
// Extract actual tune config: engineMajor + weightMajor + chassisMajor.
// Skip cards with incomplete tune data to avoid false "000" entries
// that would incorrectly appear as needing upgrade.
@ -77,7 +78,7 @@ pub fn load_my_cars_data(path: &str) -> Result<MyCarsData, AppError> {
let chassis = card.get("chassisMajor").and_then(|v| v.as_u64());
if let (Some(e), Some(w), Some(c)) = (engine, weight, chassis) {
let config = format!("{e}{w}{c}");
owned_configs.entry(guid.to_string()).or_default().push(config);
owned_configs.entry(guid).or_default().push(config);
} else {
log::warn!("locked card {guid} has incomplete tune data — skipped");
}