Skip to content

Feature/preserve parameter#12

Merged
Qrashi merged 4 commits into
release/0.5.1from
feature/preserve_parameter
Jan 15, 2026
Merged

Feature/preserve parameter#12
Qrashi merged 4 commits into
release/0.5.1from
feature/preserve_parameter

Conversation

@Qrashi

@Qrashi Qrashi commented Jan 15, 2026

Copy link
Copy Markdown
Collaborator

Add preserve parameter and member to JSONFile

@Qrashi Qrashi requested a review from Copilot January 15, 2026 17:23
@Qrashi Qrashi changed the base branch from main to release/0.5.1 January 15, 2026 17:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds a preserve parameter and member to the JSONFile class to allow preserving corrupted/invalid JSON files before overwriting them with defaults during recovery operations.

Changes:

  • Added preserve parameter to JSONFile.__init__(), reload(), and restore_default() methods
  • Implemented automatic backup functionality that renames existing files to <filename>.old.<n>.json before recovery
  • Added property getter/setter for the preserve instance member
  • Updated documentation to describe the preserve feature

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/singlejson/fileutils.py Implements preserve parameter, backup logic with incremental naming, and refactors restore_default() to consolidate file writing
src/singlejson/pool.py Adds preserve parameter to load() function with documentation
tests/test_reload_strict_recover.py Adds tests for preserve functionality including incremental backup naming
tests/test_pool.py Adds test for preserve parameter in pool.load()
docs/source/defaults.rst Documents the preserve feature and fixes heading underline
docs/source/pooling.rst Documents preserve parameter usage in pool operations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/singlejson/fileutils.py
Comment thread src/singlejson/fileutils.py Outdated
fix typos and rewrite docstring

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Qrashi Qrashi merged commit 52472e9 into release/0.5.1 Jan 15, 2026
2 checks passed
@Qrashi

Qrashi commented Jan 15, 2026

Copy link
Copy Markdown
Collaborator Author

This closes #11

@Qrashi Qrashi deleted the feature/preserve_parameter branch January 16, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add "preserve" option or similar to enable keeping a copy of file with issues

2 participants