Skip to content
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(marshal): tolerate extra error props #2052

Merged
merged 2 commits into from
Feb 13, 2024

Conversation

erights
Copy link
Contributor

@erights erights commented Feb 11, 2024

closes: #XXXX
refs: #2042 #550

Description

To enable future versions of marshal to send extra error properties, like cause and error, marshal must tolerate receiving them.

Sets the stage for #2024

Security Considerations

by tolerating the reception of extra error props, we no longer inhibit senders from sending them, including misspelled or otherwise mistaken ones. This weaken the degree to which unmarshaling validates. This is the necessary price of accommodating expected future growth.

Scaling Considerations

none

Documentation Considerations

none

Testing Considerations

tests included also serve as a baseline for #2042, which needs to change them in order to pass again. This provides a record of the difference between this PR and #2042.

Compatibility Considerations

The whole point, is to accommodate an expected future in which some extra properties are sent, such as cause and errors.

Upgrade Considerations

This change, to tolerate receiving extra properties, needs to roll out everywhere, before we can roll out a future change sending extra properties such as cause or errors. (#2042, though it is a future change that builds on this one, is not that future change because it still does not send any extra properties.)

This PR is not breaking. Nor is it combined with #2042. The future change where extra error properties are sent will not be a breaking change compared to code incorporating this PR (or this PR + #2042). However, that future change will be breaking compared to code prior to this PR.

No news update needed.

  • Includes *BREAKING*: in the commit message with migration instructions for any breaking change.
  • Updates NEWS.md for user-facing changes.

@erights erights self-assigned this Feb 11, 2024
@erights erights force-pushed the markm-tolerate-extra-error-props branch 2 times, most recently from d1de98e to 30dce0f Compare February 11, 2024 18:27
@erights erights marked this pull request as ready for review February 11, 2024 19:01
@erights
Copy link
Contributor Author

erights commented Feb 11, 2024

@gibson042 , as far as I could tell, I did not need to make a corresponding change to encodePassable.js. Is this true, or did I miss something? What about tests of encodePassable?

@erights
Copy link
Contributor Author

erights commented Feb 11, 2024

@kriskowal , although #2042 is also ready for review, I do not expect to get it into the next endo release. It is also large, and therefore has more design issues we may need to argue through.

But because of the stage setting nature of this PR and well as its minimal effect, I would very much like to get this PR into the next endo release if possible.

@erights erights requested a review from dckc February 11, 2024 19:31
@dckc
Copy link
Contributor

dckc commented Feb 12, 2024

Upgrade Considerations

None

I wonder if it's more subtle than that. This one (call it n) is not a breaking change, and a future change (n+m) to take advantage of this won't look like a breaking change compared to this one, but n+m will be a breaking change w.r.t. n-1.

So this looks like one of those changes that has to roll out ~everywhere before anything can take advantage of it.

@erights
Copy link
Contributor Author

erights commented Feb 12, 2024

Upgrade Considerations

None

I wonder if it's more subtle than that. This one (call it n) is not a breaking change, and a future change (n+m) to take advantage of this won't look like a breaking change compared to this one, but n+m will be a breaking change w.r.t. n-1.

So this looks like one of those changes that has to roll out ~everywhere before anything can take advantage of it.

Ok, I updated the PR "Upgrade Considerations" section to explain this. But it still doesn't seem to be that this change should be considered breaking or NEWSworthy. Reviewers, please let me know if you disagree, and what you suggest that I do. Thanks.

@erights erights force-pushed the markm-tolerate-extra-error-props branch from 30dce0f to a2e66a3 Compare February 12, 2024 17:42
Copy link
Contributor

@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.

this looks plausible to me, but the history goes back to #550 , so I'm inclined to defer to someone with more context. LMK if they're not available in a useful timeframe.

@erights erights force-pushed the markm-tolerate-extra-error-props branch from a2e66a3 to cb02f49 Compare February 12, 2024 20:19
@erights erights force-pushed the markm-tolerate-extra-error-props branch from cb02f49 to 7693b01 Compare February 13, 2024 18:38
@kriskowal
Copy link
Member

This is a relaxation and a new feature. I do think a note in NEWS about the new capability to transmit errors with properties is worth mentioning and will be useful for future investigations.

@kriskowal
Copy link
Member

So this looks like one of those changes that has to roll out ~everywhere before anything can take advantage of it.

This seems accurate to me.

In isolation, this allows a node to receive messages that no node can yet produce. When they can produce such messages, a new node will be able to send messages that will be rejected by an old node. There is some hazard that new programs will pass tests locally and discover they fail in integration with an old node. When we broach that, we need a migration plan.

@erights
Copy link
Contributor Author

erights commented Feb 13, 2024

This is a relaxation and a new feature. I do think a note in NEWS about the new capability to transmit errors with properties is worth mentioning and will be useful for future investigations.

Done

@erights erights merged commit 70cdcd7 into master Feb 13, 2024
14 checks passed
@erights erights deleted the markm-tolerate-extra-error-props branch February 13, 2024 23:21
Copy link
Contributor

@gibson042 gibson042 left a comment

Choose a reason for hiding this comment

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

@gibson042 , as far as I could tell, I did not need to make a corresponding change to encodePassable.js. Is this true, or did I miss something? What about tests of encodePassable?

Confirmed; passable decoders already support decoding errors into whatever comes from a caller-provided decodeError (and don't even assert that the results are errors, although they probably should) and encoders require only that the result has the right prefix.

But a dedicated test in test-encodePassable.js might make sense.

Comment on lines +284 to +289
// Note that this does not decodeRecur rest's property names.
// This would be inconsistent with smallcaps' expected handling,
// but is fine here since it is only used for `annotateError`,
// which is for diagnostic info that is otherwise unobservable.
const extras = objectMap(rest, decodeRecur);
annotateError(error, X`extra marshalled properties ${extras}`);
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for this commentary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants