Skip to content

chore(release): v0.5.2#226

Merged
chaoming0625 merged 1 commit into
mainfrom
worktree-release-0.5.2
Jun 26, 2026
Merged

chore(release): v0.5.2#226
chaoming0625 merged 1 commit into
mainfrom
worktree-release-0.5.2

Conversation

@chaoming0625

@chaoming0625 chaoming0625 commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Release v0.5.2

A small, additive feature release for brainstate.transform.

What's in this release

  • brainstate.transform.in_new_state_probe() (feat(transform): in_new_state_probe() + complex/failure tests for *_new_states #225) — a public predicate that
    lets state-bound, one-shot consumers cooperate with the eager discovery probe that
    vmap_new_states / vmap2_new_states / pmap2_new_states run to enumerate the
    random states a function creates before the real mapped pass. Code that performs a
    one-shot side effect bound to the created state objects (e.g. a graph compiler that
    caches a computation keyed on freshly-initialised states) can defer that work to the
    real mapped pass, binding to the correctly-tagged, batched states rather than the
    throwaway probe states. Implemented as a thread-local depth counter, so it composes
    under nesting and resets cleanly on error.
  • 28 new regression tests across _mapping1, _mapping2, and _mapping_core.

No public APIs are removed or renamed; behavior is unchanged for code that does not
call the new helper.

Changes

  • Bump __version__ to 0.5.2
  • Add the Version 0.5.2 changelog section

See changelog.md for the full release notes.

Summary by Sourcery

Release version 0.5.2 with an additive helper in brainstate.transform and accompanying documentation and testing updates.

New Features:

  • Expose the public brainstate.transform.in_new_state_probe() predicate to let one-shot, state-bound consumers coordinate with new-state probe passes in mapping transforms.

Build:

  • Bump the project version identifier to 0.5.2.

Documentation:

  • Add release notes for version 0.5.2 describing the new in_new_state_probe() helper and its usage in brainstate.transform.

Tests:

  • Add extensive regression tests around mapping-related state creation and the new in_new_state_probe() guard to improve coverage and validate failure boundaries.

@sourcery-ai

sourcery-ai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Release v0.5.2 wires up the new public predicate brainstate.transform.in_new_state_probe() (implemented elsewhere) by documenting it in the changelog and bumps the package version constant to 0.5.2 for distribution.

Sequence diagram for in_new_state_probe interaction with vmap_new_states and a one-shot consumer

sequenceDiagram
    participant vmap_new_states
    participant wrapped_fn
    participant in_new_state_probe
    participant OneShotConsumer

    rect rgb(230,230,255)
        vmap_new_states->>wrapped_fn: probe_call()
        wrapped_fn->>in_new_state_probe: in_new_state_probe()
        in_new_state_probe-->>wrapped_fn: True
        wrapped_fn->>OneShotConsumer: compile_graph(args)
        OneShotConsumer->>in_new_state_probe: in_new_state_probe()
        in_new_state_probe-->>OneShotConsumer: True
        OneShotConsumer-->>wrapped_fn: [side effect deferred]
        vmap_new_states-->>vmap_new_states: [discard probe states]
    end

    rect rgb(230,255,230)
        vmap_new_states->>wrapped_fn: mapped_call()
        wrapped_fn->>in_new_state_probe: in_new_state_probe()
        in_new_state_probe-->>wrapped_fn: False
        wrapped_fn->>OneShotConsumer: compile_graph(args)
        OneShotConsumer->>in_new_state_probe: in_new_state_probe()
        in_new_state_probe-->>OneShotConsumer: False
        OneShotConsumer-->>wrapped_fn: [perform one-shot side effect]
        vmap_new_states-->>vmap_new_states: [bind to real mapped states]
    end
Loading

File-Level Changes

Change Details Files
Document the v0.5.2 release and the new in_new_state_probe() helper in the changelog.
  • Add a Version 0.5.2 section describing the new in_new_state_probe() predicate and its interaction with vmap_new_states / vmap2_new_states / pmap2_new_states.
  • Document usage patterns and implementation notes (thread-local depth counter, nesting behavior, error handling) for in_new_state_probe().
  • Summarize new regression test coverage and quality improvements added in this release.
changelog.md
Bump the package version to 0.5.2.
  • Update the version string constant from 0.5.1 to 0.5.2.
  • Ensure version_info continues to derive from the updated version string.
brainstate/_version.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

@sourcery-ai sourcery-ai Bot left a comment

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.

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

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@chaoming0625 chaoming0625 merged commit 719ce63 into main Jun 26, 2026
7 checks passed
@chaoming0625 chaoming0625 deleted the worktree-release-0.5.2 branch June 26, 2026 14:14
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