File UUID organization#208
Merged
matt-pharr merged 20 commits intodevelopfrom Apr 26, 2026
Merged
Conversation
Replace path-derived filesystem locations with stable UUIDs for all file-backed tree nodes. Each node gets a 12-hex-char UUID at creation time; files live at <dir>/tree/<uuid>/<filename> so renames, moves, and tree restructuring never require file copies or path updates. Key changes: - PDVFile and subclasses (PDVScript, PDVNote, PDVGui, PDVLib, PDVNamelist) store uuid + filename instead of relative_path - serialize_node / deserialize_node use uuid_tree_path() for all I/O - Tree mutations (rename, move, duplicate) are O(1) for file nodes — only duplicate needs a fresh UUID and file copy - Module import generates fresh UUIDs per file and copies to working dir - Early module setup between load passes so custom serializers register before data deserialization - Orphaned tree/<uuid>/ directories are purged after each save - smart_copy() with optional reflink-copy for CoW on supported filesystems Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
writeModuleManifestsToSaveDir was overwriting each module's pdv-module.json without carrying forward entry_point and default_gui. These fields are set at import time and not tracked in the kernel tree, so the kernel-side manifest collector cannot emit them. Without them, project load could not import custom serializers (entry_point) and modules did not appear in the activity bar (default_gui). Now reads the existing project-local manifest before overwriting, with a fallback to the globally installed module for projects saved before this fix. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add §6.3 describing the UUID storage design — UUIDs, path resolution, smart_copy, orphan cleanup, and the tree-index.json invariant. Update §5.8–5.12 (PDVFile and subclasses) to reference uuid/filename instead of relative_path. Update §6.1/§6.2 directory layouts and §7.3 storage object format to reflect UUID-based paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ng path in pdv_tree
Owner
Author
|
Added pdv.save_project(), pdv.load_project(), but are flaky. Still have to debug. |
Python-initiated saves (pdv.save_project()) deadlocked because the kernel shell was busy executing user code when the comm round-trip arrived. Serialize tree directly in Python and send results via a new pdv.project.save_completed push, skipping the comm entirely. Add __dir__/__getattr__ to the pdv package so Jedi autocomplete shows PDVApp methods (save_project, save, open_project, etc.) alongside module attributes. Add __getattr__ to PDVApp so module-level names like PDVTree work whether pdv resolves as the instance or the module. Also wrap the entire handle_project_save body in try/except and add a serialization guard to prevent concurrent saves from racing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…gs, add comments - Add clearCachedKernelResults() to ProjectManager; call it on kernels:stop so abandoned Python-initiated saves don't leak stale serialization data into a new session. - Demote save-path console.log calls to console.debug (7 sites across project-manager.ts and ipc-register-project.ts). - Fix dangling JSDoc block on the _cachedKernelResults field. - Add comment explaining the storage.value module_id fallback in _early_module_setup for pre-UUID project compat. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Here's a PR summary:
UUID-based file storage and Python-initiated save/load
Summary
PDVScript,PDVLib,PDVGui,PDVNote,PDVNamelist) now gets a 12-hex UUID and stores its backing file at<workdir>/tree/<uuid>/<filename>. Tree paths are fully decoupled from the filesystem — renames, moves, and restructures no longer require file copies or renames.pdv.save_project(),pdv.save_project_as(),pdv.open_project(), andpdv.add_file()APIs let users save, load, and import files directly from the console or scripts without going through the GUI._purge_orphaned_tree_filesremoves UUID directories in the save dir that no longer correspond to any live tree node, preventing stale files from accumulating across save cycles.resolveNodePath/resolveNodeDirhelpers: Centralized TS-side path resolution mirroringPDVFile.resolve_path()on the Python side. All hardcodedpath.join(workingDir, "tree", ...)calls replaced.working_dir_tree_path(), alias-based module scaffolding, stalePDVScriptRegisterPayloadinterface, and dead_relocate_filesparameter all removed.Version
0.0.12(bothelectron/package.jsonandpdv-python/pyproject.toml)Tests
Notable changes by area
pdv-python/pdv/tree.pyPDVFilebase class with UUID, filename,resolve_path(). All file-backed node types inherit it.pdv-python/pdv/namespace.pyPDVAppgainssave_project,save_project_as,open_project,add_filemethodspdv-python/pdv/handlers/project.pyserialize_tree_to_dir,_early_module_setupfor lib sys.path wiring during load, orphan purgepdv-python/pdv/handlers/modules.pyhandle_module_reload_libsrewritten to walkPDVLibnodes via_iter_pdv_libs+resolve_path()instead of hardcoded alias pathspdv-python/pdv/environment.pyuuid_tree_path(),smart_copy(),generate_node_uuid(). Legacyworking_dir_tree_path()removedelectron/main/pdv-protocol.tsresolveNodePath(),resolveNodeDir()helperselectron/main/project-manager.tsclearCachedKernelResults()on kernel stopelectron/main/ipc-register-project.tssave_completedpush handler, save sequencing via chained promiseselectron/main/project-file-sync.tsresolveNodePathARCHITECTURE.md