-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: vowTools.allSettled
#10077
feat: vowTools.allSettled
#10077
Conversation
e1b5f2e
to
891b473
Compare
Deploying agoric-sdk with Cloudflare Pages
|
@@ -119,27 +173,36 @@ export const prepareWatchUtils = ( | |||
} | |||
return kit.vow; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a path for typing this, so we can keep the existing Vow<any[]>
for allVows
and something like Vow<({status: 'fulfilled', value: any} | {status: 'rejected', reason: Error})[]>
for allVowsSettled
?
h/t @Chris-Hibbert for the suggestion: https://github.com/Agoric/agoric-sdk/pull/9902/files#r1757395986
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've given this a shot above, but it is wholly untested. Hope it helps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, your suggestion worked! In hindsight, it was obvious 😅
packages/vow/src/watch-utils.js
Outdated
/** | ||
* @param {EVow<unknown>[]} vows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pet peeve; the arguments are not vows, they're unknown specimens that might be vows. That's what EVow
describes:
/** | |
* @param {EVow<unknown>[]} vows | |
/** | |
* @param {EVow<unknown>[]} specimens |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1. regardless of pet peeves, this is a code interpretability issue worth improving.
incidentally, since ERef
is "a ref or eventually a ref" one is likely to read EVow
as "a vow or eventually a vow" but it's really "ERef or Vow". We could consider some other names like EVRef
or VowRef
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about this further, the type should actually be:
* @param {unknown[]} specimens
@@ -119,27 +173,36 @@ export const prepareWatchUtils = ( | |||
} | |||
return kit.vow; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've given this a shot above, but it is wholly untested. Hope it helps.
26a118a
to
baedae2
Compare
baedae2
to
8c50684
Compare
@@ -77,6 +77,67 @@ const { watch, makeVowKit } = prepareVowTools(vowZone); | |||
// Vows and resolvers you create can be saved in durable stores. | |||
``` | |||
|
|||
## VowTools |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 !
82c4902
to
2bf7f89
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some clarifications for the README.md. I haven't looked further yet.
eaca71b
to
947b150
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Well done.
Co-authored-by: Michael FIG <[email protected]>
- adds vowTools helper that mimics the behavior of Promise.allSettled
947b150
to
c3babe6
Compare
closes: #9925 refs: #9193 ## Description - This PR primarily hardens the `zoeTools` implementation for orchestrated async-flows by: - ensuring payments handled in `zoeTools.localTransfer` are recovered to the original seat in the event of failure or partial failure - providing a `zoeTools.withdrawFromSeat` retriable function to facilitate withdrawing funds from a LocalChainAccount to a User seat. Ensures all changes are rolled back in the event of partial failure. - using `asVow` instead of `retriable` since these operations are not idempotent - Creates `src/fixtures/zoe-tools.contract.js` to facilitate testing error paths - To facilitate the change, `vowTools.allVowsSettled` was implemented in `@agoric/vow`. See #10077 which this PR depends on ### Security Considerations Improves safety around Payment handling in async-flow contracts in `@agoric/orchestration` ### Scaling Considerations n/a ### Documentation Considerations Updates jsdoc strings for `localTransfer` and `withdrawToSeat`. As maintainer notes for considerations around `asVow` and promptness. ### Testing Considerations Includes tests with different failure paths previously unaccounted for. ### Upgrade Considerations Unreleased code that will be part of an npm release
Description
Promise.allSettled
to support feat: zoeTools.localTransfer error paths #9902Security Considerations
n/a
Scaling Considerations
n/a
Documentation Considerations
Updates
vow/README.md
with information aboutVowTools
Testing Considerations
Includes unit tests
Upgrade Considerations
n/a, library code