refactor(io): split persistence/mod.rs into focused sub-modules (improvise-nr5)

Pure relocation, no behaviour change. 2783 lines in one file became:

  mod.rs              the document lifecycle (save/load/gzip/legacy-JSON over
                      Storage) plus the pub facade re-exporting the rest
  quoting.rs          CL-style |…| quoting, the one thing format and parse share
  format.rs           format_md + format_number, persisted_initial_view, coord_str
  parse.rs            parse_md + ImprovParser/Rule, parse_number_cell, and the
                      parser property/edge-case tests and grammar generator
  export.rs           export_csv / export_csv_to / render_csv
  roundtrip_tests.rs  the format_md <-> parse_md characterization suite, which
                      belongs to neither side on its own

Every function moved with its tests where ownership was clear; the 34 tests
that exercise both directions went to roundtrip_tests.rs. `coord` and
`two_cat_model`, previously copied per test module, are now one `test_helpers`
module in mod.rs.

No test changed meaning: all 97 persistence tests still pass, and each moved
function body is identical modulo indentation and the visibility keyword on the
five quoting helpers (now pub(super)).

The public API is unchanged — save, load, save_to, load_from, autosave_path,
format_md, parse_md, export_csv and export_csv_to all still resolve through
`crate::persistence`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EoW5BB87ZZdm96SvBTWawH
This commit is contained in:
Edward Langley
2026-09-19 13:35:39 -07:00
parent 2d7ff6e00c
commit 87f86d7eb5
8 changed files with 2639 additions and 2574 deletions
+1 -1
View File
@@ -862,7 +862,7 @@ mod tests {
//
// Uses pest_meta to read formula.pest at test time and walks the grammar
// AST to generate random valid formulas. Mirrors the pattern used by the
// persistence parser tests in src/persistence/mod.rs.
// persistence parser tests in src/persistence/parse.rs.
#[cfg(test)]
mod generator {