Skip to content

v0.21.0-alpha — managed backups dir + auto-save fix

Choose a tag to compare

@ghbalf ghbalf released this 27 Jul 01:14
· 107 commits to master since this release

A fix-and-cleanup release for the pre-execution recovery snapshots that execute_code writes before running generated code. Prompted by a contributor bug report (@FairlyInconspicuous) and a design proposal (@3dyuval).

Changed

  • Recovery snapshots now live in a managed backups dir (#46) — _auto_save writes the pre-execution snapshot to CONFIG_DIR/backups/<name>.<hash>.ai-backup.FCStd instead of dropping an .ai-backup.FCStd file beside the user's document. The project folder stays clean; each source path maps to one stable, hash-tagged file that is overwritten in place (collision-safe across same-named documents in different folders).

Added

  • max_backups config knob (#46, JSON-only) — count cap for the recovery snapshots in CONFIG_DIR/backups, pruned via the shared prune_oldest_files helper (also honours the existing max_retention_age_days). Defaults to 0 (keep all) to preserve prior behavior on upgrade; growth is naturally bounded since each document reuses one file. Recommended value for a hard cap: 50.

Fixed

  • Auto-save no longer compounds .FCStd onto the document filename (#44, thanks @FairlyInconspicuous) — _auto_save rebuilt the document path by string-editing the name FreeCAD's saveAs had already mutated, leaving a trailing .FCStd and growing the filename by one extension on every execute_code call (and littering the folder with never-reused snapshots). It now captures and restores the original path verbatim. Ships with unit-lane regression coverage.

Follow-up: restore-from-backup (surfacing these snapshots after a crash) is tracked in #49.

Full changelog: https://github.com/ghbalf/freecad-ai/blob/master/CHANGELOG.md