Skip to content

Document actor state consolidation#134

Merged
leynos merged 3 commits intomainfrom
codex/propose-design-for-improved-state-management
Jun 26, 2025
Merged

Document actor state consolidation#134
leynos merged 3 commits intomainfrom
codex/propose-design-for-improved-state-management

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Jun 25, 2025

Summary

  • outline the actor state model using RunState and a closed source counter
  • add roadmap task for implementing the new state management

Testing

  • make fmt
  • make lint
  • make test

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

Summary by Sourcery

Document the consolidated actor state model and update the project roadmap accordingly

Documentation:

  • Add an Actor State Management section detailing the RunState enum and source-count-based shutdown logic
  • Add a roadmap task for implementing run state consolidation referencing the new design section

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Jun 25, 2025

Reviewer's Guide

This PR enhances the asynchronous outbound messaging design by introducing a consolidated actor state model (using a RunState enum, an Option-based receiver approach, and a closed_sources counter) and adds a corresponding checklist item to the roadmap.

Class diagram for consolidated actor state model

classDiagram
    class RunState {
        <<enum>>
        Active
        ShuttingDown
        Finished
    }
    class ActorState {
        RunState run_state
        u8 closed_sources
        u8 total_sources
    }
Loading

File-Level Changes

Change Details Files
Introduced consolidated actor state model
  • Added ‘3.4 Actor state management’ section
  • Defined RunState enum and ActorState struct
  • Described Option-based receiver handling and closed_sources logic
docs/asynchronous-outbound-messaging-design.md
Updated roadmap with run state consolidation task
  • Inserted unchecked checklist entry for run state consolidation
  • Linked the roadmap task to the new design section
docs/asynchronous-outbound-messaging-roadmap.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 25, 2025

Summary by CodeRabbit

  • Documentation
    • Added a detailed subsection on actor state management to the asynchronous outbound messaging design documentation.
    • Updated the roadmap to reflect the new "Run state consolidation" task and adjusted the status of related tasks.
    • Included references and links to the new design section for easier navigation.

Summary by CodeRabbit

  • Documentation
    • Added detailed explanation of actor state management to the design documentation.
    • Updated the roadmap to include a new task for run state consolidation and referenced the new design section.

Walkthrough

A new section on actor state management was added to the asynchronous outbound messaging design document, detailing a consolidated approach using Option receivers and counters. The roadmap was updated to include a corresponding task referencing this design change, with a new link for cross-referencing.

Changes

File(s) Change Summary
docs/asynchronous-outbound-messaging-design.md Added section 3.4 describing consolidated actor state management with Option receivers and counters.
docs/asynchronous-outbound-messaging-roadmap.md Added new task for run state consolidation and a link reference to the new design section.

Possibly related PRs

Suggested reviewers

  • codescene-delta-analysis

Poem

In the warren, actors now keep count,
With Option states that neatly mount.
No more flags to chase or find,
Just counters clear and well-defined.
The roadmap marks this hop anew—
Oh, what clever code rabbits do! 🐇✨

✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch codex/propose-design-for-improved-state-management

🪧 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.

@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Jun 26, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 26, 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 d9e5bdf and 62155c3.

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

[uncategorized] ~183-~183: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...our sources: a shutdown token, high and low priority push channels, and an optional response...

(EN_COMPOUND_ADJECTIVE_INTERNAL)


[typographical] ~204-~204: The word ‘When’ starts a question. Add a question mark (“?”) at the end of the sentence.
Context: ...sources == total_sources` the loop exits. This consolidation clarifies progress t...

(WRB_QUESTION_MARK)

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

16-17: Nice addition – roadmap now tracks the new state model

The new task cleanly mirrors Design §3.4, keeping the roadmap in sync with the
specification. No issues spotted.

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
@leynos leynos merged commit 0d2d7ca into main Jun 26, 2025
3 of 4 checks passed
@leynos leynos deleted the codex/propose-design-for-improved-state-management branch June 26, 2025 18:38
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 62155c3 and b069e8d.

📒 Files selected for processing (2)
  • docs/asynchronous-outbound-messaging-design.md (1 hunks)
  • docs/asynchronous-outbound-messaging-roadmap.md (2 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
`docs/**/*.md`: Use the markdown files within the `docs/` directory as a knowled...

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'.

📄 Source: CodeRabbit Inference Engine (AGENTS.md)

List of files the instruction was applied to:

  • docs/asynchronous-outbound-messaging-roadmap.md
  • docs/asynchronous-outbound-messaging-design.md
`**/*.md`: Validate Markdown files using `markdownlint *.md **/*.md`. Run `mdfor...

**/*.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.

📄 Source: CodeRabbit Inference Engine (AGENTS.md)

List of files the instruction was applied to:

  • docs/asynchronous-outbound-messaging-roadmap.md
  • docs/asynchronous-outbound-messaging-design.md
`docs/**/*.md`: Use British English spelling based on the Oxford English Diction...

docs/**/*.md: Use British English spelling based on the Oxford English Dictionary, except retain US spelling in API names (e.g., 'color').
Use the Oxford comma in lists.
Write headings in sentence case and use Markdown heading levels in order without skipping.
Follow markdownlint recommendations for Markdown formatting.
Always use fenced code blocks with a language identifier; use 'plaintext' for non-code text.
Use '-' as the first level bullet and renumber lists when items change.
Prefer inline links using 'text' or angle brackets around the URL.
Expand any uncommon acronym on first use, e.g., Continuous Integration (CI).
Wrap paragraphs at 80 columns, code at 120 columns, and do not wrap tables.
Use footnotes referenced with '[^label]'.
When embedding figures, use 'alt text' and provide concise alt text describing the content.
Add a short description before each Mermaid diagram for screen readers.

📄 Source: CodeRabbit Inference Engine (docs/documentation-style-guide.md)

List of files the instruction was applied to:

  • docs/asynchronous-outbound-messaging-roadmap.md
  • docs/asynchronous-outbound-messaging-design.md
`docs/**/asynchronous-outbound-messaging-design.md`: Document and implement prio...

docs/**/asynchronous-outbound-messaging-design.md: Document and implement priority push queues (PushQueues, PushHandle) with high and low channels as described in Design §3.1.
Implement a connection actor with a biased select! loop that polls for shutdown, high/low queues, and response streams as described in Design §3.2.
Consolidate run state using Option receivers and a closed source counter as described in Design §3.4.
Invoke internal protocol hooks before_send and on_command_end from the actor as described in Design §4.3.
Integrate the WireframeProtocol trait and builder to consolidate callbacks as described in Design §4.3.
Provide a public PushHandle API with push and try_push methods as described in Design §4.1.
Implement a leak-proof SessionRegistry using dashmap::DashMap and Weak pointers as described in Design §4.2.
Document the use of async-stream for creating Response::Stream values as described in Design §4.1.
Implement a typed WireframeError for recoverable protocol errors as described in Design §5.
Implement an optional Dead Letter Queue for full queues as described in Design §5.2.
Provide user guides and examples demonstrating server-initiated messaging as described in Design §7.

📄 Source: CodeRabbit Inference Engine (docs/asynchronous-outbound-messaging-roadmap.md)

List of files the instruction was applied to:

  • docs/asynchronous-outbound-messaging-design.md
🪛 LanguageTool
docs/asynchronous-outbound-messaging-design.md

[typographical] ~204-~204: The word ‘When’ starts a question. Add a question mark (“?”) at the end of the sentence.
Context: ...sources == total_sources` the loop exits. This consolidation clarifies progress t...

(WRB_QUESTION_MARK)

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

Comment on lines +183 to +187
The connection actor polls four sources: a shutdown token, high- and
low-priority push channels, and an optional response stream. Earlier drafts
tracked a boolean for each source, leading to verbose state updates. The actor
now stores each receiver as an `Option` and counts how many sources have closed.

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)

Wrap paragraph to 80 cols for guideline compliance

The two sentences currently exceed the mandated 80-character wrap for prose in
Markdown docs. Re-flowing keeps the style consistent with the rest of the
document.

🤖 Prompt for AI Agents
In docs/asynchronous-outbound-messaging-design.md around lines 183 to 187, the
paragraph exceeds the 80-character line length guideline for Markdown prose.
Reformat the paragraph by wrapping the text so that no line exceeds 80
characters, ensuring consistent style with the rest of the document.

Comment on lines +202 to +205
`total_sources` is calculated when the actor starts. Whenever a receiver returns
`None`, it is set to `None` and `closed_sources` increments. When
`closed_sources == total_sources` the loop exits. This consolidation clarifies
progress through the actor lifecycle and reduces manual flag management.
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)

Missing comma after the dependent ‘When…’ clause

Add a comma after the introductory clause to avoid a garden-path read and satisfy
standard punctuation rules.

-When `closed_sources == total_sources` the loop exits.
+When `closed_sources == total_sources`, the loop exits.
📝 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
`total_sources` is calculated when the actor starts. Whenever a receiver returns
`None`, it is set to `None` and `closed_sources` increments. When
`closed_sources == total_sources` the loop exits. This consolidation clarifies
progress through the actor lifecycle and reduces manual flag management.
`total_sources` is calculated when the actor starts. Whenever a receiver returns
`None`, it is set to `None` and `closed_sources` increments. When
`closed_sources == total_sources`, the loop exits. This consolidation clarifies
progress through the actor lifecycle and reduces manual flag management.
🧰 Tools
🪛 LanguageTool

[typographical] ~204-~204: The word ‘When’ starts a question. Add a question mark (“?”) at the end of the sentence.
Context: ...sources == total_sources` the loop exits. This consolidation clarifies progress t...

(WRB_QUESTION_MARK)

🤖 Prompt for AI Agents
In docs/asynchronous-outbound-messaging-design.md around lines 202 to 205, add a
comma after the introductory clause "Whenever a receiver returns `None`" to
correctly separate it from the main clause and improve readability by following
standard punctuation rules.

Comment on lines +16 to +17
- [ ] **Run state consolidation** using `Option` receivers and a closed source
counter ([Design §3.4][design-actor-state]).
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)

Hyphenate compound modifier ‘closed-source’

Treat “closed-source” as a compound adjective to mirror the earlier “high- and
low-priority” fix and avoid a garden-path read.

-counter ([Design §3.4][design-actor-state]).
+counter ([Design §3.4][design-actor-state]).

(Only the hyphenation changes; line length preserved.)

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In docs/asynchronous-outbound-messaging-roadmap.md around lines 16 to 17, the
phrase "closed source counter" should be hyphenated as "closed-source counter"
to correctly treat it as a compound adjective. Update the text to include the
hyphen between "closed" and "source" without changing the line length.

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