Skip to content

Surface clear warning to user when files are missing from save directory on load #211

@matt-pharr

Description

@matt-pharr

Problem

When a file is manually deleted from a project's save directory and the user then opens the project, the only visible indication is a warning icon next to the checksum in the bottom-right status bar. There is no clear message telling the user which files are missing or that the save may be corrupted.

Current behavior

copyFilesForLoad() in project-file-sync.ts correctly collects failed paths and logs them:

await fs.copyFile(src, dest).catch((error) => {
  console.warn(`[pdv] load: could not copy ${src}`, error);
  failedPaths.push(treePath);
});

The caller in ipc-register-project.ts logs a summary to console.warn:

if (failedPaths.length > 0) {
  console.warn(
    `[pdv] load: ${failedPaths.length} file(s) could not be copied from save directory:`,
    failedPaths,
  );
}

But this information is only visible in the dev console — not surfaced to the user. The failedPaths array is not passed to the kernel or renderer. The user sees only a mismatched checksum icon with no explanation.

Expected behavior

After project load, if any files were missing from the save directory, the user should see a clear message in the execution console, e.g.:

Project loaded (13 nodes). Warning: files for the following tree nodes were missing from save. Were they modified manually between sessions?

  • notes.intro
  • data.mesh

This should appear:

  1. In the renderer's console panel (the execution console the user sees)
  2. Optionally as a toast/notification

Implementation notes

  • failedPaths is already collected by copyFilesForLoad() — it just needs to be forwarded to the kernel's load response or emitted as a separate push notification
  • The Python-side handle_project_load could accept a missing_files field in the load payload and include it in the pdv.project.loaded push
  • Alternatively, the main process could send a dedicated pdv.project.load_warning push to the renderer

Affected components

  • electron/main/ipc-register-project.ts — load handler (line ~320)
  • electron/main/project-file-sync.tscopyFilesForLoad() already returns failedPaths
  • electron/renderer/src/app/index.tsx or console component — display the warning
  • Optionally: pdv-python/pdv/handlers/project.pyhandle_project_load() to accept/emit warnings

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions