duroxide 0.2.0__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. {duroxide-0.2.0 → duroxide-0.2.2}/.github/workflows/build.yml +14 -0
  2. {duroxide-0.2.0 → duroxide-0.2.2}/CHANGELOG.md +57 -0
  3. {duroxide-0.2.0 → duroxide-0.2.2}/Cargo.lock +72 -72
  4. {duroxide-0.2.0 → duroxide-0.2.2}/Cargo.toml +3 -3
  5. {duroxide-0.2.0 → duroxide-0.2.2}/PKG-INFO +5 -1
  6. {duroxide-0.2.0 → duroxide-0.2.2}/README.md +4 -0
  7. {duroxide-0.2.0 → duroxide-0.2.2}/docs/architecture.md +1 -1
  8. {duroxide-0.2.0 → duroxide-0.2.2}/docs/user-guide.md +18 -1
  9. {duroxide-0.2.0 → duroxide-0.2.2}/pyproject.toml +1 -1
  10. duroxide-0.2.2/rust-toolchain.toml +6 -0
  11. {duroxide-0.2.0 → duroxide-0.2.2}/tests/test_kv_store.py +36 -0
  12. {duroxide-0.2.0 → duroxide-0.2.2}/tests/test_races.py +102 -0
  13. {duroxide-0.2.0 → duroxide-0.2.2}/.agents/skills/duroxide-python-orchestrations/SKILL.md +0 -0
  14. {duroxide-0.2.0 → duroxide-0.2.2}/.agents/skills/pyo3-interop/SKILL.md +0 -0
  15. {duroxide-0.2.0 → duroxide-0.2.2}/.agents/skills/release-preparation/SKILL.md +0 -0
  16. {duroxide-0.2.0 → duroxide-0.2.2}/.env.example +0 -0
  17. {duroxide-0.2.0 → duroxide-0.2.2}/.github/copilot-instructions.md +0 -0
  18. {duroxide-0.2.0 → duroxide-0.2.2}/.github/dependabot.yml +0 -0
  19. {duroxide-0.2.0 → duroxide-0.2.2}/.gitignore +0 -0
  20. {duroxide-0.2.0 → duroxide-0.2.2}/CODE_OF_CONDUCT.md +0 -0
  21. {duroxide-0.2.0 → duroxide-0.2.2}/CONTRIBUTING.md +0 -0
  22. {duroxide-0.2.0 → duroxide-0.2.2}/LICENSE +0 -0
  23. {duroxide-0.2.0 → duroxide-0.2.2}/RELEASE_POLICY.md +0 -0
  24. {duroxide-0.2.0 → duroxide-0.2.2}/SECURITY.md +0 -0
  25. {duroxide-0.2.0 → duroxide-0.2.2}/ci/smoke/README.md +0 -0
  26. {duroxide-0.2.0 → duroxide-0.2.2}/ci/smoke/run-local.ps1 +0 -0
  27. {duroxide-0.2.0 → duroxide-0.2.2}/ci/smoke/run-local.sh +0 -0
  28. {duroxide-0.2.0 → duroxide-0.2.2}/ci/smoke/run-registry.ps1 +0 -0
  29. {duroxide-0.2.0 → duroxide-0.2.2}/ci/smoke/run-registry.sh +0 -0
  30. {duroxide-0.2.0 → duroxide-0.2.2}/ci/smoke/smoke.py +0 -0
  31. {duroxide-0.2.0 → duroxide-0.2.2}/python/duroxide/__init__.py +0 -0
  32. {duroxide-0.2.0 → duroxide-0.2.2}/python/duroxide/context.py +0 -0
  33. {duroxide-0.2.0 → duroxide-0.2.2}/python/duroxide/driver.py +0 -0
  34. {duroxide-0.2.0 → duroxide-0.2.2}/src/client.rs +0 -0
  35. {duroxide-0.2.0 → duroxide-0.2.2}/src/handlers.rs +0 -0
  36. {duroxide-0.2.0 → duroxide-0.2.2}/src/lib.rs +0 -0
  37. {duroxide-0.2.0 → duroxide-0.2.2}/src/pg_provider.rs +0 -0
  38. {duroxide-0.2.0 → duroxide-0.2.2}/src/provider.rs +0 -0
  39. {duroxide-0.2.0 → duroxide-0.2.2}/src/runtime.rs +0 -0
  40. {duroxide-0.2.0 → duroxide-0.2.2}/src/types.rs +0 -0
  41. {duroxide-0.2.0 → duroxide-0.2.2}/tests/scenarios/__init__.py +0 -0
  42. {duroxide-0.2.0 → duroxide-0.2.2}/tests/scenarios/test_toygres.py +0 -0
  43. {duroxide-0.2.0 → duroxide-0.2.2}/tests/test_admin_api.py +0 -0
  44. {duroxide-0.2.0 → duroxide-0.2.2}/tests/test_advanced_features.py +0 -0
  45. {duroxide-0.2.0 → duroxide-0.2.2}/tests/test_async_blocks.py +0 -0
  46. {duroxide-0.2.0 → duroxide-0.2.2}/tests/test_copilot_chat.py +0 -0
  47. {duroxide-0.2.0 → duroxide-0.2.2}/tests/test_e2e.py +0 -0
  48. {duroxide-0.2.0 → duroxide-0.2.2}/tests/test_init_tracing.py +0 -0
  49. {duroxide-0.2.0 → duroxide-0.2.2}/tests/test_lock_options.py +0 -0
  50. {duroxide-0.2.0 → duroxide-0.2.2}/tests/test_replay_isolation.py +0 -0
  51. {duroxide-0.2.0 → duroxide-0.2.2}/tests/test_sessions.py +0 -0
  52. {duroxide-0.2.0 → duroxide-0.2.2}/tests/test_tags.py +0 -0
  53. {duroxide-0.2.0 → duroxide-0.2.2}/tests/test_typed_apis.py +0 -0
@@ -33,6 +33,11 @@ jobs:
33
33
  - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
34
34
  with:
35
35
  python-version: "3.12"
36
+ - name: Install configured Rust toolchain
37
+ run: |
38
+ test -f rust-toolchain.toml
39
+ rustup show active-toolchain
40
+ rustc --version
36
41
  - name: Install package and test dependencies
37
42
  run: |
38
43
  python -m venv .venv
@@ -52,6 +57,8 @@ jobs:
52
57
  - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
53
58
  with:
54
59
  python-version: "3.12"
60
+ - name: Require Rust toolchain configuration
61
+ run: test -f rust-toolchain.toml
55
62
  - name: Build wheel
56
63
  uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
57
64
  with:
@@ -78,6 +85,8 @@ jobs:
78
85
  - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
79
86
  with:
80
87
  python-version: "3.12"
88
+ - name: Require Rust toolchain configuration
89
+ run: test -f rust-toolchain.toml
81
90
  - name: Build wheel
82
91
  uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
83
92
  with:
@@ -112,6 +121,9 @@ jobs:
112
121
  - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
113
122
  with:
114
123
  python-version: "3.12"
124
+ - name: Require Rust toolchain configuration
125
+ shell: bash
126
+ run: test -f rust-toolchain.toml
115
127
  - name: Build wheel
116
128
  uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
117
129
  with:
@@ -128,6 +140,8 @@ jobs:
128
140
  runs-on: ubuntu-latest
129
141
  steps:
130
142
  - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
143
+ - name: Require Rust toolchain configuration
144
+ run: test -f rust-toolchain.toml
131
145
  - name: Build sdist
132
146
  uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
133
147
  with:
@@ -7,6 +7,63 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.2] - 2026-10-21
11
+
12
+ ### Changed
13
+
14
+ - Bumped `duroxide-pg` from `0.1.36` to `0.1.37`.
15
+
16
+ ## [0.2.1] - 2026-10-12
17
+
18
+ ### Changed
19
+
20
+ - **Bumped `duroxide` dependency** — `0.1.30` → `0.1.32` (race fixes and shutdown, below).
21
+ `0.1.31` was reserved and never published.
22
+ - **Bumped `duroxide-pg` dependency** — `0.1.35` → `0.1.36`. Under heavy load, an orchestration
23
+ fetched from PostgreSQL could come with a lock that had already expired. Every ack then failed
24
+ with `Invalid lock token`, and the message was retried for as long as the load lasted. The lock
25
+ now starts when the instance is claimed (migration `0025`). An SDK version built with
26
+ `duroxide-pg` 0.1.35 refuses a database that has this migration.
27
+ - **`runtime.shutdown(timeout_ms)` returns as soon as the runtime stops.** `timeout_ms` (default
28
+ 1000) is now the longest it waits for in-flight work before cancelling the rest, not a fixed
29
+ delay. Shutdown also stops every task the runtime started, so no poller keeps a database
30
+ connection open after it returns.
31
+ - **A signal sent to a dropped `wait_for_event` is discarded.** When a `wait_for_event` loses a
32
+ `ctx.race()`, a signal already given to it is no longer handed to a later wait for the same
33
+ event. The later wait receives the next signal. Before, it could receive the stale value, fail
34
+ replay, or wait forever.
35
+ - **A duplicate start does not change a running instance.** `client.start_orchestration()` for
36
+ an instance that already has history is ignored; it can no longer replace the instance's
37
+ orchestration name, version or input. A sub-orchestration whose instance id collides with a
38
+ running instance now fails its parent, as it already did for a finished one.
39
+
40
+ ### Fixed
41
+
42
+ - **A queue read that loses a race takes no message.** A drain loop that races
43
+ `ctx.dequeue_event()` against a short timer could fail with
44
+ `nondeterministic: history schedule but no emitted action`, skip a message, or read one twice
45
+ when the timer won and a message arrived in the same batch. A dropped read is now cancelled
46
+ where it is dropped, so replay picks the same winners as the first run.
47
+ - **`continue_as_new` carries exactly the unread messages.** A dropped or still-pending read
48
+ counted as a consumer, so a message could be lost at continue-as-new. The runtime now carries
49
+ every message that no read returned (at most 100, as before).
50
+ - **Inputs that arrive while an instance continues as new are kept.** Queue messages, signals
51
+ and cancellation requests that arrived between two executions could be deleted. They now go to
52
+ the next execution.
53
+ - **`ctx.get_kv_all_keys()` and `ctx.prune_kv_values_updated_before()` use key order.** Replay
54
+ could fail with `nondeterministic: kv clear mismatch` after a prune.
55
+
56
+ The queue, signal and continue-as-new changes apply to executions started by `duroxide` 0.1.32
57
+ or later. An execution started by an older runtime keeps the old behaviour until it completes or
58
+ continues as new. See the `duroxide` migration guide for details and rolling upgrades.
59
+
60
+ ### Added
61
+
62
+ - `tests/test_races.py` — drain loops that race `ctx.dequeue_event()` against a timer: every
63
+ message arrives once and in order, also across `continue_as_new`.
64
+ - `tests/test_kv_store.py` — KV keys are listed and pruned in key order, and a replayed prune
65
+ matches.
66
+
10
67
  ## [0.2.0] - 2026-10-04
11
68
 
12
69
  ### Changed
@@ -40,9 +40,9 @@ checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470"
40
40
 
41
41
  [[package]]
42
42
  name = "async-compression"
43
- version = "0.4.50"
43
+ version = "0.4.51"
44
44
  source = "registry+https://github.com/rust-lang/crates.io-index"
45
- checksum = "ee19bd99b43e3691acbad4e840420a4881cea6c0b66a208125a824f8fd53f5a1"
45
+ checksum = "9d5755640120b24961f8231e05892e4a4f7e0d04e8aeca161508c9c397946970"
46
46
  dependencies = [
47
47
  "compression-codecs",
48
48
  "compression-core",
@@ -69,7 +69,7 @@ checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667"
69
69
  dependencies = [
70
70
  "proc-macro2",
71
71
  "quote",
72
- "syn 3.0.6",
72
+ "syn 3.0.9",
73
73
  ]
74
74
 
75
75
  [[package]]
@@ -201,9 +201,9 @@ checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
201
201
 
202
202
  [[package]]
203
203
  name = "cc"
204
- version = "1.6.0"
204
+ version = "1.9.0"
205
205
  source = "registry+https://github.com/rust-lang/crates.io-index"
206
- checksum = "f74872d07caf508b30a21f6836e7d7016a2eaf7d9ff4f48deaa58cd8a0407630"
206
+ checksum = "877bf67ac8e52449eb2f9e98a344ea163beb70dd1f9eebe3cc5357dcfeaee4df"
207
207
  dependencies = [
208
208
  "find-msvc-tools",
209
209
  "shlex",
@@ -241,9 +241,9 @@ dependencies = [
241
241
 
242
242
  [[package]]
243
243
  name = "compression-codecs"
244
- version = "0.4.45"
244
+ version = "0.4.46"
245
245
  source = "registry+https://github.com/rust-lang/crates.io-index"
246
- checksum = "98fc98460ba0ad5317075d3632b8dfc45d0be8c4a49347c2a38272019717614a"
246
+ checksum = "cae36683101b2899f48bd31f8db9839437356188e3b1ff23096e73dab09ba8fe"
247
247
  dependencies = [
248
248
  "compression-core",
249
249
  "flate2",
@@ -252,9 +252,9 @@ dependencies = [
252
252
 
253
253
  [[package]]
254
254
  name = "compression-core"
255
- version = "0.4.33"
255
+ version = "0.4.34"
256
256
  source = "registry+https://github.com/rust-lang/crates.io-index"
257
- checksum = "6e8ccc4ea9f6acc32d102c0f6d471d11d913ad15f20c04de743374861fa1d414"
257
+ checksum = "2ebdda89edc534bf8d5dd2857562633b6495557e5846552ade994b99ed13c36a"
258
258
 
259
259
  [[package]]
260
260
  name = "const-oid"
@@ -313,9 +313,9 @@ checksum = "217698eaf96b4a3f0bc4f3662aaa55bdf913cd54d7204591faa790070c6d0853"
313
313
 
314
314
  [[package]]
315
315
  name = "crc32fast"
316
- version = "1.5.2"
316
+ version = "1.5.3"
317
317
  source = "registry+https://github.com/rust-lang/crates.io-index"
318
- checksum = "01a7799fd6b852db0e61728dde9a204c423b44d689dbd432522543614b490e78"
318
+ checksum = "0ba106e844045ddc02c20768ac4b0b7cb45f2cc2ecbd833ac9f5dacb183c2055"
319
319
  dependencies = [
320
320
  "cfg-if",
321
321
  ]
@@ -358,9 +358,9 @@ dependencies = [
358
358
 
359
359
  [[package]]
360
360
  name = "deranged"
361
- version = "0.5.8"
361
+ version = "0.5.9"
362
362
  source = "registry+https://github.com/rust-lang/crates.io-index"
363
- checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c"
363
+ checksum = "9e9de72ce2ad1f90dc62fa25f0f430ef85eb4b0d8fa0be4f30373bc40a21d28e"
364
364
  dependencies = [
365
365
  "serde_core",
366
366
  ]
@@ -385,7 +385,7 @@ checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8"
385
385
  dependencies = [
386
386
  "proc-macro2",
387
387
  "quote",
388
- "syn 3.0.6",
388
+ "syn 3.0.9",
389
389
  ]
390
390
 
391
391
  [[package]]
@@ -396,9 +396,9 @@ checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
396
396
 
397
397
  [[package]]
398
398
  name = "duroxide"
399
- version = "0.1.30"
399
+ version = "0.1.32"
400
400
  source = "registry+https://github.com/rust-lang/crates.io-index"
401
- checksum = "92b17ebe10f702644ad65a9c624b4060023955b4cd145c23ed4c6942b17fdac9"
401
+ checksum = "75573b31ca6fd3918acbe9af7c0ed32d3b181675cd9b01d9e09f2b8436c3d192"
402
402
  dependencies = [
403
403
  "async-trait",
404
404
  "futures",
@@ -417,9 +417,9 @@ dependencies = [
417
417
 
418
418
  [[package]]
419
419
  name = "duroxide-pg"
420
- version = "0.1.35"
420
+ version = "0.1.37"
421
421
  source = "registry+https://github.com/rust-lang/crates.io-index"
422
- checksum = "7b9a0c96cefcc9f2b886b2b40b5fca8e48ae234758185715fc5b60c1d804d0db"
422
+ checksum = "25078e5b66f273527dfd89928ab5f27119ecff7258f92f734b1ea428c33f54df"
423
423
  dependencies = [
424
424
  "anyhow",
425
425
  "async-trait",
@@ -443,7 +443,7 @@ dependencies = [
443
443
 
444
444
  [[package]]
445
445
  name = "duroxide-python"
446
- version = "0.2.0"
446
+ version = "0.2.2"
447
447
  dependencies = [
448
448
  "async-trait",
449
449
  "dotenvy",
@@ -465,18 +465,18 @@ checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555"
465
465
 
466
466
  [[package]]
467
467
  name = "either"
468
- version = "1.18.0"
468
+ version = "1.19.0"
469
469
  source = "registry+https://github.com/rust-lang/crates.io-index"
470
- checksum = "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34"
470
+ checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
471
471
  dependencies = [
472
472
  "serde",
473
473
  ]
474
474
 
475
475
  [[package]]
476
476
  name = "equivalent"
477
- version = "1.0.2"
477
+ version = "1.0.3"
478
478
  source = "registry+https://github.com/rust-lang/crates.io-index"
479
- checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
479
+ checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826"
480
480
 
481
481
  [[package]]
482
482
  name = "errno"
@@ -527,9 +527,9 @@ checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
527
527
 
528
528
  [[package]]
529
529
  name = "find-msvc-tools"
530
- version = "0.1.14"
530
+ version = "0.1.15"
531
531
  source = "registry+https://github.com/rust-lang/crates.io-index"
532
- checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484"
532
+ checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48"
533
533
 
534
534
  [[package]]
535
535
  name = "flate2"
@@ -650,7 +650,7 @@ checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44"
650
650
  dependencies = [
651
651
  "proc-macro2",
652
652
  "quote",
653
- "syn 3.0.6",
653
+ "syn 3.0.9",
654
654
  ]
655
655
 
656
656
  [[package]]
@@ -821,13 +821,12 @@ checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87"
821
821
 
822
822
  [[package]]
823
823
  name = "hyper"
824
- version = "1.11.1"
824
+ version = "1.12.0"
825
825
  source = "registry+https://github.com/rust-lang/crates.io-index"
826
- checksum = "27b501faa50e7a26c3d3560ca625132f4078a17771f4810baf70475ae48cbe43"
826
+ checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c"
827
827
  dependencies = [
828
828
  "atomic-waker",
829
829
  "bytes",
830
- "futures-channel",
831
830
  "futures-core",
832
831
  "http",
833
832
  "http-body",
@@ -1038,9 +1037,9 @@ dependencies = [
1038
1037
 
1039
1038
  [[package]]
1040
1039
  name = "indoc"
1041
- version = "2.0.7"
1040
+ version = "2.0.8"
1042
1041
  source = "registry+https://github.com/rust-lang/crates.io-index"
1043
- checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
1042
+ checksum = "a37b2691796cffeb8a8cd305ac66e65841559f147f4e63231d0eafa4db5384d1"
1044
1043
  dependencies = [
1045
1044
  "rustversion",
1046
1045
  ]
@@ -1079,9 +1078,9 @@ dependencies = [
1079
1078
 
1080
1079
  [[package]]
1081
1080
  name = "libc"
1082
- version = "0.2.190"
1081
+ version = "0.2.191"
1083
1082
  source = "registry+https://github.com/rust-lang/crates.io-index"
1084
- checksum = "ce5d3ddc6d3fa000eb1536d85e147bfe31aacaba692ed6a876f95cb7c855be78"
1083
+ checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
1085
1084
 
1086
1085
  [[package]]
1087
1086
  name = "libm"
@@ -1098,7 +1097,7 @@ dependencies = [
1098
1097
  "bitflags",
1099
1098
  "libc",
1100
1099
  "plain",
1101
- "redox_syscall 0.9.4",
1100
+ "redox_syscall 0.9.5",
1102
1101
  ]
1103
1102
 
1104
1103
  [[package]]
@@ -1450,9 +1449,9 @@ dependencies = [
1450
1449
 
1451
1450
  [[package]]
1452
1451
  name = "powerfmt"
1453
- version = "0.2.0"
1452
+ version = "0.2.1"
1454
1453
  source = "registry+https://github.com/rust-lang/crates.io-index"
1455
- checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
1454
+ checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958"
1456
1455
 
1457
1456
  [[package]]
1458
1457
  name = "ppv-lite86"
@@ -1617,9 +1616,9 @@ dependencies = [
1617
1616
 
1618
1617
  [[package]]
1619
1618
  name = "redox_syscall"
1620
- version = "0.9.4"
1619
+ version = "0.9.5"
1621
1620
  source = "registry+https://github.com/rust-lang/crates.io-index"
1622
- checksum = "737970939a87c6fa31e7acad13307bccbb017a073b695b6089a2c484f929e20e"
1621
+ checksum = "580c875845b41ecb1564ad1ae4703044cef774145e3d7a94dc2b3fa7c97868fd"
1623
1622
  dependencies = [
1624
1623
  "bitflags",
1625
1624
  ]
@@ -1742,9 +1741,9 @@ checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f"
1742
1741
 
1743
1742
  [[package]]
1744
1743
  name = "schannel"
1745
- version = "0.1.29"
1744
+ version = "0.1.30"
1746
1745
  source = "registry+https://github.com/rust-lang/crates.io-index"
1747
- checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939"
1746
+ checksum = "9cb23c424d8ee841bb4d813677ca237e2a610067d594fec130f87d6093495ab5"
1748
1747
  dependencies = [
1749
1748
  "windows-sys 0.61.2",
1750
1749
  ]
@@ -1811,14 +1810,14 @@ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
1811
1810
  dependencies = [
1812
1811
  "proc-macro2",
1813
1812
  "quote",
1814
- "syn 3.0.6",
1813
+ "syn 3.0.9",
1815
1814
  ]
1816
1815
 
1817
1816
  [[package]]
1818
1817
  name = "serde_json"
1819
- version = "1.0.151"
1818
+ version = "1.0.154"
1820
1819
  source = "registry+https://github.com/rust-lang/crates.io-index"
1821
- checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14"
1820
+ checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6"
1822
1821
  dependencies = [
1823
1822
  "itoa",
1824
1823
  "memchr",
@@ -1910,9 +1909,9 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
1910
1909
 
1911
1910
  [[package]]
1912
1911
  name = "smallvec"
1913
- version = "1.16.2"
1912
+ version = "1.16.3"
1914
1913
  source = "registry+https://github.com/rust-lang/crates.io-index"
1915
- checksum = "f9395f0f0eee849a9b707b2f06bb92a6a422090e2123bb2ef8e87a0e61892a8e"
1914
+ checksum = "5b3dc8af474f516a851ff4bd12db780f948b9250ad37211e4eec0bccea54e01b"
1916
1915
  dependencies = [
1917
1916
  "serde",
1918
1917
  ]
@@ -2175,9 +2174,9 @@ dependencies = [
2175
2174
 
2176
2175
  [[package]]
2177
2176
  name = "syn"
2178
- version = "3.0.6"
2177
+ version = "3.0.9"
2179
2178
  source = "registry+https://github.com/rust-lang/crates.io-index"
2180
- checksum = "8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee"
2179
+ checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b"
2181
2180
  dependencies = [
2182
2181
  "proc-macro2",
2183
2182
  "quote",
@@ -2201,7 +2200,7 @@ checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02"
2201
2200
  dependencies = [
2202
2201
  "proc-macro2",
2203
2202
  "quote",
2204
- "syn 3.0.6",
2203
+ "syn 3.0.9",
2205
2204
  ]
2206
2205
 
2207
2206
  [[package]]
@@ -2240,7 +2239,7 @@ checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524"
2240
2239
  dependencies = [
2241
2240
  "proc-macro2",
2242
2241
  "quote",
2243
- "syn 3.0.6",
2242
+ "syn 3.0.9",
2244
2243
  ]
2245
2244
 
2246
2245
  [[package]]
@@ -2300,9 +2299,9 @@ checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee"
2300
2299
 
2301
2300
  [[package]]
2302
2301
  name = "tokio"
2303
- version = "1.53.2"
2302
+ version = "1.54.0"
2304
2303
  source = "registry+https://github.com/rust-lang/crates.io-index"
2305
- checksum = "e95f91fcc7a621e8b030f6aa23c71fe9838ae2fb4d8118b75602a328f5144044"
2304
+ checksum = "a0c168a474b95bfecfe908a65d4bdffc523144b649a74c09c286afb35d53e0bc"
2306
2305
  dependencies = [
2307
2306
  "bytes",
2308
2307
  "libc",
@@ -2323,7 +2322,7 @@ checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e"
2323
2322
  dependencies = [
2324
2323
  "proc-macro2",
2325
2324
  "quote",
2326
- "syn 3.0.6",
2325
+ "syn 3.0.9",
2327
2326
  ]
2328
2327
 
2329
2328
  [[package]]
@@ -2349,13 +2348,14 @@ dependencies = [
2349
2348
 
2350
2349
  [[package]]
2351
2350
  name = "tokio-util"
2352
- version = "0.7.19"
2351
+ version = "0.7.20"
2353
2352
  source = "registry+https://github.com/rust-lang/crates.io-index"
2354
- checksum = "494815d09bf52b5548659851081238f0ca39ff638363907596da739561c62c52"
2353
+ checksum = "e464cf451ba96ebfc6f9b6542f17ee8b8956e33f1e40d9690624e59d7a7f8a4b"
2355
2354
  dependencies = [
2356
2355
  "bytes",
2357
2356
  "futures-core",
2358
2357
  "futures-sink",
2358
+ "futures-util",
2359
2359
  "pin-project-lite",
2360
2360
  "tokio",
2361
2361
  ]
@@ -2556,15 +2556,15 @@ checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5"
2556
2556
 
2557
2557
  [[package]]
2558
2558
  name = "unicode-ident"
2559
- version = "1.0.26"
2559
+ version = "1.0.27"
2560
2560
  source = "registry+https://github.com/rust-lang/crates.io-index"
2561
- checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954"
2561
+ checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
2562
2562
 
2563
2563
  [[package]]
2564
2564
  name = "unicode-normalization"
2565
- version = "0.1.25"
2565
+ version = "0.1.26"
2566
2566
  source = "registry+https://github.com/rust-lang/crates.io-index"
2567
- checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8"
2567
+ checksum = "75cd3fb03d5288b3ba9a1ee103ac7e9cbb59f0b03d64f8ddfcc04dd42758a85d"
2568
2568
  dependencies = [
2569
2569
  "tinyvec",
2570
2570
  ]
@@ -2601,9 +2601,9 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be"
2601
2601
 
2602
2602
  [[package]]
2603
2603
  name = "uuid"
2604
- version = "1.27.0"
2604
+ version = "1.28.0"
2605
2605
  source = "registry+https://github.com/rust-lang/crates.io-index"
2606
- checksum = "97277d36b9c3ace13e58fa6e753f8b0bbbf302a18dd193240d70f9e29681059a"
2606
+ checksum = "7cc1186384beb7dd8eedea376413fd654937285ea6c9cfbb928dc3043ea4b606"
2607
2607
  dependencies = [
2608
2608
  "getrandom 0.4.3",
2609
2609
  "js-sys",
@@ -2630,9 +2630,9 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
2630
2630
 
2631
2631
  [[package]]
2632
2632
  name = "want"
2633
- version = "0.3.1"
2633
+ version = "0.3.2"
2634
2634
  source = "registry+https://github.com/rust-lang/crates.io-index"
2635
- checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
2635
+ checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b"
2636
2636
  dependencies = [
2637
2637
  "try-lock",
2638
2638
  ]
@@ -2692,7 +2692,7 @@ dependencies = [
2692
2692
  "bumpalo",
2693
2693
  "proc-macro2",
2694
2694
  "quote",
2695
- "syn 3.0.6",
2695
+ "syn 3.0.9",
2696
2696
  "wasm-bindgen-shared",
2697
2697
  ]
2698
2698
 
@@ -2897,24 +2897,24 @@ checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71"
2897
2897
  dependencies = [
2898
2898
  "proc-macro2",
2899
2899
  "quote",
2900
- "syn 3.0.6",
2900
+ "syn 3.0.9",
2901
2901
  "synstructure",
2902
2902
  ]
2903
2903
 
2904
2904
  [[package]]
2905
2905
  name = "zerocopy"
2906
- version = "0.8.59"
2906
+ version = "0.8.63"
2907
2907
  source = "registry+https://github.com/rust-lang/crates.io-index"
2908
- checksum = "6df92bf3d9227be3d53173901ddbffac2babc27ae50f397776ffd6dc33f800cb"
2908
+ checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8"
2909
2909
  dependencies = [
2910
2910
  "zerocopy-derive",
2911
2911
  ]
2912
2912
 
2913
2913
  [[package]]
2914
2914
  name = "zerocopy-derive"
2915
- version = "0.8.59"
2915
+ version = "0.8.63"
2916
2916
  source = "registry+https://github.com/rust-lang/crates.io-index"
2917
- checksum = "ac4f328cf2f05d084e496c3e9c3f33ed0a183656a16e1fcec4d464d8373aec82"
2917
+ checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f"
2918
2918
  dependencies = [
2919
2919
  "proc-macro2",
2920
2920
  "quote",
@@ -2938,15 +2938,15 @@ checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a"
2938
2938
  dependencies = [
2939
2939
  "proc-macro2",
2940
2940
  "quote",
2941
- "syn 3.0.6",
2941
+ "syn 3.0.9",
2942
2942
  "synstructure",
2943
2943
  ]
2944
2944
 
2945
2945
  [[package]]
2946
2946
  name = "zeroize"
2947
- version = "1.9.0"
2947
+ version = "1.9.1"
2948
2948
  source = "registry+https://github.com/rust-lang/crates.io-index"
2949
- checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e"
2949
+ checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879"
2950
2950
 
2951
2951
  [[package]]
2952
2952
  name = "zerotrie"
@@ -2978,7 +2978,7 @@ checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da"
2978
2978
  dependencies = [
2979
2979
  "proc-macro2",
2980
2980
  "quote",
2981
- "syn 3.0.6",
2981
+ "syn 3.0.9",
2982
2982
  ]
2983
2983
 
2984
2984
  [[package]]
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "duroxide-python"
3
- version = "0.2.0"
3
+ version = "0.2.2"
4
4
  edition = "2021"
5
5
  readme = "README.md"
6
6
 
@@ -9,8 +9,8 @@ name = "duroxide_python"
9
9
  crate-type = ["cdylib"]
10
10
 
11
11
  [dependencies]
12
- duroxide = { version = "0.1.30", features = ["sqlite"] }
13
- duroxide-pg = "0.1.35"
12
+ duroxide = { version = "0.1.32", features = ["sqlite"] }
13
+ duroxide-pg = "0.1.37"
14
14
  pyo3 = { version = "0.23", features = ["extension-module", "abi3-py39"] }
15
15
  async-trait = "0.1"
16
16
  tokio = { version = "1", features = ["full"] }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: duroxide
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: 3
@@ -275,6 +275,10 @@ reply = json.loads(status.custom_status)
275
275
 
276
276
  ## Development
277
277
 
278
+ Install Rust through [rustup](https://rustup.rs/). The root `rust-toolchain.toml`
279
+ selects the compiler for local builds and GitHub Actions, including wheel builds
280
+ inside manylinux containers.
281
+
278
282
  ```bash
279
283
  # Create and activate a virtual environment
280
284
  python3 -m venv .venv
@@ -253,6 +253,10 @@ reply = json.loads(status.custom_status)
253
253
 
254
254
  ## Development
255
255
 
256
+ Install Rust through [rustup](https://rustup.rs/). The root `rust-toolchain.toml`
257
+ selects the compiler for local builds and GitHub Actions, including wheel builds
258
+ inside manylinux containers.
259
+
256
260
  ```bash
257
261
  # Create and activate a virtual environment
258
262
  python3 -m venv .venv
@@ -297,7 +297,7 @@ File-based SQLite can hit "database is locked" errors under concurrent orchestra
297
297
 
298
298
  ### Runtime Shutdown
299
299
 
300
- `Runtime.shutdown(timeout_ms)` waits for the full timeout duration unconditionally. Use a small timeout (e.g., 100ms) in tests.
300
+ `Runtime.shutdown(timeout_ms)` returns as soon as all runtime work has stopped. `timeout_ms` (default 1000) is the longest it waits for in-flight work before cancelling the rest; it is not a fixed delay.
301
301
 
302
302
  ### Platform-Specific Binary
303
303
 
@@ -418,7 +418,7 @@ response = client.get_kv_value("server-1", "response:op-1")
418
418
  - `ctx.set_kv_value(key, value)` — set or overwrite a key
419
419
  - `ctx.get_kv_value(key)` — read the current value for a key in the active instance
420
420
  - `ctx.get_kv_all_values()` — return a snapshot dict of all current KV entries
421
- - `ctx.get_kv_all_keys()` — return the list of active keys
421
+ - `ctx.get_kv_all_keys()` — return the list of active keys, in key order
422
422
  - `ctx.get_kv_length()` — return the number of active keys
423
423
  - `ctx.clear_kv_value(key)` — remove a single key
424
424
  - `ctx.clear_all_kv_values()` — clear all keys for the active instance
@@ -474,6 +474,23 @@ def multi_queue(ctx, input):
474
474
  return {"command": command, "config": config}
475
475
  ```
476
476
 
477
+ ### Draining with a Timeout
478
+
479
+ `ctx.race()` can bound a read with a timer. A read that loses the race takes no message, and
480
+ `continue_as_new` carries every message that no read returned (at most 100; the runtime drops
481
+ the rest with a warning):
482
+
483
+ ```python
484
+ @runtime.register_orchestration("Drain")
485
+ def drain(ctx, input):
486
+ handled = []
487
+ while True:
488
+ winner = yield ctx.race(ctx.dequeue_event("requests"), ctx.schedule_timer(1000))
489
+ if winner["index"] == 1:
490
+ return handled # no message for 1 s
491
+ handled.append(winner["value"])
492
+ ```
493
+
477
494
  ## Retry on Session — Retry with Session Affinity
478
495
 
479
496
  `schedule_activity_with_retry_on_session` combines retry policies with session affinity — all retry attempts are pinned to the same worker session:
@@ -4,7 +4,7 @@ build-backend = "maturin"
4
4
 
5
5
  [project]
6
6
  name = "duroxide"
7
- version = "0.2.0"
7
+ version = "0.2.2"
8
8
  description = "Python SDK for the Duroxide durable execution runtime"
9
9
  readme = "README.md"
10
10
  license = { text = "MIT" }
@@ -0,0 +1,6 @@
1
+ [toolchain]
2
+ # Before changing this version, check Microsoft's internal Rust availability:
3
+ # msrustup toolchain available --all-channels=prod
4
+ # After changing this version, also update the internal pipelines to match.
5
+ channel = "1.97.1"
6
+ profile = "minimal"
@@ -83,6 +83,42 @@ def test_kv_request_response(provider):
83
83
  runtime.shutdown(100)
84
84
 
85
85
 
86
+ def test_kv_keys_listed_and_pruned_in_key_order_and_prune_replays(provider):
87
+ """duroxide 0.1.32 lists and prunes keys in key order (microsoft/duroxide#57). Before,
88
+ both used hash order, which differs between replays, so the replay of a prune that cleared
89
+ several keys failed with "nondeterministic: kv clear mismatch"."""
90
+ keys = ["k7", "k3", "k5", "k1", "k8", "k2", "k6", "k4"]
91
+ client = Client(provider)
92
+ runtime = Runtime(provider, RuntimeOptions(dispatcher_poll_interval_ms=50))
93
+
94
+ @runtime.register_orchestration("KvKeyOrder")
95
+ def kv_key_order(ctx, _input):
96
+ for key in keys:
97
+ ctx.set_kv_value(key, key)
98
+ listed = ctx.get_kv_all_keys()
99
+ # A cutoff after every write prunes all eight keys.
100
+ pruned = ctx.prune_kv_values_updated_before(2**53 - 1)
101
+ # The next turn replays the writes and the prune, and must clear the keys in the
102
+ # order this turn recorded.
103
+ yield ctx.schedule_timer(5)
104
+ return {"listed": listed, "pruned": pruned, "after": ctx.get_kv_all_keys()}
105
+
106
+ runtime.start()
107
+
108
+ try:
109
+ instance_id = uid("kv-key-order")
110
+ client.start_orchestration(instance_id, "KvKeyOrder", "")
111
+ result = client.wait_for_orchestration(instance_id, 5_000)
112
+ assert result.status == "Completed", f"orchestration failed: {result.error}"
113
+ assert result.output == {
114
+ "listed": ["k1", "k2", "k3", "k4", "k5", "k6", "k7", "k8"],
115
+ "pruned": 8,
116
+ "after": [],
117
+ }
118
+ finally:
119
+ runtime.shutdown(100)
120
+
121
+
86
122
  def test_kv_bulk_helpers(provider):
87
123
  client = Client(provider)
88
124
  runtime = Runtime(provider, RuntimeOptions(dispatcher_poll_interval_ms=50))
@@ -555,3 +555,105 @@ class TestTypePreservation:
555
555
  r3 = run_orchestration(provider, "RaceObject", None, setup_obj)
556
556
  assert r3.output["value"] == {"key": "val"}
557
557
  assert isinstance(r3.output["value"], dict)
558
+
559
+
560
+ # ─── dequeue_event raced against a timer ─────────────────────────
561
+ #
562
+ # A drain loop races a queue read against a short timer. When the timer wins, the read is
563
+ # dropped. Since duroxide 0.1.32 a dropped read is cancelled at the drop: it never takes a
564
+ # message, replay picks the same winners as the live run, and continue_as_new carries exactly
565
+ # the messages that no read returned. Before, a timer win followed by a message in the same
566
+ # batch could fail the instance with "nondeterministic: history schedule but no emitted
567
+ # action", skip a message, or lose one at continue_as_new.
568
+
569
+
570
+ def _decode_message(value):
571
+ return json.loads(value) if isinstance(value, str) else value
572
+
573
+
574
+ def _produce_numbered(client, instance_id, count):
575
+ """Numbered messages with deterministic 0-30 ms gaps, a 100 ms pause after every 50th
576
+ message so the timer also wins, and a final {"done": True}."""
577
+ for i in range(count):
578
+ client.enqueue_event(instance_id, "q", {"i": i})
579
+ time.sleep(0.1 if i % 50 == 49 else ((i * 17 + 7) % 31) / 1000)
580
+ client.enqueue_event(instance_id, "q", {"done": True})
581
+
582
+
583
+ class TestDequeueRacedAgainstTimer:
584
+ def test_read_that_loses_to_timer_takes_no_message(self, provider):
585
+ count = 300
586
+ instance_id = uid("race-drain-loop")
587
+ client = Client(provider)
588
+ runtime = Runtime(provider, RuntimeOptions(
589
+ orchestration_concurrency=2,
590
+ worker_concurrency=2,
591
+ dispatcher_poll_interval_ms=10,
592
+ ))
593
+
594
+ @runtime.register_orchestration("RaceDrainLoop")
595
+ def race_drain_loop(ctx, input):
596
+ seq = []
597
+ timers = 0
598
+ while True:
599
+ winner = yield ctx.race(ctx.dequeue_event("q"), ctx.schedule_timer(20))
600
+ if winner["index"] == 1:
601
+ timers += 1
602
+ continue
603
+ message = _decode_message(winner["value"])
604
+ if message.get("done"):
605
+ return {"seq": seq, "timers": timers}
606
+ seq.append(message["i"])
607
+
608
+ runtime.start()
609
+ try:
610
+ client.start_orchestration(instance_id, "RaceDrainLoop", None)
611
+ _produce_numbered(client, instance_id, count)
612
+ result = client.wait_for_orchestration(instance_id, 60_000)
613
+
614
+ assert result.status == "Completed", f"orchestration failed: {result.error}"
615
+ assert result.output["seq"] == list(range(count))
616
+ assert result.output["timers"] > 0, "the timer never won, so no read was dropped"
617
+ finally:
618
+ runtime.shutdown(100)
619
+
620
+ def test_continue_as_new_after_lost_read_carries_unread_messages(self, provider):
621
+ count = 200
622
+ instance_id = uid("race-drain-can")
623
+ client = Client(provider)
624
+ runtime = Runtime(provider, RuntimeOptions(
625
+ orchestration_concurrency=2,
626
+ worker_concurrency=2,
627
+ dispatcher_poll_interval_ms=10,
628
+ ))
629
+
630
+ @runtime.register_orchestration("RaceDrainCan")
631
+ def race_drain_can(ctx, state):
632
+ next_i = state["next"]
633
+ while True:
634
+ winner = yield ctx.race(ctx.dequeue_event("q"), ctx.schedule_timer(10))
635
+ if winner["index"] == 1:
636
+ # The read lost and is dropped. Messages it did not take move to the next
637
+ # execution.
638
+ yield ctx.continue_as_new({"next": next_i, "cans": state["cans"] + 1})
639
+ return None
640
+ message = _decode_message(winner["value"])
641
+ if message.get("done"):
642
+ return {"next": next_i, "cans": state["cans"]}
643
+ if message["i"] != next_i:
644
+ raise ValueError(f"expected message {next_i}, got {message['i']}")
645
+ next_i += 1
646
+
647
+ runtime.start()
648
+ try:
649
+ client.start_orchestration(instance_id, "RaceDrainCan", {"next": 0, "cans": 0})
650
+ _produce_numbered(client, instance_id, count)
651
+ result = client.wait_for_orchestration(instance_id, 60_000)
652
+
653
+ assert result.status == "Completed", f"orchestration failed: {result.error}"
654
+ assert result.output["next"] == count
655
+ assert result.output["cans"] > 0, (
656
+ "the timer never won, so the instance never continued as new"
657
+ )
658
+ finally:
659
+ runtime.shutdown(100)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes