Skip to content

Add state-machine modelling guidance - #87

Draft
leynos wants to merge 2 commits into
mainfrom
add-state-machine-guidance
Draft

Add state-machine modelling guidance#87
leynos wants to merge 2 commits into
mainfrom
add-state-machine-guidance

Conversation

@leynos

@leynos leynos commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • add concise Rust guidance for recognizing correlated state fields that should
    become an ADT
  • distinguish caller-driven typestate from runtime input- and event-driven ADTs
  • require transition owners to encapsulate mandatory finalization and cleanup
  • retain booleans for genuinely independent observations
  • add rendered-template assertions for the new policy wording

Scope

This changes only the templated AGENTS.md and its parent-template regression
test. It does not prescribe typestate universally or add a state-machine
framework.

Validation

  • reviewed the two-file branch diff through the GitHub connector
  • added assertions that render AGENTS.md and check each stable policy phrase
  • no local repository checkout was available in this session; draft PR CI should
    run the template, Markdown, and spelling checks

Summary by Sourcery

Add state-machine modelling guidance and regression coverage to the templated project instructions.

New Features:

  • Add Rust guidance for modelling correlated or mutually exclusive state with appropriate algebraic data types and typestate patterns.

Enhancements:

  • Clarify when to use caller-driven typestate versus runtime state machines and retain booleans for independent observations.
  • Require state owners to encapsulate transitions, mandatory finalization, and cleanup.

Documentation:

  • Update the templated AGENTS.md guidance with state-machine modelling policy.

Tests:

  • Add rendered-template regression assertions covering the new state-machine guidance.

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Warning

Your free Security trial is over. An organization admin can activate Security or dismiss this notice.


Comment @coderabbitai help to get the list of available commands.

@sourcery-ai

sourcery-ai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR adds concise state-machine modelling guidance to the templated AGENTS.md, covering ADT selection, typestate boundaries, transition ownership, cleanup, and appropriate boolean use, with regression assertions verifying the rendered policy text.

File-Level Changes

Change Details Files
Add Rust guidance for identifying and designing state-machine representations.
  • Recommend ADTs for mutually exclusive or correlated state data, including state-specific payloads.
  • Distinguish typestate for caller-selected finite workflows from runtime ADTs and stacks for input- or event-driven and unbounded state.
  • Require state owners to encapsulate transitions, semantic results, mandatory finalization, and cleanup.
  • Preserve booleans when observations are genuinely independent.
template/AGENTS.md.jinja
Extend rendered-template regression coverage for the new state-machine policy.
  • Assert that rendered AGENTS.md contains each stable state-modelling and cleanup phrase.
tests/test_template/test_policy_guidance.py

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant