Skip to content

Rename ctx.notify to broadcast_raw_notification#9581

Open
manzt wants to merge 3 commits into
mainfrom
push-orzswlykukvt
Open

Rename ctx.notify to broadcast_raw_notification#9581
manzt wants to merge 3 commits into
mainfrom
push-orzswlykukvt

Conversation

@manzt
Copy link
Copy Markdown
Collaborator

@manzt manzt commented May 18, 2026

The old name read like a toast helper, but the method is a low-level escape hatch that takes a fully-constructed Notification payload and puts it on the kernel's outbound stream.

Copilot AI review requested due to automatic review settings May 18, 2026 17:40
@manzt manzt added the enhancement New feature or request label May 18, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented May 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment May 19, 2026 1:38pm

Request Review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Renames the low-level code-mode context method for sending fully constructed frontend Notification payloads, clarifying that it is a raw “escape hatch” rather than a higher-level UI helper.

Changes:

  • Renamed ctx.notify(...) to ctx.broadcast_raw_notification(...) in code-mode transaction broadcasting.
  • Expanded the method docstring to describe intended use, tradeoffs, and example notification types.

Comment thread marimo/_code_mode/_context.py Outdated
Comment on lines +1725 to +1726
notification: A typed ``Notification`` instance. See module
docstring above for the available subtypes.
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Architecture diagram
sequenceDiagram
    participant CM as Code Mode
    participant Kernel as Kernel
    participant Stream as Outbound Stream
    participant Frontend as Frontend UI

    Note over CM,Frontend: Code Transaction Flow
    
    CM->>CM: _apply_ops() builds doc_ops
    CM->>CM: Create Transaction from doc_ops
    CM->>CM: Apply transaction to local document
    
    CM->>Kernel: broadcast_raw_notification(NotebookDocumentTransactionNotification)
    Note over CM,Kernel: Takes fully-constructed Notification payload
    
    Kernel->>Stream: broadcast_notification(notification, stream)
    Note over Kernel: No validation, batching, or debouncing
    
    Stream-->>Frontend: Deliver transaction notification
    Frontend->>Frontend: Apply document transaction to UI state

    Note over CM,Stream: Other callers
    
    alt Enqueueing commands
        CM->>CM: enqueue_command(CommandMessage)
        CM->>Kernel: broadcast_raw_notification(…)
    end
    
    alt Banner notifications
        CM->>Kernel: broadcast_raw_notification(BannerNotification)
    end
    
    alt Alert dialogs
        CM->>Kernel: broadcast_raw_notification(AlertNotification)
    end
    
    alt Package install progress
        CM->>Kernel: broadcast_raw_notification(InstallingPackageAlertNotification)
    end
    
    alt Missing package prompts
        CM->>Kernel: broadcast_raw_notification(MissingPackageAlertNotification)
    end
    
    alt Reload notification
        CM->>Kernel: broadcast_raw_notification(ReloadNotification)
    end

    Note over CM,Frontend: All notifications flow through same path
Loading

Re-trigger cubic

manzt and others added 3 commits May 19, 2026 09:37
The old name read like a toast helper, but the method is a low-level
escape hatch that takes a fully-constructed `Notification` payload and
puts it on the kernel's outbound stream.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants