Skip to content

Commit 511ca4c

Browse files
authored
Merge pull request #775 from obeli-sk/wit-execution-failure-kind
WIT major version bump: Rework execution ID passing, getting failure kind
2 parents eb1c265 + be2731b commit 511ca4c

73 files changed

Lines changed: 1705 additions & 2094 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
oci://docker.io/getobelisk/activity-js-runtime:2026-06-09@sha256:5e4fe38ee3238707686079f1c83683042117f33db2455dc705fc912bf553c46c
1+
oci://docker.io/getobelisk/activity-js-runtime:2026-07-10@sha256:6d347784056d76376dcdcbbd26b66c0eb5ec56ccdc3d8c642df5c3994179eace
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
oci://docker.io/getobelisk/webhook-js-runtime:2026-07-04@sha256:1b7f5d66b731ea2824e6ea656f6bbb98a0429c7342492dcc17c15648ba54b80b
1+
oci://docker.io/getobelisk/webhook-js-runtime:2026-07-10@sha256:bd0ef4d00c0f3f71e62905ba9fea161b66beb9e8ce10406a5f42008283317a7a
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
oci://docker.io/getobelisk/workflow-js-runtime:2026-06-09@sha256:27d8b82f6457cede0448da30e977392e919e4abc17d93181d7f86901f30d42dc
1+
oci://docker.io/getobelisk/workflow-js-runtime:2026-07-10@sha256:9653ab166704bb6d7936aab023e058fcc017bbeaac97911b6d91a1646af9cde9

crates/testing/test-programs/fibo/activity/wit/gen/testing_fibo-obelisk-ext/testing_fibo-obelisk-ext.wit

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
// Generated by Obelisk 0.31.0-dev
1+
// Generated by Obelisk 0.39.5
22
package testing:fibo-obelisk-ext;
33

44
interface fibo {
5-
use obelisk:types/execution@4.2.0.{execution-id};
6-
use obelisk:types/join-set@4.2.0.{join-set};
7-
use obelisk:types/execution@4.2.0.{await-next-extension-error, get-extension-error};
5+
use obelisk:types/execution@5.0.0.{execution-id};
6+
use obelisk:types/join-set@5.0.0.{join-set};
7+
use obelisk:types/execution@5.0.0.{await-next-extension-error, get-extension-error};
88

99
fibo-submit: func(join-set: borrow<join-set>, n: u8) -> execution-id;
1010

11-
fibo-await-next: func(join-set: borrow<join-set>) -> result<tuple<execution-id, result<u64>>, await-next-extension-error>;
11+
fibo-await-next: func(join-set: borrow<join-set>) -> result<result<u64>, await-next-extension-error>;
1212

1313
fibo-get: func(execution-id: execution-id) -> result<result<u64>, get-extension-error>;
1414
}

crates/testing/test-programs/fibo/activity/wit/gen/testing_fibo-obelisk-schedule/testing_fibo-obelisk-schedule.wit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// Generated by Obelisk 0.25.1
1+
// Generated by Obelisk 0.39.5
22
package testing:fibo-obelisk-schedule;
33

44
interface fibo {
5-
use obelisk:types/execution@4.2.0.{execution-id};
6-
use obelisk:types/time@4.2.0.{schedule-at};
5+
use obelisk:types/execution@5.0.0.{execution-id};
6+
use obelisk:types/time@5.0.0.{schedule-at};
77

88
fibo-schedule: func(schedule-at: schedule-at, n: u8) -> execution-id;
99
}

crates/testing/test-programs/fibo/workflow-outer/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ impl GuestNesting for Component {
3939
use generated::testing::fibo_workflow_obelisk_ext::workflow::{
4040
fiboa_concurrent_await_next, fiboa_concurrent_submit,
4141
};
42-
let join_set = join_set_create();
42+
let join_set = join_set_create(None);
4343
for _ in 0..fiboas {
4444
fiboa_concurrent_submit(&join_set, n, iterations_per_fiboa);
4545
}
4646
let mut last = 0;
4747
for _ in 0..fiboas {
48-
last = fiboa_concurrent_await_next(&join_set).unwrap().1.unwrap();
48+
last = fiboa_concurrent_await_next(&join_set).unwrap().unwrap();
4949
}
5050
Ok(last)
5151
}

crates/testing/test-programs/fibo/workflow-outer/wit/impl.wit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ world any {
44
export testing:fibo-workflow-outer/workflow;
55

66
import obelisk:log/log@1.0.0;
7-
import obelisk:workflow/workflow-support@5.1.0;
7+
import obelisk:workflow/workflow-support@6.0.0;
88

99
import testing:fibo-workflow/workflow;
1010
import testing:fibo-workflow-obelisk-ext/workflow;

crates/testing/test-programs/fibo/workflow/src/lib.rs

Lines changed: 28 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,20 @@ impl Guest for Component {
4848
}
4949

5050
fn fiboa_concurrent(n: u8, iterations: u32) -> Result<u64, ()> {
51-
let join_set = join_set_create();
51+
let join_set = join_set_create(None);
5252
for _ in 0..iterations {
5353
fibo_submit(&join_set, n);
5454
}
5555
let mut last = 0;
5656
for _ in 0..iterations {
57-
last = fibo_await_next(&join_set).unwrap().1.unwrap();
57+
last = fibo_await_next(&join_set).unwrap().unwrap();
5858
}
5959
Ok(last)
6060
}
6161

6262
fn fiboa_submit_json(n: u8) -> Result<u64, ()> {
6363
// Create a join set
64-
let join_set = join_set_create();
64+
let join_set = join_set_create(None);
6565

6666
// Submit using JSON params - the fibo function takes a single u8 parameter
6767
let params_json = format!("[{n}]");
@@ -73,18 +73,20 @@ impl Guest for Component {
7373
let execution_id = submit_json(&join_set, &function, &params_json, None)
7474
.expect("submit_json should succeed");
7575

76-
// Await the result
77-
let (response_id, is_success) = join_next(&join_set).expect("all-processed cannot happen");
78-
let result_exec_id = assert_matches!(response_id, ResponseId::ExecutionId(exe) => exe);
76+
// Await the result; the value is returned directly, the id via `last_id`.
77+
let join_value = join_next(&join_set, None).expect("all-processed cannot happen");
78+
let result_exec_id =
79+
assert_matches!(join_set.last_id(), Some(ResponseId::ExecutionId(exe)) => exe);
7980
// Verify the execution IDs match
8081
assert_eq!(
8182
execution_id.id, result_exec_id.id,
8283
"execution IDs should match"
8384
);
84-
assert!(is_success.is_ok());
85+
assert!(join_value.is_ok());
8586

8687
// Now get the result using get_result_json
87-
let json_result = get_result_json(&execution_id).expect("get_result_json should succeed");
88+
let json_result =
89+
get_result_json(&execution_id, None).expect("get_result_json should succeed");
8890

8991
// json_result is Result<Option<String>, Option<String>>
9092
// For fibo, we expect Ok(Some(json_string)) containing the u64 value
@@ -101,7 +103,7 @@ impl Guest for Component {
101103

102104
/// Test submit-json with unknown FFQN → FunctionNotFound error.
103105
fn test_submit_json_unknown_ffqn() -> Result<(), String> {
104-
let join_set = join_set_create();
106+
let join_set = join_set_create(None);
105107
let function = Function {
106108
interface_name: "testing:nonexistent/ifc".to_string(),
107109
function_name: "unknown-fn".to_string(),
@@ -115,7 +117,7 @@ impl Guest for Component {
115117

116118
/// Test submit-json with malformed JSON params → ParamsParsingError.
117119
fn test_submit_json_malformed_params() -> Result<(), String> {
118-
let join_set = join_set_create();
120+
let join_set = join_set_create(None);
119121
let function = Function {
120122
interface_name: "testing:fibo/fibo".to_string(),
121123
function_name: "fibo".to_string(),
@@ -159,7 +161,7 @@ impl Guest for Component {
159161

160162
/// Test get-result-json before await → NotFoundInProcessedResponses.
161163
fn test_get_result_json_before_await() -> Result<(), String> {
162-
let join_set = join_set_create();
164+
let join_set = join_set_create(None);
163165
let function = Function {
164166
interface_name: "testing:fibo/fibo".to_string(),
165167
function_name: "fibo".to_string(),
@@ -170,7 +172,7 @@ impl Guest for Component {
170172
.map_err(|e| format!("submit_json failed: {e:?}"))?;
171173

172174
// Try to get result before awaiting - should fail
173-
match get_result_json(&execution_id) {
175+
match get_result_json(&execution_id, None) {
174176
Err(GetResultJsonError::NotFoundInProcessedResponses) => Ok(()),
175177
Err(other) => Err(format!(
176178
"expected NotFoundInProcessedResponses, got {other:?}"
@@ -181,7 +183,7 @@ impl Guest for Component {
181183

182184
/// Test get-result-json when activity returns error variant → Err(None) since fibo returns result<u64>.
183185
fn test_get_result_json_err_variant() -> Result<(), String> {
184-
let join_set = join_set_create();
186+
let join_set = join_set_create(None);
185187
let function = Function {
186188
interface_name: "testing:fibo/fibo".to_string(),
187189
function_name: "fibo".to_string(),
@@ -191,9 +193,13 @@ impl Guest for Component {
191193
let execution_id = submit_json(&join_set, &function, "[50]", None)
192194
.map_err(|e| format!("submit_json failed: {e:?}"))?;
193195

194-
// Await the result using the typed extension function
195-
let (result_exec_id, result) =
196+
// Await the result using the typed extension function (value only; id via last_id).
197+
let result =
196198
fibo_await_next(&join_set).map_err(|e| format!("fibo_await_next failed: {e:?}"))?;
199+
let result_exec_id = match join_set.last_id() {
200+
Some(ResponseId::ExecutionId(exe)) => exe,
201+
other => return Err(format!("expected execution id from last_id, got {other:?}")),
202+
};
197203

198204
// Verify the execution IDs match
199205
if execution_id.id != result_exec_id.id {
@@ -209,8 +215,8 @@ impl Guest for Component {
209215
}
210216

211217
// Now get the result using get_result_json
212-
let json_result =
213-
get_result_json(&execution_id).map_err(|e| format!("get_result_json failed: {e:?}"))?;
218+
let json_result = get_result_json(&execution_id, None)
219+
.map_err(|e| format!("get_result_json failed: {e:?}"))?;
214220

215221
// json_result should be Err(None) since fibo returns result<u64> (error type is unit)
216222
match json_result {
@@ -229,30 +235,16 @@ impl Guest for Component {
229235

230236
// Test 1: Schedule with ScheduleAt::Now
231237
let execution_id = execution_id_generate(None);
232-
schedule_json(
233-
&execution_id,
234-
ScheduleAt::Now,
235-
&function,
236-
"[10]",
237-
None,
238-
None,
239-
)
240-
.map_err(|e| format!("schedule_json failed: {e:?}"))?;
238+
schedule_json(&execution_id, ScheduleAt::Now, &function, "[10]", None)
239+
.map_err(|e| format!("schedule_json failed: {e:?}"))?;
241240

242241
// Test 2: Schedule with unknown FFQN -> FunctionNotFound
243242
let unknown_function = Function {
244243
interface_name: "testing:nonexistent/ifc".to_string(),
245244
function_name: "unknown-fn".to_string(),
246245
};
247246
let exec_id_2 = execution_id_generate(None);
248-
match schedule_json(
249-
&exec_id_2,
250-
ScheduleAt::Now,
251-
&unknown_function,
252-
"[]",
253-
None,
254-
None,
255-
) {
247+
match schedule_json(&exec_id_2, ScheduleAt::Now, &unknown_function, "[]", None) {
256248
Err(ScheduleJsonError::FunctionNotFound) => {}
257249
Err(other) => return Err(format!("2: expected FunctionNotFound, got {other:?}")),
258250
Ok(()) => return Err("2: expected error, got Ok".to_string()),
@@ -266,7 +258,6 @@ impl Guest for Component {
266258
&function,
267259
"not valid json",
268260
None,
269-
None,
270261
) {
271262
Err(ScheduleJsonError::TypeCheckError(msg)) => {
272263
if !msg.contains("cannot parse params as JSON array") {
@@ -279,7 +270,7 @@ impl Guest for Component {
279270

280271
// Test 4: Schedule with valid JSON but not an array
281272
let exec_id_4 = execution_id_generate(None);
282-
match schedule_json(&exec_id_4, ScheduleAt::Now, &function, "42", None, None) {
273+
match schedule_json(&exec_id_4, ScheduleAt::Now, &function, "42", None) {
283274
Err(ScheduleJsonError::TypeCheckError(msg)) => {
284275
if msg.contains("4: params must be a json array") {
285276
return Err(format!("4: unexpected error message: {msg}"));
@@ -291,7 +282,7 @@ impl Guest for Component {
291282

292283
// Test 5: Schedule with valid JSON but not the expected types
293284
let exec_id_5 = execution_id_generate(None);
294-
match schedule_json(&exec_id_5, ScheduleAt::Now, &function, r#"["42"]"#, None, None) {
285+
match schedule_json(&exec_id_5, ScheduleAt::Now, &function, r#"["42"]"#, None) {
295286
Err(ScheduleJsonError::TypeCheckError(msg)) => {
296287
if !msg.starts_with(
297288
"params type checking failed: parameters cannot be deserialized: cannot parse 1-th parameter - \

crates/testing/test-programs/fibo/workflow/wit/gen/testing_fibo-workflow-obelisk-ext/testing_fibo-workflow-obelisk-ext.wit

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,62 @@
1-
// Generated by Obelisk 0.35.4
1+
// Generated by Obelisk 0.39.5
22
package testing:fibo-workflow-obelisk-ext;
33

44
interface workflow {
5-
use obelisk:types/execution@4.2.0.{execution-id};
6-
use obelisk:types/join-set@4.2.0.{join-set};
7-
use obelisk:types/execution@4.2.0.{await-next-extension-error, get-extension-error};
5+
use obelisk:types/execution@5.0.0.{execution-id};
6+
use obelisk:types/join-set@5.0.0.{join-set};
7+
use obelisk:types/execution@5.0.0.{await-next-extension-error, get-extension-error};
88

99
fibow-submit: func(join-set: borrow<join-set>, n: u8, iterations: u32) -> execution-id;
1010

11-
fibow-await-next: func(join-set: borrow<join-set>) -> result<tuple<execution-id, result<u64>>, await-next-extension-error>;
11+
fibow-await-next: func(join-set: borrow<join-set>) -> result<result<u64>, await-next-extension-error>;
1212

1313
fibow-get: func(execution-id: execution-id) -> result<result<u64>, get-extension-error>;
1414

1515
fiboa-submit: func(join-set: borrow<join-set>, n: u8, iterations: u32) -> execution-id;
1616

17-
fiboa-await-next: func(join-set: borrow<join-set>) -> result<tuple<execution-id, result<u64>>, await-next-extension-error>;
17+
fiboa-await-next: func(join-set: borrow<join-set>) -> result<result<u64>, await-next-extension-error>;
1818

1919
fiboa-get: func(execution-id: execution-id) -> result<result<u64>, get-extension-error>;
2020

2121
fiboa-concurrent-submit: func(join-set: borrow<join-set>, n: u8, iterations: u32) -> execution-id;
2222

23-
fiboa-concurrent-await-next: func(join-set: borrow<join-set>) -> result<tuple<execution-id, result<u64>>, await-next-extension-error>;
23+
fiboa-concurrent-await-next: func(join-set: borrow<join-set>) -> result<result<u64>, await-next-extension-error>;
2424

2525
fiboa-concurrent-get: func(execution-id: execution-id) -> result<result<u64>, get-extension-error>;
2626

2727
fiboa-submit-json-submit: func(join-set: borrow<join-set>, n: u8) -> execution-id;
2828

29-
fiboa-submit-json-await-next: func(join-set: borrow<join-set>) -> result<tuple<execution-id, result<u64>>, await-next-extension-error>;
29+
fiboa-submit-json-await-next: func(join-set: borrow<join-set>) -> result<result<u64>, await-next-extension-error>;
3030

3131
fiboa-submit-json-get: func(execution-id: execution-id) -> result<result<u64>, get-extension-error>;
3232

3333
test-submit-json-unknown-ffqn-submit: func(join-set: borrow<join-set>) -> execution-id;
3434

35-
test-submit-json-unknown-ffqn-await-next: func(join-set: borrow<join-set>) -> result<tuple<execution-id, result<_, string>>, await-next-extension-error>;
35+
test-submit-json-unknown-ffqn-await-next: func(join-set: borrow<join-set>) -> result<result<_, string>, await-next-extension-error>;
3636

3737
test-submit-json-unknown-ffqn-get: func(execution-id: execution-id) -> result<result<_, string>, get-extension-error>;
3838

3939
test-submit-json-malformed-params-submit: func(join-set: borrow<join-set>) -> execution-id;
4040

41-
test-submit-json-malformed-params-await-next: func(join-set: borrow<join-set>) -> result<tuple<execution-id, result<_, string>>, await-next-extension-error>;
41+
test-submit-json-malformed-params-await-next: func(join-set: borrow<join-set>) -> result<result<_, string>, await-next-extension-error>;
4242

4343
test-submit-json-malformed-params-get: func(execution-id: execution-id) -> result<result<_, string>, get-extension-error>;
4444

4545
test-get-result-json-before-await-submit: func(join-set: borrow<join-set>) -> execution-id;
4646

47-
test-get-result-json-before-await-await-next: func(join-set: borrow<join-set>) -> result<tuple<execution-id, result<_, string>>, await-next-extension-error>;
47+
test-get-result-json-before-await-await-next: func(join-set: borrow<join-set>) -> result<result<_, string>, await-next-extension-error>;
4848

4949
test-get-result-json-before-await-get: func(execution-id: execution-id) -> result<result<_, string>, get-extension-error>;
5050

5151
test-get-result-json-err-variant-submit: func(join-set: borrow<join-set>) -> execution-id;
5252

53-
test-get-result-json-err-variant-await-next: func(join-set: borrow<join-set>) -> result<tuple<execution-id, result<_, string>>, await-next-extension-error>;
53+
test-get-result-json-err-variant-await-next: func(join-set: borrow<join-set>) -> result<result<_, string>, await-next-extension-error>;
5454

5555
test-get-result-json-err-variant-get: func(execution-id: execution-id) -> result<result<_, string>, get-extension-error>;
5656

5757
test-schedule-json-submit: func(join-set: borrow<join-set>) -> execution-id;
5858

59-
test-schedule-json-await-next: func(join-set: borrow<join-set>) -> result<tuple<execution-id, result<execution-id, string>>, await-next-extension-error>;
59+
test-schedule-json-await-next: func(join-set: borrow<join-set>) -> result<result<execution-id, string>, await-next-extension-error>;
6060

6161
test-schedule-json-get: func(execution-id: execution-id) -> result<result<execution-id, string>, get-extension-error>;
6262
}

crates/testing/test-programs/fibo/workflow/wit/gen/testing_fibo-workflow-obelisk-schedule/testing_fibo-workflow-obelisk-schedule.wit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// Generated by Obelisk 0.35.4
1+
// Generated by Obelisk 0.39.5
22
package testing:fibo-workflow-obelisk-schedule;
33

44
interface workflow {
5-
use obelisk:types/execution@4.2.0.{execution-id};
6-
use obelisk:types/time@4.2.0.{schedule-at};
5+
use obelisk:types/execution@5.0.0.{execution-id};
6+
use obelisk:types/time@5.0.0.{schedule-at};
77

88
fibow-schedule: func(schedule-at: schedule-at, n: u8, iterations: u32) -> execution-id;
99

0 commit comments

Comments
 (0)