Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(vow): a pattern for promises that survive upgrades #8742

Merged
merged 19 commits into from
Feb 23, 2024
Merged

Conversation

michaelfig
Copy link
Member

@michaelfig michaelfig commented Jan 11, 2024

Closes: #8906

Description

Vows are a kind of "pseudo-promise" in that they are ocaps that can be made durable, and don't have a .then method so they won't be adopted by the platform Promise implementation.

The @agoric/vow module provides:

  • a when(specimen): Promise<T> operator for returning a promise for the fulfilment of a specimen, including unwrapping any intermediate Vows. This operator is not durable-compatible.
  • a watch(specimen, { onFulfilled, onRejected }): Vow<T> operator that registers possibly durable fulfilment and rejection handlers, and returns a durable Vow for the result of calling those handlers.
  • makeVowKit(): { whenable, resolver: { resolve, reject } }

Security Considerations

Scaling Considerations

Documentation Considerations

Testing Considerations

Upgrade Considerations

@michaelfig michaelfig added enhancement New feature or request pegasus far Distributed object helpers labels Jan 11, 2024
@michaelfig michaelfig self-assigned this Jan 11, 2024
@michaelfig michaelfig marked this pull request as ready for review January 12, 2024 18:23
@michaelfig michaelfig changed the title feat(whenable): new pattern for promises that survive upgrades feat(whenable): a pattern for promises that survive upgrades Jan 12, 2024
@michaelfig michaelfig requested review from mhofman and erights January 14, 2024 18:29
Copy link
Member

@erights erights left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these all the files needed to create a well-formed package under agoric-sdk? In endo I use https://github.com/endojs/endo/blob/master/scripts/create-package.sh which starts my copying https://github.com/endojs/endo/tree/master/packages/skel

@kriskowal could agoric-sdk use its own copy of create-package.sh and skel for this purpose?

Copy link
Member

@erights erights left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Progress, but review far from done.

@erights erights self-requested a review January 22, 2024 20:35
@erights erights self-requested a review January 29, 2024 04:03
Copy link
Member

@erights erights left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am finding it hard to review without already knowing concretely how you intend that it be used. There are neither inline comments nor any *.md files. There is the PR comment, which is certainly a great start!

I'll keep going on this review pass for awhile. But if I cannot figure it out despite my existing orientation, may others won't as well, until there is more explanatory text.

Copy link
Member

@erights erights left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I think I'm done enough for this pass. Will do another once I understand better.

@erights erights self-requested a review January 29, 2024 23:31
import { makeTagged } from '@endo/pass-style';
import { prepareVowTools } from '../src/tools.js';

test('retry on disconnection', async t => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah... this looks like it demonstrates how to use the API

dckc
dckc previously requested changes Feb 21, 2024
Copy link
Member

@dckc dckc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need something that can go through endo interface guards.

@dckc dckc dismissed their stale review February 21, 2024 00:54

false alarm

@michaelfig michaelfig added the automerge:no-update (expert!) Automatically merge without updates label Feb 23, 2024
@mergify mergify bot merged commit 0ebb76d into master Feb 23, 2024
67 checks passed
@mergify mergify bot deleted the mfig-whenable branch February 23, 2024 03:30
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
automerge:no-update (expert!) Automatically merge without updates enhancement New feature or request far Distributed object helpers pegasus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Vows for upgrade-tolerant promise behaviour
4 participants