feat(runtimed): format-on-execute, remove Tauri format_cell command#563
Merged
feat(runtimed): format-on-execute, remove Tauri format_cell command#563
Conversation
The daemon now formats cell source before execution (best-effort, non-blocking on failure). This replaces the Tauri-mediated format_cell command and moves formatting ownership fully to the daemon. Daemon changes: - Extract format_source() helper from format_notebook_cells() - Add format-on-execute in ExecuteCell handler: format source, write back to Automerge doc, then queue for kernel execution - format_notebook_cells() refactored to use format_source() (format-on-save was already daemon-owned) Tauri removals (-111 lines): - format_cell command (was last consumer of handle.get_cells() + handle.update_source(), blocking relay simplification) - check_formatter_available command (zero frontend callers) - Both invoke_handler registrations Frontend changes: - Remove cell:source_updated listener (only emitter was format_cell) - formatCell callback becomes no-op (⌘⇧F keybinding is vestigial, formatted source arrives via Automerge sync after execution)
278e7a5 to
f4f54a0
Compare
rgbkrk
added a commit
that referenced
this pull request
Mar 8, 2026
* refactor(notebook): remove fallback branches, keep mutation-based initialization This PR simplifies the Tauri relay architecture (issue #556): Task 1: Remove NotebookState fallback branches - Remove fallback in get_preferred_kernelspec() - now requires daemon - Remove fallback in verify_notebook_trust() - now requires daemon Keeps mutation-based cell initialization: - The initial_cells via handshake approach was reverted because: 1. Handshake has 64 KiB frame limit - large notebooks would fail 2. Architecturally wrong - daemon should determine cell seeding - Mutations (add_cell, update_source, set_metadata) remain for now - NotebookState.path sync restored for session restore compatibility * chore(notebook): remove dead get_preferred_kernelspec and format module Addresses #596: - Delete get_preferred_kernelspec Tauri command (zero frontend callers) - Delete format module (202 lines, zero callers after #563) Frontend reads kernelspec from WASM doc via useSyncExternalStore. Formatting now lives in daemon (format-on-execute).
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.
The daemon now formats cell source before execution, replacing the Tauri-mediated
format_cellcommand. Formatting ownership is fully daemon-side.How it works
Format-on-execute: When a cell is executed (Shift+Enter), the daemon formats the source with ruff (Python) or deno fmt (Deno) before queuing it for the kernel. The formatted source is written back to the Automerge doc and syncs to all peers. Best-effort — if formatting fails (syntax error, formatter unavailable), the original source executes unchanged.
Format-on-save: Already daemon-owned since PR #545. No change here.
QA
x=1+2→ Shift+Enter → source reformats tox = 1 + 2What was removed
Tauri commands (−111 lines Rust):
format_cellcommandhandle.get_cells()+handle.update_source()— blocking relay simplification (#556)check_formatter_availablecommandcell:source_updatedevent emissionformat_cellFrontend (−25 lines TS):
⌘⇧F/Ctrl+Shift+FkeybindingonFormatprop chainuseCellKeyboardNavigation→CodeCell→NotebookView→App.tsxformatCellcallback inuseAutomergeNotebookcell:source_updatedlistenerDaemon changes
format_source()helper fromformat_notebook_cells()— reusable for single-cell formattingdetect_room_runtime()helper — shared between format-on-execute and format-on-saveExecuteCellhandler before kernel queue−164 net lines. Unblocks relay simplification by removing the last
handle.get_cells()consumer in Tauri.