types(marshal): fix #1257 typing of deeplyFulfilled
#2312
Merged
+97
−25
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes: #1257
Refs: Agoric/agoric-sdk#5993 Agoric/agoric-sdk#6816 #1455
Description
Low urgency. This is a minor reduction of tech debt.
Agoric/agoric-sdk#5993 introduced
deeplyFulfilledObject
to work around the deficiencies in the typing ofdeeplyFulfilled
explained at #1257 . This PR fixes those deficiencies. This does not necessary makedeeplyFulfilledObject
unneeded, but it should enable many callers ofdeeplyFulfilledObject
to calldeeplyFulfilled
instead without loss of type fidelity.Note: the code in this first commit probably does not use TS typing well, resulting in many internal
@ts-expect-error
directives in the implementation. This is because I still don't really understand what I'm doing with complex TS types. Reviewers, help appreciated.But IIUC, the external type should now be as good as
deeplyFulfilledObject
. Hopefully, the only typing flaws are encapsulated by this implementation. Yes?Security Considerations
More accurate typing helps security. More precise but inaccurate unsound typing hurts security. Our security practices are already adapted to this dilemma, and this PR should not have much effect.
Scaling Considerations
none
Documentation Considerations
It would be nice if this PR eventually let us drop the need to explain
deeplyFulfilledObject
and why it co-exists withdeeplyFulfilled
Testing Considerations
Even though the code itself is also a bit different, these differences are with high confidence a pure refactor, so the existing dynamic tests should adequately test that.
Compatibility Considerations
Assuming that these changes are a pure refactor with no dynamic behavior changes, there should be no dynamic compat issues.
The tighter typing of
deeplyFulfilled
does raise the possibility that some call sites will no longer pass static type checks. But no such problem appears within the PR's CI, and therefore within the endo repo.Upgrade Considerations
none.
*BREAKING*:
in the commit message with migration instructions for any breaking change.NEWS.md
for user-facing changes.