Skip to content

Commit

Permalink
Release v0.3.1 with bug fixes for local expression projection
Browse files Browse the repository at this point in the history
  • Loading branch information
ashton314 committed Jul 30, 2024
1 parent 800f66c commit dd6cf31
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 24 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Formal syntax:
local_exp ::= $actor.($var)
| $actor.$func($exp, ...)
| $actor.($exp)
actor ::= Module name (e.g. Actor)
func ::= Function name (e.g. frobnicate(...))
var ::= Variable name (e.g. foo, i)
Expand Down Expand Up @@ -291,7 +291,7 @@ Use the `Chorex.start/3` function to start a choreography:

```elixir
Chorex.start(MyChoreography.Chorex,
%{ Actor1 => MyActor1Impl,
%{ Actor1 => MyActor1Impl,
Actor2 => MyActor2Impl },
[arg_to_run])
```
Expand Down Expand Up @@ -331,16 +331,20 @@ If you find any bugs or would like to suggest a feature, please [open an issue o

We will collect change descriptions here until we come up with a more stable format when changes get bigger.

- v0.3.1; 2024-07-30

Fix many problems around local expression projection.

- v0.3.0; 2024-07-22

Add `Chorex.start` and `run` function as an entry-point into the choreography.

- v0.2.0; 2024-07-03

Add shared-state actors.

- v0.1.0; 2024-05-30

Initial release. Lots of rough edges so please, be patient. :)


Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Chorex.MixProject do
def project do
[
app: :chorex,
version: "0.3.0",
version: "0.3.1",
elixir: "~> 1.16",
start_permanent: Mix.env() == :prod,
description: description(),
Expand Down
3 changes: 2 additions & 1 deletion test/function_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ defmodule FunctionTest do
end
|> Macro.expand_once(__ENV__)

assert {_, _, _} = expanded # did we get something?
# did we get something?
assert {_, _, _} = expanded
end

# quote do
Expand Down
20 changes: 10 additions & 10 deletions test/higher_order_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -123,21 +123,21 @@ defmodule HigherOrderTest do
end

test "3-party higher-order choreography runs" do
Chorex.start(TestChor3.Chorex,
%{Seller3 => MySeller3,
Buyer3 => MyBuyer3,
Contributor3 => MyContributor3},
[true])
Chorex.start(
TestChor3.Chorex,
%{Seller3 => MySeller3, Buyer3 => MyBuyer3, Contributor3 => MyContributor3},
[true]
)

assert_receive {:chorex_return, Buyer3, ~D[2024-05-13]}
end

test "2-party higher-order choreography runs" do
Chorex.start(TestChor3.Chorex,
%{Seller3 => MySeller3,
Contributor3 => MyContributor3,
Buyer3 => MyBuyer3},
[false])
Chorex.start(
TestChor3.Chorex,
%{Seller3 => MySeller3, Contributor3 => MyContributor3, Buyer3 => MyBuyer3},
[false]
)

assert_receive {:chorex_return, Buyer3, ~D[2024-05-13]}
end
Expand Down
16 changes: 13 additions & 3 deletions test/init_func_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ defmodule InitFuncTest do
def sell_book(decision_process) do
StarterAlice.get_book_title() ~> StarterEve.(the_book)

with StarterAlice.({want_book?, my_cost}) <- decision_process.(StarterEve.get_price(the_book)) do
with StarterAlice.({want_book?, my_cost}) <-
decision_process.(StarterEve.get_price(the_book)) do
if StarterAlice.(want_book?) do
StarterAlice[L] ~> StarterEve
StarterAlice.get_address() ~> StarterEve.(the_address)
Expand All @@ -78,6 +79,7 @@ defmodule InitFuncTest do
StarterEve.(the_price) ~> StarterAlice.(full_price)
StarterEve.(the_price) ~> StarterBob.(full_price)
StarterBob.(full_price / 2) ~> StarterAlice.(contrib)

with StarterAlice.(my_price) <- StarterAlice.(full_price - contrib) do
StarterAlice.({my_price < get_budget(), my_price})
end
Expand Down Expand Up @@ -120,7 +122,11 @@ defmodule InitFuncTest do
test "startup with run function works" do
Chorex.start(
StarterChor.Chorex,
%{StarterAlice => StarterAliceImpl, StarterEve => StarterEveImpl, StarterBob => StarterBobImpl},
%{
StarterAlice => StarterAliceImpl,
StarterEve => StarterEveImpl,
StarterBob => StarterBobImpl
},
[false]
)

Expand All @@ -130,7 +136,11 @@ defmodule InitFuncTest do
test "startup with different arguments does what's expected" do
Chorex.start(
StarterChor.Chorex,
%{StarterAlice => StarterAliceImpl, StarterEve => StarterEveImpl, StarterBob => StarterBobImpl},
%{
StarterAlice => StarterAliceImpl,
StarterEve => StarterEveImpl,
StarterBob => StarterBobImpl
},
[true]
)

Expand Down
12 changes: 8 additions & 4 deletions test/proxied_actor_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,17 @@ defmodule ProxiedActorTest do
test "two buyers try for the book, one gets it" do
{:ok, px} = GenServer.start(Chorex.Proxy, %{"Anathem" => 1})

Chorex.start(BooksellerProxied.Chorex,
Chorex.start(
BooksellerProxied.Chorex,
%{BuyerP => MyBuyerP, SellerP => {MySellerPBackend, px}},
[])
[]
)

Chorex.start(BooksellerProxied.Chorex,
Chorex.start(
BooksellerProxied.Chorex,
%{BuyerP => MyBuyerP, SellerP => {MySellerPBackend, px}},
[])
[]
)

assert_receive {:chorex_return, BuyerP, :book_get}
assert_receive {:chorex_return, BuyerP, :darn_missed_it}
Expand Down

0 comments on commit dd6cf31

Please sign in to comment.