Skip to content

refactor: daemon-owned notebook loading — eliminate NotebookState #598

@rgbkrk

Description

@rgbkrk

The Tauri app currently loads .ipynb files, parses them into NotebookState, and populates the daemon's Automerge room via mutations. This is backwards — saving is already daemon-delegated, loading should be too.

Status

Completed ✅ (merged to main)

In review: Phase 4 + 6 + 7 — PR #602

  • Phase 4: All notebook creation/opening entry points converted to daemon requests
  • Phase 6: Session save reads from Arc fields instead of NotebookState
  • Phase 7: notebook_state field removed from WindowNotebookContext, FrontendCell removed from lib.rs, dead code deleted (-513 lines)
  • Bug fixes: placeholder_id for Restore variant, persisted Automerge doc preservation for untitled notebooks

Remaining (minor follow-up)

  • notebook_state.rs module file still declared — can be deleted once no external crate references it

Target flow

Tauri sends OpenNotebook { path } to daemon
  → daemon loads .ipynb, derives notebook_id, creates room, populates doc
  → daemon returns NotebookConnectionInfo { notebook_id, cell_count, needs_trust_approval }
  → Automerge sync → relay forwards bytes → frontend WASM
  → frontend shows loading state until cells arrive (#599)

What gets eliminated

  • NotebookState struct usage from lib.rs and session.rs
  • initialize_notebook_sync's cell/metadata population through the relay
  • load_notebook_state_for_path, create_new_notebook_state factory functions
  • All new_empty_with_* constructor usage
  • derive_notebook_id in Tauri (daemon owns this now)
  • FrontendCell usage in lib.rs
  • get_cells() call in save_notebook_as (daemon has the cells)

Dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions