-
Notifications
You must be signed in to change notification settings - Fork 7
Description
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
- Open a Deepnote notebook backed by a
.deepnotefile. - Ensure the
.deepnotefile contains:metadata.snapshotHash- Per-block
contentHash(and/or other integrity fields)
- Modify the
.deepnotefile on disk via an external editor or automated tool (e.g., append a new block / update an existing block’scontent), without also recomputing the hashes. - 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
.deepnotefile 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
.deepnoteeffectively non-editable by automated tooling unless the tool also implements Deepnote’s hashing scheme.
Suggested fixes (choose one, or combine)
-
Recompute hashes on load / file change
- When detecting a file change, parse the YAML and recompute
contentHashfor each block andsnapshotHashfor the notebook. - Treat hashes as derived metadata, not as a gate to ignore changes.
- When detecting a file change, parse the YAML and recompute
-
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.
- If hash validation fails, surface a notification:
-
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.
-
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.