Problem
The session JSON file stores every piece of novel data twice:
- Top-level keys —
title, premise, genre, chapters, etc. (~199 KB)
progress_data.snapshot — An identical copy (~199 KB)
Two independent persistence paths evolved:
save_session_state() writes top-level keys
persist_completed_chapters() writes full progress_manager.get(token) dict (including snapshot)
Duplication doubles file size (~400 KB before chapters, ~1-2 MB for 25-chapter novel).
Files Affected
novelforge/routes/generation/chapters.py lines 67-102
novelforge/routes/generation/revision.py lines 78-92
novelforge/routes/export.py lines 113, 138, 555-603
novelforge/session/persistence.py lines 226-280, 329-351, 354-407, 471-512
novelforge/progress.py
Why It Matters
- File size is 2x what it needs to be
- Two copies can drift if a bug updates one but not the other
- ~200 KB redundant data through read-modify-write cycle on every chapter completion
Recommended Approach
- Stop persisting the snapshot — strip
snapshot from progress data before writing
- Rebuild snapshot on load from top-level keys
- Eliminate
completed_chapters / chapters_done duplication
- Ensure every stage change persists
- Backward compatibility for old session files
Problem
The session JSON file stores every piece of novel data twice:
title,premise,genre,chapters, etc. (~199 KB)progress_data.snapshot— An identical copy (~199 KB)Two independent persistence paths evolved:
save_session_state()writes top-level keyspersist_completed_chapters()writes fullprogress_manager.get(token)dict (includingsnapshot)Duplication doubles file size (~400 KB before chapters, ~1-2 MB for 25-chapter novel).
Files Affected
novelforge/routes/generation/chapters.pylines 67-102novelforge/routes/generation/revision.pylines 78-92novelforge/routes/export.pylines 113, 138, 555-603novelforge/session/persistence.pylines 226-280, 329-351, 354-407, 471-512novelforge/progress.pyWhy It Matters
Recommended Approach
snapshotfrom progress data before writingcompleted_chapters/chapters_doneduplication