Proposal: Composite Queries

That works well if both A and B are part of the same service. I am worried about the cases where A and B are completely independent services written by different developers. Then the reentrant B → A query might not expect changes in the global state of A done by the initial query.

To give a concrete example: let’s say A is a booking service canister and B is a hotel canister. The user calls A.find_hotel(user, date), which calls B.find_room(user, date), which calls A.get_user_info(user).

Option 2 would execute A.get_user_info() against the intermediate state that has changes from A.find_hotel() that may break A.get_user_info(). (The developer A might have assumed that it is okay to destroy the global state of A in A.find_hotel() because the query state changes are discarded anyways).