Create checkpoint before modifying core files. Only creates one checkpoint per session for efficiency. Args: path: Path being modified Raises: FilesystemAccessError: If checkpoint creation fails
(self, path: Path)
| 56 | self._checkpoint_created: bool = False |
| 57 | |
| 58 | def _require_checkpoint(self, path: Path) -> None: |
| 59 | """ |
| 60 | Create checkpoint before modifying core files. |
| 61 | |
| 62 | Only creates one checkpoint per session for efficiency. |
| 63 | |
| 64 | Args: |
| 65 | path: Path being modified |
| 66 | |
| 67 | Raises: |
| 68 | FilesystemAccessError: If checkpoint creation fails |
| 69 | """ |
| 70 | if self._checkpoint_created: |
| 71 | return # Already created checkpoint this session |
| 72 | |
| 73 | try: |
| 74 | create_checkpoint( |
| 75 | reason=f"Self-modification: {path.name}", |
| 76 | files_modified=[str(path)] |
| 77 | ) |
| 78 | self._checkpoint_created = True |
| 79 | info(f"Checkpoint created before modifying {path}") |
| 80 | except Exception as e: |
| 81 | raise FilesystemAccessError(f"Failed to create checkpoint: {e}") |
| 82 | |
| 83 | def _validate_path(self, path: Union[str, Path]) -> Path: |
| 84 | """ |