Skip to content

External edits to .deepnote don’t appear in notebook UI #315

@Artmann

Description

@Artmann

When a .deepnote file is modified externally (e.g., by Cursor AI using file patches), the Deepnote notebook UI does not reflect the changes. This appears to be caused by snapshotHash and per-block contentHash fields being treated as authoritative; if they don’t match the file contents, the extension ignores/rejects updates.

Environment

  • Editor: Cursor / VS Code
  • Deepnote notebook format: .deepnote (YAML)
  • Deepnote extension: notebook provider using VS Code Notebook API

Repro steps

  1. Open a Deepnote notebook backed by a .deepnote file.
  2. Ensure the .deepnote file contains:
    • metadata.snapshotHash
    • Per-block contentHash (and/or other integrity fields)
  3. Modify the .deepnote file on disk via an external editor or automated tool (e.g., append a new block / update an existing block’s content), without also recomputing the hashes.
  4. Return to the notebook UI.

Expected behavior

  • The notebook UI updates to reflect the file changes (or at minimum prompts the user that the file changed and offers to reload/accept changes).

Actual behavior

  • Changes in the .deepnote file do not show up in the notebook UI.
  • The UI appears to keep the prior in-memory model / prior parsed state.

Likely cause

The extension likely validates snapshotHash and/or each block’s contentHash against the actual YAML content. When the file is edited externally, those hashes are stale or missing, so the extension treats the update as invalid and discards it (or doesn’t apply it to the notebook model).

Why this matters

  • Any external tool that edits .deepnote (including Cursor AI, formatting tools, scripts, git conflict resolution, etc.) can create “invisible” changes that never render in the notebook UI.
  • This makes .deepnote effectively non-editable by automated tooling unless the tool also implements Deepnote’s hashing scheme.

Suggested fixes (choose one, or combine)

  1. Recompute hashes on load / file change

    • When detecting a file change, parse the YAML and recompute contentHash for each block and snapshotHash for the notebook.
    • Treat hashes as derived metadata, not as a gate to ignore changes.
  2. Fail open with a clear UX

    • If hash validation fails, surface a notification:
      • “Notebook file changed externally and hashes are out of date. Reload and regenerate hashes?”
    • Provide buttons: Reload, Regenerate hashes, View diff.
  3. Ignore hashes for local file reload

    • Use hashes only for caching/optimization, not for correctness.
    • If parsing succeeds, update the notebook model from file regardless of hash mismatch.
  4. Provide an official “rehash” command

    • Command palette: “Deepnote: Recompute notebook hashes from file”
    • Useful for CI/scripts and for recovery after git merges.

Notes

Cursor AI edits the .deepnote file directly as text. If the extension expects hash-consistency, it will reject those changes unless the extension recomputes or relaxes validation. A robust approach is to treat the YAML as source-of-truth and regenerate integrity metadata automatically.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions