Fix history_tree_backup bloat: strip snapshot data from backups
The history_tree_backup (created by _delete_nodes) was storing full snapshot data in every backed-up node — 185MB+ per backup entry. This caused the JSON file to re-bloat to 300MB on every save. Now: - _delete_nodes backs up tree metadata only (no snapshot data) - Load paths strip snapshot data from existing backup entries - Prevents both disk and RAM bloat from backup accumulation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -297,6 +297,10 @@ def index():
|
||||
if tree and isinstance(tree, dict):
|
||||
for node in tree.get('nodes', {}).values():
|
||||
node.pop('data', None)
|
||||
for backup in data.get('history_tree_backup', []):
|
||||
if isinstance(backup, dict):
|
||||
for node in backup.get('nodes', {}).values():
|
||||
node.pop('data', None)
|
||||
pane_state.data_cache = data
|
||||
pane_state.last_mtime = fp.stat().st_mtime if fp.exists() else 0
|
||||
pane_state.loaded_file = str(fp)
|
||||
@@ -337,6 +341,11 @@ def index():
|
||||
if tree and isinstance(tree, dict):
|
||||
for node in tree.get('nodes', {}).values():
|
||||
node.pop('data', None)
|
||||
# Strip snapshot data from history_tree_backup to prevent RAM/disk bloat
|
||||
for backup in data.get('history_tree_backup', []):
|
||||
if isinstance(backup, dict):
|
||||
for node in backup.get('nodes', {}).values():
|
||||
node.pop('data', None)
|
||||
state.data_cache = data
|
||||
state.last_mtime = fp.stat().st_mtime if fp.exists() else 0
|
||||
state.loaded_file = str(fp)
|
||||
|
||||
Reference in New Issue
Block a user