Skip to content

Add connection actor diagrams#125

Merged
leynos merged 5 commits intomainfrom
codex/add-mermaid-diagrams-to-asynchronous-outbound-messaging-desi
Jun 24, 2025
Merged

Add connection actor diagrams#125
leynos merged 5 commits intomainfrom
codex/add-mermaid-diagrams-to-asynchronous-outbound-messaging-desi

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Jun 24, 2025

Summary

  • add class & sequence diagrams for the connection actor and push queues
  • illustrate server-initiated MySQL packets
  • show WebSocket heart-beats and MQTT fan-out

Testing

  • make fmt
  • make lint
  • make test
  • markdownlint docs/asynchronous-outbound-messaging-design.md
  • nixie docs/asynchronous-outbound-messaging-design.md

https://chatgpt.com/codex/tasks/task_e_685a9d7fdaac83229e958179f181f055

Summary by Sourcery

Add visual diagrams and formatting refinements to the asynchronous outbound messaging design document to clarify the connection actor architecture, push-queue processing, WebSocket heart-beats, and MQTT fan-out behavior.

Enhancements:

  • Adjust table header formatting for consistency.
  • Revise phrasing in the prioritized write loop and sequence-id reset descriptions for clarity.

Documentation:

  • Add class diagram detailing ConnectionActor, PushHandle, and SessionRegistry relationships.
  • Add sequence diagrams for outbound frame flow, application push operations, WebSocket heart-beats, and MQTT PUBLISH fan-out.
  • Illustrate server-initiated MySQL packets within the sequence flow.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Jun 24, 2025

Reviewer's Guide

This PR enhances the asynchronous-outbound-messaging design doc by standardizing the requirements table formatting and embedding a set of Mermaid diagrams (class and sequence) to illustrate the ConnectionActor architecture and its various push flows (client‐initiated, application tasks, WebSocket heartbeats, MQTT fan‐out).

Sequence diagram for client-initiated push flow

sequenceDiagram
    participant Client
    participant ConnectionActor
    participant Queue as Outbox
    participant Socket

    Client->>ConnectionActor: Initiate connection/request
    ConnectionActor->>Queue: enqueue outbound frame
    Note over ConnectionActor,Queue: Manages high/low priority queues
    ConnectionActor->>Socket: Write outbound frame (from queue)
    Socket-->>Client: Delivers outbound message
Loading

Sequence diagram for application task push flow

sequenceDiagram
    participant AppTask as Application Task
    participant SessionRegistry
    participant ConnectionActor
    participant Socket
    AppTask->>SessionRegistry: get PushHandle for session
    AppTask->>ConnectionActor: push(OK packet or LOCAL INFILE)
    ConnectionActor->>ConnectionActor: queue frame in outbox
    ConnectionActor->>Socket: write frame (when idle or after command completes)
Loading

Sequence diagram for WebSocket heart-beat push flow

sequenceDiagram
    participant Timer as Heart-beat Timer
    participant ConnectionActor
    participant Socket
    Timer->>ConnectionActor: push_high_priority(Ping frame)
    ConnectionActor->>ConnectionActor: enqueue Ping in high-priority queue
    ConnectionActor->>Socket: write Ping frame (even during response stream)
Loading

Sequence diagram for MQTT broker fan-out push flow

sequenceDiagram
    participant Broker as MQTT Broker
    participant SessionRegistry
    participant ConnectionActor as Client ConnectionActor
    participant Socket
    Broker->>SessionRegistry: get PushHandle for subscriber
    Broker->>ConnectionActor: try_push(PUBLISH frame)
    alt Queue not full
        ConnectionActor->>Socket: write PUBLISH frame
    else Queue full
        ConnectionActor->>ConnectionActor: drop frame
    end
Loading

Class diagram for ConnectionActor, PushHandle, and SessionRegistry

classDiagram
    class ConnectionActor {
        - context: ConnectionContext
        - high_priority_queue: mpsc::Receiver<Frame>
        - low_priority_queue: mpsc::Receiver<Frame>
        - response_stream: Stream<Response>
        - shutdown_signal: CancellationToken
        + run()
        + handle_push()
        + handle_response()
    }
    class PushHandle {
        + push(frame: Frame)
        + try_push(frame: Frame)
        + push_with_policy(frame: Frame, policy: PushPolicy)
    }
    class SessionRegistry {
        - sessions: DashMap<SessionId, Weak<ConnectionActor>>
        + register(session_id, actor)
        + get_handle(session_id): Option<PushHandle>
    }
    ConnectionActor o-- PushHandle : exposes
    SessionRegistry o-- PushHandle : provides
    PushHandle ..> ConnectionActor : queues frames
Loading

File-Level Changes

Change Details Files
Reformatted requirements table header for consistency
  • Adjusted separator rows to use uniform dashes
  • Standardized spacing between columns
docs/asynchronous-outbound-messaging-design.md
Added Mermaid diagrams illustrating ConnectionActor architecture and push flows
  • Inserted a class diagram for ConnectionActor, PushHandle, and SessionRegistry
  • Added sequence diagram for client-initiated outbound frames
  • Added sequence diagram for application-task push flow
  • Included sequence diagram for WebSocket heartbeats
  • Included sequence diagram for MQTT fan-out with drop path
