@@ -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 - \
0 commit comments