Summary
PR #25 functionally resolves the core of #24 (duplication removed; CLI now delegates to library; path generation unified). To fully meet the success criteria outlined in #24’s plan, the following follow-ups remain.
References:
Remaining work (high-value follow-ups)
-
Library-level export integration tests
- Create tests/tests_export_integration.rs (or similar) to exercise:
- export_to_csv, export_to_gpx (with/without log_start_datetime), export_to_event
- Multi-log suffix behavior (.NN), output_dir override, and defaulting to input’s parent dir
- Byte-for-byte comparisons against known-good fixtures where applicable
- Validate failure modes (nonexistent output_dir, unwritable paths) and error surfaces.
-
GPX-only export: ensure output_dir is created
- In src/export.rs::export_to_gpx(), mirror export_to_csv’s directory creation behavior (create_dir_all).
- Add a test that requests GPX export into a fresh (nonexistent) directory.
-
Early-return path calculation cleanup
- When gps_coordinates.is_empty(), return Ok(()) without computing paths (avoid coupling logic to CLI messaging).
- Keep CLI messaging relying on compute_export_paths() for consistent file names.
-
Naming and fallback consistency
- Unify base-name fallback (e.g., use “blackbox” everywhere) across CSV/GPX/event and CLI status messages.
- Consider reusing compute_export_paths() inside export_to_gpx/export_to_event to prevent drift.
-
Optional API enhancement (follow-up discussion)
- Have export functions return a small “ExportReport { csv_path, gpx_path, event_path }” for the files actually written. This allows the CLI to print the exact paths and reduces duplication.
AI-instructional implementation plan
A) Tests
- Add tests under tests/ with fixture inputs in tests/fixtures/.
- Use tempdir to isolate outputs; exercise ExportOptions variants and multi-log inputs.
- Assert naming (.NN), directory resolution, and presence/absence of formats as configured.
- Include one large-GPS-log case to validate timestamp generation pathways.
B) GPX directory creation
- src/export.rs::export_to_gpx():
- Resolve output_dir as today; if !exists, create_dir_all(output_dir)? before File::create.
- Unit/integration test to cover the GPX-only case.
C) Early-return simplification
- If gps_coordinates.is_empty(), return Ok(()) immediately.
- Ensure CLI status printing continues to use compute_export_paths().
D) Naming/fallback consistency
- Choose a single fallback base name (“blackbox”).
- Audit export_to_csv/export_to_gpx/export_to_event + any CLI helpers; align constants.
- Prefer compute_export_paths() within export functions (or ensure any local logic is identical).
E) Documentation
- Add a short “Exporting Data” section with examples to README or CRATE_USAGE.md.
- Document ExportOptions defaults and typical CLI mappings.
Acceptance criteria
- New tests pass across platforms; coverage includes multi-log and directory-creation paths.
- GPX-only export does not fail when output_dir is absent.
- Early-return produces no message/path mismatch; CLI messages remain correct via compute_export_paths().
- Fallback naming is consistent in code and printed messages.
- Documentation reflects the unified export layer and examples compile.
Requested by: @nerdCopter on 2025-12-08
Summary
PR #25 functionally resolves the core of #24 (duplication removed; CLI now delegates to library; path generation unified). To fully meet the success criteria outlined in #24’s plan, the following follow-ups remain.
References:
Remaining work (high-value follow-ups)
Library-level export integration tests
GPX-only export: ensure output_dir is created
Early-return path calculation cleanup
Naming and fallback consistency
Optional API enhancement (follow-up discussion)
AI-instructional implementation plan
A) Tests
B) GPX directory creation
C) Early-return simplification
D) Naming/fallback consistency
E) Documentation
Acceptance criteria
Requested by: @nerdCopter on 2025-12-08