Repository navigation
Conversation
Current Aviator status
This pull request is currently open (not queued). How to mergeTo merge this PR, comment
See the real-time status of this PR on the
Aviator webapp.
Use the Aviator Chrome Extension
to see the status of your PR within GitHub.
|
|
"Build public repo for MacOS arm64" failed on The earlier Linux arm64 failure on Generated by Claude Code |
0009d81 to
41635e3
Compare
|
"Test React Native mobile app (Maestro)" failed on There is nothing to fix in the PR for it. The job needs a re-run, which I could not do: the re-run request was refused with Generated by Claude Code |
4939da2 to
63a608b
Compare
`Recover` migrated the database to the current persistence version. But `Recover` is called by each server that the database serves, any number of times and at the same time, and after other calls may already have been served. So a migration could run more than once at a time, and alongside reads and writes. `Instantiate` now migrates, right after it has opened the database and before the database is served from. A migration then runs once, on its own, with nothing else reading or writing the database. A migration that fails now fails opening the database, where it failed the `Recover` that ran it. `MaybeMigratePersistence` and `MigratePersistence3To4` lose the `RecoverRequest` that they were given and did not use. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017sw2rydNyewFGnC8Fj1T7f
The persistence version was only ever read from the database, by `MaybeMigratePersistence`, to decide what to migrate. Nothing else could ask what version the database is of. `Instantiate` now reads it when it opens the database, with the new `ReadPersistenceVersion`, and gives it to the `DatabaseService`, which keeps it as `persistence_version_`. `SetPersistenceVersion` writes a version to the database and keeps it, and is what a migration finishes with. `MaybeMigratePersistence` goes by `persistence_version_` where it read the database. A version that cannot be read, or that is less than 1, now fails opening the database before the server is made, where it failed migrating. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017sw2rydNyewFGnC8Fj1T7f
0f94249 to
00675f1
Compare
The database stored the state of an actor, and nothing else, as the
value under `state:<state ref>`. Anything more that has to be kept
for an actor, and committed with its state, had nowhere to go but a
second key, which costs every load of every actor a second lookup.
An actor is now stored the way a task and an idempotent mutation
already are, as the database's own message for it:
actor:<state ref> -> a serialized `Actor`
so that what else is kept for an actor is a field of `Actor`, read
and written with its state. `Apply` writes it, `Load`, `Preload` and
export parse it, and `Find` lists the keys under `actor:`.
A colocated entry, which is an entry of a `SortedMap`, stays as it
is under `state:<state ref>`, with the bytes it was given as its
value. That prefix and what makes and reads its keys are named for
colocated entries now: `COLOCATED_ENTRY_KEY_PREFIX`,
`MakeColocatedEntryKey`. What an actor's state was stored under is
`ACTOR_STATE_KEY_PREFIX_V4`, for the migration alone. Both are
`state`.
Persistence version 5 is this layout. `MigratePersistence4To5` goes
through every `state:` key and stores each one that is an actor's
under `actor:` in its place. A colocated entry is told from an actor
by its state ref, which is only ever compound, with a `/`, for a
colocated entry; `IsColocatedEntry` is that rule. The old and the
new key of an actor differ, and both are written in one batch, so
the migration can be stopped and started again.
A transaction that was prepared before persistence version 5 has
already written, though not committed, what it puts under
`state:<state ref>`, and starting the server finds each such
transaction by that put. Deleting that key in the migration would be
the later write, and would hide what the transaction commits. So:
* the migration stores such an actor under `actor:` too, and
leaves its `state:<state ref>` where it is;
* committing or aborting such a transaction migrates its actor
then, before anything else can store the actor;
* for as long as there is such a transaction when the database is
opened, it stays at persistence version 5, and is migrated again
the next time it is opened. That catches a server that stopped
between a commit and migrating. Opened without one, it moves to
persistence version 6, which is the same layout with no such
transaction left.
Committing and aborting only look for such a transaction in a
database of version 5. Exporting leaves out a `state:<state ref>`
that such a transaction is why is still there, since its actor is
exported from `actor:<state ref>`.
A Reboot from before this change refuses to open a database of
either version.
`TestOnly_StoreActorsAsOfPersistenceVersion4` has a server store
actors the old way, which is how the tests come by a database to
migrate.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017sw2rydNyewFGnC8Fj1T7f
00675f1 to
6ba48ca
Compare
An actor is stored as an `Actor`, so that what else has to be kept for it, and committed with its state, can be a field of `Actor`. Where the actor's statechart is, is the first such thing. `Actor` gets `statechart_status`, a `rbt.v1alpha1.statecharts.Status`. The database already stores and loads an `Actor` whole, so it stores and loads the status with it, and nothing in `database.cc` changes. Storing an actor replaces what was stored for it. Storing one without a statechart status therefore removes the one that was stored, and it is for whoever stores an actor to store its status with it. Nothing does yet. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017sw2rydNyewFGnC8Fj1T7f
8253218 to
ded0d2f
Compare
Storing an actor replaces what is stored for it, statechart status
included. The state manager knew only of an actor's state, so
storing an actor's new state would have removed its statechart
status.
The state manager now keeps the statechart status beside the state,
wherever it keeps the state:
* `_statechart_statuses` is beside `_states`, and is filled when
an actor is loaded;
* a transaction has `statechart_status` beside `state`, copied
from what was loaded when the state is, kept in the snapshot for
a nested transaction so that a rollback restores it, and moved
to `_statechart_statuses` when the transaction commits;
* a store, and a transaction that prepares, send the statechart
status that the actor has with its new state.
To have the status to keep, `DatabaseClient.load_actor`, which was
`load_actor_state`, returns the `Actor` and not only its state, and
preloading resolves to the `Actor` too. A transaction that defers
its writes sends its state when it prepares, so
`TransactionParticipantPrepareRequest` gets `statechart_status` to
send with it, and the database stores the two as one `Actor`.
Nothing sets a statechart status yet, so nothing changes in what is
stored. It is carried, and no longer dropped.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017sw2rydNyewFGnC8Fj1T7f
ded0d2f to
8b7b59e
Compare
The state manager loads, keeps and stores where a state's statechart is, but nothing could read it or change it. `Effects` gets `statechart_status`. Effects that have one change where the state's statechart is, in the same store as the state, and within a transaction as part of it, so that it commits or rolls back with the state. Effects that have none leave it as it was. Changing it needs the exclusive lock, the way changing the state does. The state and the statechart status are always stored together, since storing an actor replaces what is stored for it: effects that change only one of the two store the other as the actor has it. `StateManager.statechart_status(context)` returns a copy of where the statechart of the state that `context` is for is, and within a transaction the transaction's own. A method cannot reach either. It is not given the state manager, and it is what calls a method that makes the `Effects` from what the method returns. Nothing is added to the context. What a reader returns may depend on where the statechart is, so a statechart status that changes on its own notifies the streaming readers of the state, with the state as it is, the way a state that changes does. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017sw2rydNyewFGnC8Fj1T7f
The database exports an actor whole, statechart status included, but the item that an actor is exported as and imported from had only the actor's state. An actor that was exported and imported again lost where its statechart is. `ExportImportItem` gets `actor`, an `ExportImportItem.Actor` that has the actor's state and its statechart status, each as a `google.protobuf.Struct` the way a task and an idempotent mutation are. Exporting writes `actor`, and importing gives both to `StateManager.import_actor`, which stores them together. `state`, which is all that was exported of an actor until now, is still imported, as an actor without a statechart status, since it is from before there was one. What is exported from now on does not import into a Reboot from before it. Importing overwrites, so an actor that is imported without a statechart status is left with none, whatever it had. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017sw2rydNyewFGnC8Fj1T7f
`check_statechart` checks a statechart on its own. Two things about
a statechart can only be checked against the file that its state is
declared in: what an event is, and what else the state has methods
for. Generating code for a statechart needs both to hold.
`rbt generate` now checks, for a statechart that has no problems of
its own, that:
* each of its `events` is the full name of a message, in the
state's file or in a file that it imports;
Error processing 'shop/v1/order.proto': The statechart of
'shop.v1.Order' has the event 'shop.v1.Payed', which is not
a message; an event is the full name of a message of
'shop/v1/order.proto' or of a file that it imports.
* no method that it names, as a `guard`, a `condition`, a `call`
or a `schedule`, is also what an rpc of the state is as a
method, which is the rpc's name in snake case.
Error processing 'shop/v1/order.proto': The statechart of
'shop.v1.Order' names the method 'get_id', which is also
what the rpc 'GetID' of 'shop.v1.OrderMethods' is as a
method; a method of a statechart and an rpc cannot have the
same name.
Every event that a statechart mentions is one of its `events`, so
those are all that there is to look up. The methods come from
`on_transitions`, `when_transitions`, `calls` and `schedules`, which
`validation.py` had for its own use and are no longer private.
Nothing is generated for a statechart yet.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017sw2rydNyewFGnC8Fj1T7f
A statechart named a method "the way an rpc is", as in
`IsPaidInFull`, and the method was to be implemented as
`is_paid_in_full`. Getting from the one to the other loses what
tells two names apart: `GetID` and `GetId` are both `get_id`. So two
methods of a statechart could have been one method to implement
without anything noticing.
A statechart now names a method by what it is called where it is
implemented, in snake case:
guard { inline { method: "is_paid_in_full" } }
`check_statechart` gets its twenty-seventh rule, for the method of a
`guard`, a `condition`, a `call` and a `schedule`. It is in snake
case, and it is not a Python keyword:
Error processing 'shop/v1/order.proto': The statechart of
'shop.v1.Order' has 1 problem:
- the `guard` of an `on` transition of state `PENDING` has the
method `IsPaidInFull`, which is not in snake case, as
`is_paid_in_full` is
Two methods of a statechart are then the same method exactly when
they are named the same, which is how the rule that a method is
named in only one way already compares them.
The tests' statecharts name their methods in snake case.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017sw2rydNyewFGnC8Fj1T7f
A statechart names a method for each guard and each condition. The
Python servicer of a state with a statechart now declares each one,
so that an implementation of the state provides them:
def is_settled(
self,
state: Order.State,
event: order_pb2.Paid | order_pb2.Refunded,
) -> bool: ...
def is_cancelled(self, state: Order.State) -> bool: ...
A guard takes the state and the event of the transition it is on; a
guard on transitions on more than one event takes any of them. A
condition takes the state. Both are synchronous and take no context:
each answers a question about what it is given.
The methods are abstract and are declared on the base servicer, so
a servicer that leaves one out cannot be instantiated, whichever of
`Servicer` and `singleton.Servicer` it derives from.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017sw2rydNyewFGnC8Fj1T7f
A statechart names a method for each call. The Python servicer of a
state with a statechart now declares each one, as it does the guards
and the conditions:
def record_payment(
self,
state: Order.State,
event: order_pb2.Paid,
) -> Optional[order_pb2.Settled]: ...
def send_receipt(self, state: Order.State) -> None: ...
A call takes the state, which it may change. A call that is an
action of an `on` transition also takes the event of that
transition, which is how what an event carries gets into the state.
An `entry`, an `exit` and an action of a `when` transition have no
one event that they are for, so they take only the state.
A call that has `injects` returns the event to inject, or `None`;
any other call returns `None`.
A method has one signature, so a statechart is now checked to not
name the same method both by a call that is given the event and by
one that is not.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017sw2rydNyewFGnC8Fj1T7f
A statechart names a method for each schedule. The Python servicer
of a state with a statechart now declares each one, as it does the
guards, the conditions and the calls:
@classmethod
async def charge_card(
cls,
context: WorkflowContext,
) -> Optional[order_pb2.Paid | order_pb2.Refunded]: ...
@classmethod
async def send_reminders(cls, context: WorkflowContext) -> None:
...
A schedule is declared as a workflow of the servicer is: an
asynchronous class method that takes a `WorkflowContext`. It takes
no event, since a schedule is an `entry`.
A schedule that has `enqueues` returns the event to enqueue when it
finishes, or `None`; any other schedule returns `None`.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017sw2rydNyewFGnC8Fj1T7f
The Python servicer of a state with a statechart now has
`statechart()`, with which a method reads where the statechart is:
async def status_from_reader(
self,
context: ReaderContext,
request: Empty,
) -> statechart_pb2.Status:
return self.statechart(context).status()
`statechart()` is given the context of a reader, a writer or a
transaction, each of which has the state, and returns an
`ImmutableStatechart`. Its `status()` returns a copy of the `Status`
that is stored with the state, and an empty one for a state whose
statechart has not started; within a transaction it is the
transaction's own.
The statechart is lent to a method the way the `state` of a servicer
is. For each call the generated code makes an `ImmutableStatechart`
from the status that the state manager has and puts it in a context
variable for as long as the method runs, and `statechart()` returns
what the context variable has. A state type has it as
`Order.ImmutableStatechart`.
Nothing sets a statechart status yet, so the test gives an order
one where the state manager keeps it.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017sw2rydNyewFGnC8Fj1T7f
A writer or a transaction of a state with a statechart now enqueues
one of the statechart's events with the statechart of its servicer:
async def pay(
self,
context: WriterContext,
request: order_pb2.Paid,
) -> Empty:
await self.statechart(context).enqueue(request)
return Empty()
There are now two kinds of statechart. `statechart()` returns an
`ImmutableStatechart`, which has only `status()`, for the context of
a reader, and a `Statechart`, which also has `enqueue()`, for the
context of a writer or a transaction. A reader cannot enqueue
because what it is given has no such method. A state type has the
second as `Order.Statechart`.
The event goes at the end of the queue of the statechart status, by
the full name of its message and with its fields as a `Struct`.
`enqueue()` is a coroutine, as scheduling a task from a writer is,
so that it can come to do more than append.
`status()` of a `Statechart` has every event that the method has
enqueued. When the method returns, the status goes into the method's
effects if the method changed it. An event is therefore stored with
the method's change to the state, and a method that fails enqueues
nothing.
An event may be enqueued before the statechart has started: the
status then has a queue and no active state.
A workflow cannot enqueue yet; the inline writer has a TODO to let
it take the statechart as well as the state.
The test of `status()` no longer sets a status where the state
manager keeps it, now that a method can change one, and it gains a
reactive reader that gets an event that is enqueued.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017sw2rydNyewFGnC8Fj1T7f
|
CI on The failing step is in the ( Generated by Claude Code |
A workflow of a state with a statechart now gets the statechart
along with the state from an inline reader and an inline writer:
state, statechart = await Order.ref().read(context)
async def record_charge(
state: Order.State,
statechart: Order.Statechart,
) -> None:
state.owed_cents = 0
await statechart.enqueue(order_pb2.Paid(cents=500))
await Order.ref().write(context, record_charge)
An inline reader returns the state and an `ImmutableStatechart`, and
an inline writer is given the state and a `Statechart`, so a
workflow enqueues an event with an inline writer. Both always have
the statechart for a state type that has one, and are as they were
for a state type that has none.
What an inline writer enqueues goes into the effects of the write,
with its change to the state and its result, so it is stored once
however often the workflow runs again, and an inline writer that
fails enqueues nothing.
The state manager's `read()` now returns the statechart status with
the state, which is `None` for a state type that has no statechart,
so that the two are of the same store. An inline reader of a state
type with a statechart that remembers what it read remembers both.
One of a state type without a statechart remembers the state alone,
as before, so a workflow that is running across an upgrade finds
what it stored. The generated code for every state type takes the
state from what `read()` returns, which is the change to the
goldens.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017sw2rydNyewFGnC8Fj1T7f
An event of a statechart is a message, and in the queue of a statechart status it is the full name of that message with its fields as a `Struct`. `reboot/statecharts/events.py` now has what makes each from the other: `status_event_from_message()` and `message_from_status_event()`. `enqueue()` of a generated `Statechart` makes what it adds to the queue with the first, and the tests of `enqueue()` say what they expect in a queue with it in place of a helper of their own. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017sw2rydNyewFGnC8Fj1T7f
The statechart of a state is now run when a writer, a transaction or
an inline writer of the state returns, on the state as the method
left it and before the method's effects are stored. Whatever the
statechart does is therefore stored with the method's own change: a
method that enqueues an event leaves the event handled, and a reader
never finds one that is waiting.
`run()` in `reboot/statecharts/interpreter.py` runs a statechart
until it has nothing left to do:
1. A statechart that has not started starts: the statechart is
entered, and then its `initial` and on into the states within
that.
2. Every `when` transition that fires is taken.
3. The event at the head of the queue is taken from it, and the
`on` transition that fires for it is taken; an event that no
transition fires for is dropped. Then 2 again, until the queue
is empty.
`maybe_when_transition()` and `maybe_on_transition()` say which
transition fires. A state has its own transitions and inherits those
of each state it is within and of the statechart, innermost first;
the first whose guard or condition holds fires, and each, which is
a method of the servicer as a call is, is asked only if what it
answers decides that.
`states_exited_and_entered_from_transition()` says what taking a
transition exits and enters: every active state that its `to` is
not within is exited, and its `to` is entered and on into the states
within it, from their `initial` or, with `resume`, from their
history.
Taking a transition calls the methods of the servicer that the
statechart names with the state: each `exit` of each state that is
exited, each action of the transition, which alone is given the event,
and each `entry` of each state that is entered. An event that is
injected goes ahead of every event that is waiting.
`run()` and what it calls leave the status that they are given as
it is. Each returns the status that the statechart has come to, or
`None` if that is the one it was given, so `run()` returns `None`
for a statechart that had nothing to do. The state is what the
methods of the servicer change, as a method of a servicer does.
A method that the statechart calls and that fails fails the method
that is returning, and a statechart that takes more than 1000
transitions in one run is stopped with an error.
The order that the tests have is now one whose statechart does
something to see: its calls add their names to the order, and the
tests of an application say what the order and its statechart have
come to. A `schedule` and a `timer` are not started yet.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017sw2rydNyewFGnC8Fj1T7f
`run()` had two statuses: the one it was given, and the one that the statechart had come to once that was another, so it read where the statechart is as `modified_status or status` throughout. It now has one `status`, which is always where the statechart is, and remembers the one it was given. Nothing changes a status: what `run()` calls returns another status, or `None` for no change. So the statechart is where it was if and only if `status` is still the one that `run()` was given, which is what it looks at to return `None`. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017sw2rydNyewFGnC8Fj1T7f
A `schedule` and a `timer` of a statechart are activities: each runs
while the state that has it is active. Entering a state now
schedules each of them, a statechart waits for a schedule before it
exits the state, and a timer of a state that is exited enqueues
nothing.
- Scheduling. The status of a statechart now has the activities
that are running, each by the state that has it and the
`schedule` or the `timer` that it is. The interpreter adds one
for each `schedule` and `timer` of a state that is entered, and
of the statechart itself when it starts. The generated code
makes a task for each and has it in the effects of the method
that is returning, so an activity runs only if that method
completes. The task of a timer is to run after the delay of the
timer.
- Running. The task is that of a workflow that every state type
with a statechart now has, `__RunStatechartActivity__`. For a
schedule it calls the method of the servicer, as a workflow of
the servicer is called. It is a method of no rpc, so it cannot
be called, and an rpc cannot have its name. The generated code
dispatches and runs it as it does any workflow, so a schedule
that fails is run again as a workflow is.
- Finishing. In one inline write, the workflow takes the activity
from those that are running and enqueues an event: the one that
the method of a schedule returned, if any, or the one of a
timer. The statechart is then run as it is after any write.
- Waiting for a schedule. A transition that would exit a state
that has a schedule that is running is not taken. `run()` stops
there, with the event that the transition fires for still at the
head of the queue and every later event behind it, until the
write that finishes the schedule runs the statechart again. A
schedule of the statechart itself is of no state and is never
waited for.
- Exiting a state with a timer. No transition waits for a timer.
Taking a transition takes each timer of a state that it exits
from those that are running, so when the task of the timer
comes to finish, it finds that the timer is not running and
enqueues nothing.
An activity is not cancelled yet: a statechart always waits for a
schedule, and the task of a timer of a state that was exited still
runs, to no effect.
The effects of a transaction may now have tasks, which are
dispatched once the transaction has committed, as those of a writer
within a transaction are. A task that an inline writer's effects
have is dispatched without the servicer of the workflow that the
inline writer is in, as a task that is dispatched from elsewhere
is.
The schedules that the order of the tests had are now those of a
shipment, in `shipment.proto`, which also has timers, so that an
order does not start tasks.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017sw2rydNyewFGnC8Fj1T7f
Implements the design Statecharts for Reboot state types: a state type can declare a statechart, in pydantic (
Type(statechart=Statechart(...))) or in protobuf (thestatechartfield of(rbt.v1alpha1.state)), whichrbt generatechecks, the developer dashboard draws, and an interpreter runs.Status: draft. Ten commits, one per part. The series was rebuilt several times in review; this description is of the current head. The database change in commit 6 is C++ that I could not build locally: only CI has compiled it or run its tests. Everything in Python was run locally against the published 1.7.2 wheel with the repository's sources laid over it and a shim standing in for the database's handling of the status: every
tests/reboot/statecharttest andtests/reboot/state_manager_tests.pypass at the head, and each commit passes its own tests when checked out alone. The dashboard's TypeScript was type-checked and unit-tested outside the page's build, and the page has not been looked at in a browser.What is in each commit
Statechartmessagerbt/v1alpha1/statechart/statechart.proto, the helpers ofreboot.statechartthat build the message, andtree.py, lookups over it.Statusmessage, and the pure function from chart, status, state and methods to the next status, the actions to run and the activities to stop and start.StateOptions.statechart, and the build changes that follow fromoptions.protoimporting a new file.Type(statechart=...),StateType.statechartinapi.proto, and the translator writing the option and the event messages.Actor.statechart_statusin the database, and the state manager carrying it with the state.rbt generatechecks the chart for both forms; generatedMachine, typed declarations of the chart's methods,self.statechart.RunStatecharttask, scheduled only when there is work.Timer,Schedule, and waiting for an activity before leaving its state (leaving).documentation/docs/statecharts.md.The shape of it
Statechartmessage everywhere, and where an instance is, is theStatusmessage everywhere. There are no parallel Python classes or TypeScript interfaces, and no converters. The pydantic helpers only build the messages.Actorhas an optionalstatechart_status, stored under a key of its own (statechart-status:<state_ref>) in the actor's column family, in the same batch as the state. The state manager keeps it wherever it keeps the state (cache, transaction, nested-transaction snapshot, prepare, commit), a method changes it throughEffects.statechart_status, and reads it withStateManager.statechart_status(context). No method of the type can write it.RunStatechartto the runtime, and only the runtime creates one, as a task effect of a method of the state. Nothing outside the type can call it and no authorizer needs a rule for it. A type with a statechart cannot have an rpc namedRunStatechart.Inline, a method of the servicer that only the chart calls, inside a oneof so that areader,writer,transactionorworkflowcan be added later.Call.Inlinelists the events itinjects(handled next, ahead of what is waiting) andSchedule.Inlinethe events itenqueues(at the back) by returning them. An activity is a class method given aWorkflowContext."shop.v1.ServiceDue"), and a chart lists every event it mentions inevents. A queued event is agoogle.protobuf.Any; a fixed event's fields in the chart are aStruct.Things to know when reviewing
DatabaseClient.load_actor_statebecameload_actorand returns theActor. An actor upsert still always has the state, and stores the status with it when it has one; effects that change only the status store the state as it is alongside.Exportnow takes its snapshot explicitly so that it can read each actor's status as of the same moment, and exports it with the actor's state, carried asExportImportItem.statechart_statusbesidestate. A transaction whose only effect is a new status takes its lock exclusively, and a status stored without a new state notifies streaming readers. Existing data needs no migration.RunStatechartresets rather than asserting they are unset.options.protonow importsstatechart.proto, which importsany.protoandstruct.proto. Generated Python imports the_pb2module of every file its.protoreaches, so the Python golden files change by those lines and the Node.js golden by the compressed copy it embeds.js_proto_libraryhandsprotoconly the descriptor sets of its listedproto_deps, so the macro adds the new files for any library that listsoptions_protoorapi_proto.Not done
self.statechart.statusin a reader gives it,leavingincluded.tests/reboot/statechart, in both forms, with its servicers and end-to-end tests.How to try it
tests/reboot/statechart/traffic_light_api.pyandproto/traffic_light.protoare the same chart in the two forms,traffic_light_servicer.pybeside each is its servicer, andtraffic_light_test.pyruns one set of tests against both.🤖 Generated with Claude Code
https://claude.ai/code/session_017sw2rydNyewFGnC8Fj1T7f