docs/asynchronous-outbound-messaging-design.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 24, 2025

Summary by CodeRabbit

  • Documentation
    • Improved clarity in the core architecture section and refined descriptions of message handling.
    • Added a new overview subsection with Mermaid class and sequence diagrams to illustrate key components and workflows.
    • Introduced additional sequence diagrams in use case sections to visually explain asynchronous push operations.
    • Applied minor formatting improvements for cleaner presentation.

Summary by CodeRabbit

  • Documentation
    • Improved formatting of the requirements table header for consistency.
    • Added a new section with diagrams illustrating the connection actor architecture and message flow.
    • Included additional sequence diagrams in the use cases section to clarify asynchronous push operations for various protocols.
    • Enhanced clarity of key descriptions by refining sentence structure and removing extraneous markers.

Walkthrough

This update enhances the documentation for asynchronous outbound messaging by standardising table formatting and adding multiple Mermaid diagrams. New sections introduce class and sequence diagrams for the connection actor architecture, as well as additional diagrams illustrating specific asynchronous push use cases for MySQL, WebSocket, and MQTT protocols. No code or API changes are included.

Changes

File(s) Change Summary
docs/asynchronous-outbound-messaging-design.md Refined requirements table formatting; clarified channel back-pressure and tokio::select! explanations; added "3.3 Connection Actor Overview" section with class and sequence diagrams; introduced Mermaid sequence diagrams for MySQL, WebSocket, and MQTT push use cases; minor formatting fixes.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant ConnectionActor
    participant Socket

    Client->>ConnectionActor: Initiate connection
    ConnectionActor->>ConnectionActor: Enqueue outbound message
    ConnectionActor->>Socket: Deliver frame
    Socket-->>Client: Frame delivered
Loading
sequenceDiagram
    participant AppTask
    participant SessionRegistry
    participant ConnectionActor
    participant Socket

    AppTask->>SessionRegistry: Request push (e.g. MySQL packet)
    SessionRegistry->>ConnectionActor: Forward push
    ConnectionActor->>Socket: Send outbound message
    Socket-->>AppTask: Delivery acknowledgement
Loading
sequenceDiagram
    participant Timer
    participant ConnectionActor
    participant Socket

    Timer->>ConnectionActor: Trigger heart-beat ping
    ConnectionActor->>Socket: Send ping frame
    Socket-->>Timer: Ping delivered
Loading
sequenceDiagram
    participant Broker
    participant ConnectionActor
    participant Socket

    Broker->>ConnectionActor: Send MQTT PUBLISH frame
    ConnectionActor->>Socket: Deliver frame
    Socket-->>Broker: Confirm delivery or drop
Loading

Possibly related PRs

Poem

Here’s a hop and a skip through diagrams anew,
Where actors connect and messages queue.
From MySQL to MQTT, the flows are now clear,
With Mermaid’s fine lines, the sequence appears.
A bunny’s delight, in documentation’s light,
🐇 Diagrams dancing, making concepts bright!

✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch codex/add-mermaid-diagrams-to-asynchronous-outbound-messaging-desi

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-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.

Hey @leynos - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9db5368 and 5d54602.

