-
Notifications
You must be signed in to change notification settings - Fork 215
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
fix(notifier): For durable fail()
, persist the reason rather than a rejected promise
#7011
Conversation
… rejected promise Fixes #7009
packages/notifier/src/publish-kit.js
Outdated
if (targetStatus === 'failed') { | ||
canBeDurable(value) || | ||
Fail`Cannot accept non-durable fail reason: ${value}`; | ||
} else if (done || valueDurability === 'mandatory') { | ||
canBeDurable(value) || Fail`Cannot accept non-durable value: ${value}`; |
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'm not sure it's worth keeping a distinct message for fail(nonDurableReason)
vs. finish(nonDurableFinalValue)
and publish(nonDurableValue)
. If not, we could simplify this.
if (targetStatus === 'failed') { | |
canBeDurable(value) || | |
Fail`Cannot accept non-durable fail reason: ${value}`; | |
} else if (done || valueDurability === 'mandatory') { | |
canBeDurable(value) || Fail`Cannot accept non-durable value: ${value}`; | |
if (done || valueDurability === 'mandatory') { | |
canBeDurable(value) || Fail`Cannot accept non-durable value: ${value}`; |
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.
The stack trace should show which case it was. The only value I can think of is for a test to be able to verify which failure, but it could do that by exercising both paths. So +1 to the simplification.
packages/notifier/src/publish-kit.js
Outdated
if (targetStatus === 'failed') { | ||
canBeDurable(value) || | ||
Fail`Cannot accept non-durable fail reason: ${value}`; | ||
} else if (done || valueDurability === 'mandatory') { | ||
canBeDurable(value) || Fail`Cannot accept non-durable value: ${value}`; |
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.
The stack trace should show which case it was. The only value I can think of is for a test to be able to verify which failure, but it could do that by exercising both paths. So +1 to the simplification.
packages/notifier/src/publish-kit.js
Outdated
* @param {any} value | ||
* @param {any} [rejection] | ||
* @param {DurablePublishKitState["status"]} [targetStatus] |
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.
🙌 types
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.
This is a type syntax I have not seen before. What's the difference between
DurablePublishKitState["status"]
vs
DurablePublishKitState.status
or
DurablePublishKitState['status']
?
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.
The two quotes are just stylistic. Our Prettier config is single quotes but it doesn't reach into jsdoc.
The .
is reserved for referencing a namespace.
Fixes #7009
Description
Send the
fail
reason directly toadvanceDurablePublishKit
so it can persist the value before wrapping it in a rejected promise to resolve the outstanding tail promise.Security Considerations
None.
Scaling Considerations
No change.
Documentation Considerations
Not applicable.
Testing Considerations
#6523 should make it possible to update the durable publish kit tests for realistic durability constraints.