📒 Files selected for processing (1)
  • docs/asynchronous-outbound-messaging-design.md (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-test
🔇 Additional comments (1)
docs/asynchronous-outbound-messaging-design.md (1)

40-46: Table header looks good – consistent and m-linter friendly.
Switching to a pipe-delimited header row aligns with Markdown conventions and satisfies most linters/parsers.

Comment thread docs/asynchronous-outbound-messaging-design.md Outdated
Comment thread docs/asynchronous-outbound-messaging-design.md
Comment thread docs/asynchronous-outbound-messaging-design.md
@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Jun 24, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 24, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5d54602 and b203782.

📒 Files selected for processing (1)
  • docs/asynchronous-outbound-messaging-design.md (5 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/asynchronous-outbound-messaging-design.md

[style] ~79-~79: Would you like to use the Oxford spelling “Prioritized”? The spelling ‘Prioritised’ is also correct.
Context: ...l space becomes available. ### 3.2 The Prioritised Write Loop The connection actor's writ...

(OXFORD_SPELLING_Z_NOT_S)


[grammar] ~81-~81: An apostrophe ‘s’ denotes possession. Did you mean to use the plural form of the noun (no apostrophe)?
Context: ... Prioritised Write Loop The connection actor's write logic will be implemented within ...

(NOUN_APOSTROPHE_S_VERB)

🔇 Additional comments (1)
docs/asynchronous-outbound-messaging-design.md (1)

40-46: Table re-alignment reads well
The new Markdown pipe syntax renders cleanly and the fixed width makes the requirements list far easier to scan. Nice touch.

Comment thread docs/asynchronous-outbound-messaging-design.md
Comment thread docs/asynchronous-outbound-messaging-design.md Outdated
Comment thread docs/asynchronous-outbound-messaging-design.md Outdated
@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Jun 24, 2025

@coderabbitai review

@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Jun 24, 2025

@sourcery-ai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 24, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-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.

Hey @leynos - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (2)
docs/asynchronous-outbound-messaging-design.md (2)

50-53: Undefined foot-note markers 1 and 2 remain

Numbers 1 and 2 read as superscript foot-notes but no matching definitions exist at the bottom of the document. Either convert them into normal prose (delete the markers) or add proper foot-note definitions to avoid the same confusion we previously fixed for 8, 16, etc.

Example fix (delete the stray markers):

-...managed by a dedicated, isolated asynchronous task. ¹ This approach serialises all I/O for a given connection, eliminating the need for
-complex locking and simplifying reasoning about concurrency. ²
+...managed by a dedicated, isolated asynchronous task. This approach serialises all I/O for a given connection, eliminating the need for
+complex locking and simplifying reasoning about concurrency.

100-104: Stray “Rust” heading disrupts Markdown flow

The standalone Rust line sits between body text and the fenced code block without heading markup, rendering as plain paragraph text. Convert it to a proper heading or drop it.

-Rust
-
-```rust
+```rust
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b203782 and 1c6e916.

📒 Files selected for processing (1)
  • docs/asynchronous-outbound-messaging-design.md (5 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/asynchronous-outbound-messaging-design.md

[style] ~79-~79: Would you like to use the Oxford spelling “Prioritized”? The spelling ‘Prioritised’ is also correct.
Context: ...l space becomes available. ### 3.2 The Prioritised Write Loop The connection actor's writ...

(OXFORD_SPELLING_Z_NOT_S)


[grammar] ~81-~81: An apostrophe ‘s’ denotes possession. Did you mean to use the plural form of the noun (no apostrophe)?
Context: ... Prioritised Write Loop The connection actor's write logic will be implemented within ...

(NOUN_APOSTROPHE_S_VERB)

Comment on lines +156 to +158
- sessions: DashMap&lt;SessionId, Weak&lt;ConnectionActor&gt;&gt;
+ register(session_id, actor)
+ get_handle(session_id): Option&lt;PushHandle&gt;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Inconsistent identifier: SessionId vs ConnectionId

The class diagram shows SessionRegistry storing DashMap<SessionId, …>, whereas the Rust sample later implements SessionRegistry<F>(DashMap<ConnectionId, …>). Pick one term and use it consistently across both diagram and code to prevent readers from assuming two distinct concepts.

-    class SessionRegistry {
-        - sessions: DashMap&lt;SessionId, Weak&lt;ConnectionActor&gt;&gt;
+    class SessionRegistry {
+        - sessions: DashMap&lt;ConnectionId, Weak&lt;ConnectionActor&gt;&gt;

and/or

-pub struct SessionRegistry<F>(DashMap<ConnectionId, Weak<PushHandleInner<F>>>);
+pub struct SessionRegistry<F>(DashMap<SessionId, Weak<PushHandleInner<F>>>);

Also applies to: 302-306

🤖 Prompt for AI Agents
In docs/asynchronous-outbound-messaging-design.md around lines 156 to 159 and
also lines 302 to 306, the identifiers `SessionId` and `ConnectionId` are used
inconsistently between the class diagram and Rust sample code. Choose either
`SessionId` or `ConnectionId` and update all occurrences in both the diagram and
code snippets to use the same term consistently, ensuring readers do not confuse
them as different concepts.

@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Jun 24, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 24, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Jun 24, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 24, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (3)
docs/asynchronous-outbound-messaging-design.md (3)

165-174: Self-message still reads like a re-entrant call (previously flagged)

ConnectionActor ->> ConnectionActor: enqueue outbound frame gives the impression of a recursive invocation rather than an internal queue operation. The earlier review suggested using a note over or a dedicated Queue participant; the same guidance applies here.


436-444: Same self-message issue in WebSocket heart-beat diagram

ConnectionActor ->> ConnectionActor: enqueue Ping in high-priority queue repeats the self-arrow pattern that was previously identified as potentially misleading.


452-464: Same self-message issue in MQTT fan-out diagram

ConnectionActor ->> ConnectionActor: drop frame again uses a self-arrow. Replacing it with a note or explicit HighPriorityQueue / LowPriorityQueue participant would improve readability.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1c6e916 and 5be58c4.

📒 Files selected for processing (1)
  • docs/asynchronous-outbound-messaging-design.md (5 hunks)
🧰 Additional context used
🧠 Learnings (1)
docs/asynchronous-outbound-messaging-design.md (10)
Learnt from: CR
PR: leynos/wireframe#0
File: docs/asynchronous-outbound-messaging-design.md:0-0
Timestamp: 2025-06-24T16:40:33.344Z
Learning: In the wireframe Rust framework, asynchronous outbound messaging is implemented using a stateful actor-per-connection model, where each connection is managed by a dedicated async task that serializes all I/O for that connection. This eliminates the need for complex locking and simplifies concurrency.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/asynchronous-outbound-messaging-design.md:0-0
Timestamp: 2025-06-24T16:40:33.344Z
Learning: Each connection actor manages two distinct, bounded tokio::mpsc channels for outbound frames: one for high-priority (urgent) messages and one for low-priority (background) messages. The bounded nature of these channels provides robust back-pressure, suspending writers when buffers are full.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/asynchronous-outbound-messaging-design.md:0-0
Timestamp: 2025-06-24T16:40:33.344Z
Learning: The actor's write loop should use a tokio::select! loop with the biased keyword to enforce strict polling order: (1) shutdown signal, (2) high-priority push channel, (3) low-priority push channel, (4) handler response stream. This ensures critical messages are never starved by bulk data.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/multi-packet-and-streaming-responses-design.md:0-0
Timestamp: 2025-06-24T16:41:50.533Z
Learning: The connection actor's prioritized write loop should always poll for urgent, out-of-band push messages before polling the response stream, ensuring that high-priority messages are not starved by long-running streams.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/asynchronous-outbound-messaging-design.md:0-0
Timestamp: 2025-06-24T16:40:33.344Z
Learning: The prioritised write loop naturally interleaves pushed messages and streaming responses, ensuring urgent pushes can interrupt long-running streams, and operates at the logical frame level, with fragmentation handled transparently by lower layers.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/multi-packet-and-streaming-responses-design.md:0-0
Timestamp: 2025-06-24T16:41:50.533Z
Learning: In Rust-based protocol frameworks (such as wireframe), handlers should return a declarative Response enum that supports single-frame, multi-frame (Vec), and streaming (Stream) responses, enabling both simple and complex reply patterns without changing the handler signature.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/asynchronous-outbound-messaging-design.md:0-0
Timestamp: 2025-06-24T16:40:33.344Z
Learning: For critical messages that must not be dropped, the framework supports an optional Dead Letter Queue (DLQ): frames that would be dropped due to full queues can be redirected to a user-provided mpsc::Sender for inspection, logging, or retry.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/observability-operability-and-maturity.md:0-0
Timestamp: 2025-06-24T16:41:59.381Z
Learning: Support optional Dead Letter Queues (DLQ) for resilient messaging: if the primary push queue is full, route frames to a DLQ instead of dropping them, ensuring no critical messages are lost if the DLQ consumer can keep up.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/hardening-wireframe-a-guide-to-production-resilience.md:0-0
Timestamp: 2025-06-24T16:41:00.450Z
Learning: Support optional Dead Letter Queues (DLQ) in push mechanisms to guarantee message delivery under high load; route undeliverable messages to a DLQ for later inspection and reprocessing instead of dropping them.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/multi-layered-testing-strategy.md:0-0
Timestamp: 2025-06-24T16:41:40.729Z
Learning: For high-volume message handling in wireframe, PushHandle must be able to push large numbers of frames (e.g., 10,000) without deadlocks or frame loss, and all frames must be received in order by the connection actor. Tests should complete within a tight time budget (e.g., <500ms on CI).
🪛 LanguageTool
docs/asynchronous-outbound-messaging-design.md

[style] ~52-~52: Would you like to use the Oxford spelling “serializes”? The spelling ‘serialises’ is also correct.
Context: ...olated asynchronous task. This approach serialises all I/O for a given connection, elimina...

(OXFORD_SPELLING_Z_NOT_S)


[style] ~79-~79: Would you like to use the Oxford spelling “Prioritized”? The spelling ‘Prioritised’ is also correct.
Context: ...l space becomes available. ### 3.2 The Prioritised Write Loop The connection actor's writ...

(OXFORD_SPELLING_Z_NOT_S)


[grammar] ~81-~81: An apostrophe ‘s’ denotes possession. Did you mean to use the plural form of the noun (no apostrophe)?
Context: ... Prioritised Write Loop The connection actor's write logic will be implemented within ...

(NOUN_APOSTROPHE_S_VERB)

🔇 Additional comments (1)
docs/asynchronous-outbound-messaging-design.md (1)

40-47: Table header re-alignment looks spot-on

The Markdown table now uses a canonical header row (| --- |) which renders correctly across GitHub, mdBook and most PDF pipelines.
No further action required.

Comment thread docs/asynchronous-outbound-messaging-design.md
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
docs/asynchronous-outbound-messaging-design.md (1)

168-172: Self-arrow still risks misinterpretation – previous concern remains

The ConnectionActor ->> ConnectionActor line is rendered as a re-entrant call, not an internal queueing action. Replacing it with either a note over or an anonymous “Queue” participant would convey intent without confusion.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5be58c4 and aa2d33e.

📒 Files selected for processing (1)
  • docs/asynchronous-outbound-messaging-design.md (5 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`docs/**/*.md`: Use the markdown files within the `docs/` directory as a knowledge base and source of truth for project requirements, dependency choices, and architectural decision...

docs/**/*.md: Use the markdown files within the docs/ directory as a knowledge base and source of truth for project requirements, dependency choices, and architectural decisions.
Proactively update the relevant file(s) in the docs/ directory to reflect the latest state when new decisions are made, requirements change, libraries are added/removed, or architectural patterns evolve.
Documentation in the docs/ directory must use en-GB-oxendict spelling and grammar, except for the word 'license'.

  • docs/asynchronous-outbound-messaging-design.md
`**/*.md`: Validate Markdown files using `markdownlint *.md **/*.md`. Run `mdformat-all` after any documentation changes to format all Markdown files and fix table markup. Validate...

**/*.md: Validate Markdown files using markdownlint *.md **/*.md.
Run mdformat-all after any documentation changes to format all Markdown files and fix table markup.
Validate Markdown Mermaid diagrams using the nixie CLI by running nixie *.md **/*.md.
Markdown paragraphs and bullet points must be wrapped at 80 columns.
Code blocks in Markdown files must be wrapped at 120 columns.
Tables and headings in Markdown files must not be wrapped.

  • docs/asynchronous-outbound-messaging-design.md
🧠 Learnings (1)
docs/asynchronous-outbound-messaging-design.md (14)
Learnt from: CR
PR: leynos/wireframe#0
File: docs/asynchronous-outbound-messaging-design.md:0-0
Timestamp: 2025-06-24T16:40:33.385Z
Learning: In the wireframe Rust framework, asynchronous outbound messaging is implemented using a stateful actor-per-connection model, where each connection is managed by a dedicated async task that serializes all I/O for that connection. This eliminates the need for complex locking and simplifies concurrency.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/the-road-to-wireframe-1-0-feature-set-philosophy-and-capability-maturity.md:0-0
Timestamp: 2025-06-24T16:43:37.907Z
Learning: The actor-per-connection model is recommended for managing TCP connections in asynchronous Rust servers. Each connection is handled by a dedicated async task, serializing all I/O and simplifying resource management.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/asynchronous-outbound-messaging-design.md:0-0
Timestamp: 2025-06-24T16:40:33.385Z
Learning: Each connection actor manages two distinct, bounded tokio::mpsc channels for outbound frames: one for high-priority (urgent) messages and one for low-priority (background) messages. The bounded nature of these channels provides robust back-pressure, suspending writers when buffers are full.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/asynchronous-outbound-messaging-design.md:0-0
Timestamp: 2025-06-24T16:40:33.385Z
Learning: The actor's write loop should use a tokio::select! loop with the biased keyword to enforce strict polling order: (1) shutdown signal, (2) high-priority push channel, (3) low-priority push channel, (4) handler response stream. This ensures critical messages are never starved by bulk data.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/wireframe-1-0-detailed-development-roadmap.md:0-0
Timestamp: 2025-06-24T16:43:46.789Z
Learning: When implementing a connection actor in Rust (e.g., for duplex communication), use a biased select! loop to prioritize shutdown signals, high/low priority pushes, and handler response streams in a strict order. This ensures predictable and robust processing of events.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/the-road-to-wireframe-1-0-feature-set-philosophy-and-capability-maturity.md:0-0
Timestamp: 2025-06-24T16:43:37.907Z
Learning: When multiplexing multiple sources of outbound frames in a connection actor, use tokio::select!(biased;) to prioritize critical events such as graceful shutdown signals and high-priority push channels over standard handler responses. This ensures timely handling of control messages.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/multi-packet-and-streaming-responses-design.md:0-0
Timestamp: 2025-06-24T16:41:50.561Z
Learning: The connection actor's prioritized write loop should always poll for urgent, out-of-band push messages before polling the response stream, ensuring that high-priority messages are not starved by long-running streams.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/asynchronous-outbound-messaging-design.md:0-0
Timestamp: 2025-06-24T16:40:33.385Z
Learning: The prioritised write loop naturally interleaves pushed messages and streaming responses, ensuring urgent pushes can interrupt long-running streams, and operates at the logical frame level, with fragmentation handled transparently by lower layers.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/multi-packet-and-streaming-responses-design.md:0-0
Timestamp: 2025-06-24T16:41:50.561Z
Learning: In Rust-based protocol frameworks (such as wireframe), handlers should return a declarative Response enum that supports single-frame, multi-frame (Vec), and streaming (Stream) responses, enabling both simple and complex reply patterns without changing the handler signature.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/asynchronous-outbound-messaging-design.md:0-0
Timestamp: 2025-06-24T16:40:33.385Z
Learning: For critical messages that must not be dropped, the framework supports an optional Dead Letter Queue (DLQ): frames that would be dropped due to full queues can be redirected to a user-provided mpsc::Sender for inspection, logging, or retry.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/observability-operability-and-maturity.md:0-0
Timestamp: 2025-06-24T16:41:59.419Z
Learning: Support optional Dead Letter Queues (DLQ) for resilient messaging: if the primary push queue is full, route frames to a DLQ instead of dropping them, ensuring no critical messages are lost if the DLQ consumer can keep up.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/the-road-to-wireframe-1-0-feature-set-philosophy-and-capability-maturity.md:0-0
Timestamp: 2025-06-24T16:43:37.907Z
Learning: For reliability, implement an optional Dead Letter Queue (DLQ) pattern for push mechanisms. If a push fails due to a full queue, route the frame to a separate channel for later inspection or reprocessing.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/hardening-wireframe-a-guide-to-production-resilience.md:0-0
Timestamp: 2025-06-24T16:41:00.477Z
Learning: Support optional Dead Letter Queues (DLQ) in push mechanisms to guarantee message delivery under high load; route undeliverable messages to a DLQ for later inspection and reprocessing instead of dropping them.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/multi-layered-testing-strategy.md:0-0
Timestamp: 2025-06-24T16:41:40.768Z
Learning: For high-volume message handling in wireframe, PushHandle must be able to push large numbers of frames (e.g., 10,000) without deadlocks or frame loss, and all frames must be received in order by the connection actor. Tests should complete within a tight time budget (e.g., <500ms on CI).
🪛 LanguageTool
docs/asynchronous-outbound-messaging-design.md

[style] ~52-~52: Would you like to use the Oxford spelling “serializes”? The spelling ‘serialises’ is also correct.
Context: ...olated asynchronous task. This approach serialises all I/O for a given connection, elimina...

(OXFORD_SPELLING_Z_NOT_S)


[style] ~79-~79: Would you like to use the Oxford spelling “Prioritized”? The spelling ‘Prioritised’ is also correct.
Context: ...l space becomes available. ### 3.2 The Prioritised Write Loop The connection actor's writ...

(OXFORD_SPELLING_Z_NOT_S)


[grammar] ~81-~81: An apostrophe ‘s’ denotes possession. Did you mean to use the plural form of the noun (no apostrophe)?
Context: ... Prioritised Write Loop The connection actor's write logic will be implemented within ...

(NOUN_APOSTROPHE_S_VERB)

Comment thread docs/asynchronous-outbound-messaging-design.md
Comment thread docs/asynchronous-outbound-messaging-design.md
@leynos leynos force-pushed the codex/add-mermaid-diagrams-to-asynchronous-outbound-messaging-desi branch from aa2d33e to d4d3337 Compare June 24, 2025 18:39
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

♻️ Duplicate comments (1)
docs/asynchronous-outbound-messaging-design.md (1)

135-156: Unescaped closing ‘>’ still breaks Mermaid rendering

The second > in the Weak generic is raw, so GitHub’s Mermaid parser drops everything after it.

-        - sessions: DashMap&lt;ConnectionId, Weak&lt;ConnectionActor&gt;&gt;
+        - sessions: DashMap&lt;ConnectionId, Weak&lt;ConnectionActor&gt;&gt;

Escape all closing brackets when you expand this pattern elsewhere to avoid recurrent rendering regressions.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aa2d33e and d4d3337.

📒 Files selected for processing (1)
  • docs/asynchronous-outbound-messaging-design.md (5 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`docs/**/*.md`: Use the markdown files within the `docs/` directory as a knowledge base and source of truth for project requirements, dependency choices, and architectural decision...

docs/**/*.md: Use the markdown files within the docs/ directory as a knowledge base and source of truth for project requirements, dependency choices, and architectural decisions.
Proactively update the relevant file(s) in the docs/ directory to reflect the latest state when new decisions are made, requirements change, libraries are added/removed, or architectural patterns evolve.
Documentation in the docs/ directory must use en-GB-oxendict spelling and grammar, except for the word 'license'.

  • docs/asynchronous-outbound-messaging-design.md
`**/*.md`: Validate Markdown files using `markdownlint *.md **/*.md`. Run `mdformat-all` after any documentation changes to format all Markdown files and fix table markup. Validate...

**/*.md: Validate Markdown files using markdownlint *.md **/*.md.
Run mdformat-all after any documentation changes to format all Markdown files and fix table markup.
Validate Markdown Mermaid diagrams using the nixie CLI by running nixie *.md **/*.md.
Markdown paragraphs and bullet points must be wrapped at 80 columns.
Code blocks in Markdown files must be wrapped at 120 columns.
Tables and headings in Markdown files must not be wrapped.

  • docs/asynchronous-outbound-messaging-design.md
🧠 Learnings (1)
docs/asynchronous-outbound-messaging-design.md (13)
Learnt from: CR
PR: leynos/wireframe#0
File: docs/the-road-to-wireframe-1-0-feature-set-philosophy-and-capability-maturity.md:0-0
Timestamp: 2025-06-24T16:43:37.907Z
Learning: The actor-per-connection model is recommended for managing TCP connections in asynchronous Rust servers. Each connection is handled by a dedicated async task, serializing all I/O and simplifying resource management.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/rust-binary-router-library-design.md:0-0
Timestamp: 2025-06-24T16:42:41.685Z
Learning: Automating connection lifecycle management (accepting connections, spawning per-connection tasks, handling disconnections) and abstracting away network boilerplate allows developers to focus on protocol logic rather than low-level networking details.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/asynchronous-outbound-messaging-design.md:0-0
Timestamp: 2025-06-24T16:40:33.385Z
Learning: The actor's write loop should use a tokio::select! loop with the biased keyword to enforce strict polling order: (1) shutdown signal, (2) high-priority push channel, (3) low-priority push channel, (4) handler response stream. This ensures critical messages are never starved by bulk data.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/wireframe-1-0-detailed-development-roadmap.md:0-0
Timestamp: 2025-06-24T16:43:46.789Z
Learning: When implementing a connection actor in Rust (e.g., for duplex communication), use a biased select! loop to prioritize shutdown signals, high/low priority pushes, and handler response streams in a strict order. This ensures predictable and robust processing of events.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/asynchronous-outbound-messaging-design.md:0-0
Timestamp: 2025-06-24T16:40:33.385Z
Learning: Each connection actor manages two distinct, bounded tokio::mpsc channels for outbound frames: one for high-priority (urgent) messages and one for low-priority (background) messages. The bounded nature of these channels provides robust back-pressure, suspending writers when buffers are full.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/the-road-to-wireframe-1-0-feature-set-philosophy-and-capability-maturity.md:0-0
Timestamp: 2025-06-24T16:43:37.907Z
Learning: When multiplexing multiple sources of outbound frames in a connection actor, use tokio::select!(biased;) to prioritize critical events such as graceful shutdown signals and high-priority push channels over standard handler responses. This ensures timely handling of control messages.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/multi-packet-and-streaming-responses-design.md:0-0
Timestamp: 2025-06-24T16:41:50.561Z
Learning: The connection actor's prioritized write loop should always poll for urgent, out-of-band push messages before polling the response stream, ensuring that high-priority messages are not starved by long-running streams.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/asynchronous-outbound-messaging-design.md:0-0
Timestamp: 2025-06-24T16:40:33.385Z
Learning: The prioritised write loop naturally interleaves pushed messages and streaming responses, ensuring urgent pushes can interrupt long-running streams, and operates at the logical frame level, with fragmentation handled transparently by lower layers.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/multi-packet-and-streaming-responses-design.md:0-0
Timestamp: 2025-06-24T16:41:50.561Z
Learning: In Rust-based protocol frameworks (such as wireframe), handlers should return a declarative Response enum that supports single-frame, multi-frame (Vec), and streaming (Stream) responses, enabling both simple and complex reply patterns without changing the handler signature.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/asynchronous-outbound-messaging-design.md:0-0
Timestamp: 2025-06-24T16:40:33.385Z
Learning: For critical messages that must not be dropped, the framework supports an optional Dead Letter Queue (DLQ): frames that would be dropped due to full queues can be redirected to a user-provided mpsc::Sender for inspection, logging, or retry.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/observability-operability-and-maturity.md:0-0
Timestamp: 2025-06-24T16:41:59.419Z
Learning: Support optional Dead Letter Queues (DLQ) for resilient messaging: if the primary push queue is full, route frames to a DLQ instead of dropping them, ensuring no critical messages are lost if the DLQ consumer can keep up.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/the-road-to-wireframe-1-0-feature-set-philosophy-and-capability-maturity.md:0-0
Timestamp: 2025-06-24T16:43:37.907Z
Learning: For reliability, implement an optional Dead Letter Queue (DLQ) pattern for push mechanisms. If a push fails due to a full queue, route the frame to a separate channel for later inspection or reprocessing.
Learnt from: CR
PR: leynos/wireframe#0
File: docs/hardening-wireframe-a-guide-to-production-resilience.md:0-0
Timestamp: 2025-06-24T16:41:00.477Z
Learning: Support optional Dead Letter Queues (DLQ) in push mechanisms to guarantee message delivery under high load; route undeliverable messages to a DLQ for later inspection and reprocessing instead of dropping them.
🪛 LanguageTool
docs/asynchronous-outbound-messaging-design.md

[style] ~53-~53: Would you like to use the Oxford spelling “serializes”? The spelling ‘serialises’ is also correct.
Context: ...olated asynchronous task. This approach serialises all I/O for a given connection, elimina...

(OXFORD_SPELLING_Z_NOT_S)


[style] ~80-~80: Would you like to use the Oxford spelling “Prioritized”? The spelling ‘Prioritised’ is also correct.
Context: ...l space becomes available. ### 3.2 The Prioritised Write Loop The connection actor's writ...

(OXFORD_SPELLING_Z_NOT_S)


[grammar] ~82-~82: An apostrophe ‘s’ denotes possession. Did you mean to use the plural form of the noun (no apostrophe)?
Context: ... Prioritised Write Loop The connection actor's write logic will be implemented within ...

(NOUN_APOSTROPHE_S_VERB)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-test

Comment on lines +436 to +444
```mermaid
sequenceDiagram
participant Timer as Heart-beat Timer
participant ConnectionActor
participant Socket
Timer->>ConnectionActor: push_high_priority(Ping frame)
ConnectionActor->>ConnectionActor: enqueue Ping in high-priority queue
ConnectionActor->>Socket: write Ping frame (even during response stream)
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Self-arrow ambiguity in WebSocket heart-beat diagram

Replace the self-message with a note or explicit queue participant to mirror the queued-write reality.

🤖 Prompt for AI Agents
In docs/asynchronous-outbound-messaging-design.md around lines 436 to 444, the
sequence diagram uses a self-arrow on ConnectionActor to represent enqueueing a
Ping, which is ambiguous. Replace this self-message with either a note
explaining the enqueue action or introduce an explicit queue participant in the
diagram to clearly show the Ping being added to the high-priority queue,
reflecting the actual queued-write process.

Comment on lines +418 to +428
```mermaid
sequenceDiagram
participant AppTask as Application Task
participant SessionRegistry
participant ConnectionActor
participant Socket
AppTask->>SessionRegistry: get PushHandle for session
AppTask->>ConnectionActor: push(OK packet or LOCAL INFILE)
ConnectionActor->>ConnectionActor: queue frame in outbox
ConnectionActor->>Socket: write frame (when idle or after command completes)
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Same self-arrow ambiguity in MySQL push diagram

Reuse the clearer pattern suggested above to keep diagrams stylistically consistent and unambiguous.

🤖 Prompt for AI Agents
In docs/asynchronous-outbound-messaging-design.md around lines 418 to 428, the
self-arrow used in the sequence diagram for ConnectionActor is ambiguous.
Replace the self-arrow with a clearer pattern consistent with earlier diagrams,
such as using a note or a different arrow style, to improve readability and
maintain stylistic consistency.

Comment on lines +163 to +174
```mermaid
sequenceDiagram
participant Client
participant ConnectionActor
participant Socket

Client->>ConnectionActor: Initiate connection/request
Note over ConnectionActor: Manages high/low priority queues
ConnectionActor->>ConnectionActor: enqueue outbound frame
ConnectionActor->>Socket: Write outbound frame
Socket-->>Client: Delivers outbound message
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Self-message arrow is visually ambiguous

ConnectionActor ->> ConnectionActor suggests a re-entrant call rather than an internal queue operation.
A note over or a dedicated Queue participant keeps the intent crystal-clear.

Example:

sequenceDiagram
    participant Client
    participant ConnectionActor
    participant Queue as Outbox
    participant Socket

    Client->>ConnectionActor: Initiate connection/request
    ConnectionActor->>Queue: enqueue outbound frame
    Queue-->>ConnectionActor: dequeued frame
    ConnectionActor->>Socket: Write outbound frame
    Socket-->>Client: Deliver message
Loading
🤖 Prompt for AI Agents
In docs/asynchronous-outbound-messaging-design.md around lines 163 to 174, the
self-message arrow from ConnectionActor to itself is visually ambiguous and can
be mistaken for a re-entrant call. To clarify the intent of an internal queue
operation, refactor the diagram by introducing a dedicated Queue participant
(e.g., named Outbox). Replace the self-message with messages from
ConnectionActor to Queue for enqueueing and from Queue back to ConnectionActor
for dequeuing, and add a note if needed to explain the queue's role.

Comment on lines +452 to +465
```mermaid
sequenceDiagram
participant Broker as MQTT Broker
participant SessionRegistry
participant ConnectionActor as Client ConnectionActor
participant Socket
Broker->>SessionRegistry: get PushHandle for subscriber
Broker->>ConnectionActor: try_push(PUBLISH frame)
alt Queue not full
ConnectionActor->>Socket: write PUBLISH frame
else Queue full
ConnectionActor->>ConnectionActor: drop frame
end
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Self-arrow ambiguity in MQTT fan-out diagram

For consistency and clarity across all diagrams, avoid self-messages that look like recursion; model the internal queue explicitly or annotate with a note over block.

🤖 Prompt for AI Agents
In docs/asynchronous-outbound-messaging-design.md around lines 452 to 465, the
sequence diagram uses a self-arrow on ConnectionActor to represent dropping a
frame, which can be confused with recursion. Replace this self-message with an
explicit representation of the internal queue or add a 'note over' annotation to
clarify that this action models dropping a frame due to a full queue, improving
diagram clarity and consistency.

Comment on lines +52 to +54
network connection is managed by a dedicated, isolated asynchronous task. This
approach serialises all I/O for a given connection, eliminating the need for
complex locking and simplifying reasoning about concurrency. 2
complex locking and simplifying reasoning about concurrency.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Use Oxford –ize spelling (“serialises” → “serializes”)

Project docs mandate en-GB-oxendict spelling, which prefers the -ize form.
Update the verb accordingly to stay consistent with the style guide.

-approach serialises all I/O for a given connection, eliminating the need for
+approach serializes all I/O for a given connection, eliminating the need for
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
network connection is managed by a dedicated, isolated asynchronous task. This
approach serialises all I/O for a given connection, eliminating the need for
complex locking and simplifying reasoning about concurrency. 2
complex locking and simplifying reasoning about concurrency.
network connection is managed by a dedicated, isolated asynchronous task. This
approach serializes all I/O for a given connection, eliminating the need for
complex locking and simplifying reasoning about concurrency.
🧰 Tools
🪛 LanguageTool

[style] ~53-~53: Would you like to use the Oxford spelling “serializes”? The spelling ‘serialises’ is also correct.
Context: ...olated asynchronous task. This approach serialises all I/O for a given connection, elimina...

(OXFORD_SPELLING_Z_NOT_S)

🤖 Prompt for AI Agents
In docs/asynchronous-outbound-messaging-design.md around lines 52 to 54, the
word "serialises" uses en-GB spelling but the project style guide requires
Oxford –ize spelling. Change "serialises" to "serializes" to maintain
consistency with the mandated en-GB-oxendict style.

@leynos leynos merged commit f9f6107 into main Jun 24, 2025
5 checks passed
@leynos leynos deleted the codex/add-mermaid-diagrams-to-asynchronous-outbound-messaging-desi branch June 24, 2025 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant