Upgrade tsify version - #2534
Conversation
Signed-off-by: Katherine Hough <kmhough@amazon.com>
Signed-off-by: Katherine Hough <kmhough@amazon.com>
Coverage ReportHead Commit: Base Commit: Download the full coverage report. Coverage of Added or Modified Lines of Rust CodeRequired coverage: 80.00% Actual coverage: 0.00% Status: FAILED ❌ Details
Coverage of All Lines of Rust CodeRequired coverage: 80.00% Actual coverage: 88.22% Status: PASSED ✅ Details
|
Coverage ReportHead Commit: Base Commit: Download the full coverage report. Coverage of Added or Modified Lines of Rust CodeRequired coverage: 80.00% Actual coverage: 0.00% Status: FAILED ❌ Details
Coverage of All Lines of Rust CodeRequired coverage: 80.00% Actual coverage: 88.22% Status: PASSED ✅ Details
|
Coverage ReportHead Commit: Base Commit: Download the full coverage report. Coverage of Added or Modified Lines of Rust CodeRequired coverage: 80.00% Actual coverage: 0.00% Status: FAILED ❌ Details
Coverage of All Lines of Rust CodeRequired coverage: 80.00% Actual coverage: 88.22% Status: PASSED ✅ Details
|
Signed-off-by: Katherine Hough <kmhough@amazon.com>
Coverage ReportHead Commit: Base Commit: Download the full coverage report. Coverage of Added or Modified Lines of Rust CodeRequired coverage: 80.00% Actual coverage: 0.00% Status: FAILED ❌ Details
Coverage of All Lines of Rust CodeRequired coverage: 80.00% Actual coverage: 88.23% Status: PASSED ✅ Details
|
Description of changes
tsify released a fix for the renaming issue we encountered back in November enabling us to upgrade to the latest version using the new
renamecontainer attribute.However, the
into_wasm_abi/from_wasm_abicontainer attributes which we heavily use are now deprecated because they can cause memory leaks. The recommended alternative is to use the
Tswrapper type. To avoid changing the signature of the existing public Rust functions I made new wasm variants. (e.g.,pub fn is_authorized_wasm(call: Ts<AuthorizationCall>) -> Result<Ts<AuthorizationAnswer>, JsError>).To check backwards compatibility of the Rust API, I used cargo expand to diff the code for cedar-policy before and after this change. When every feature except tsify, wasm, and wasm-bindgen were enabled there is no difference.
When all features are enabled there are two main differences that are not backwards compatible:
OptionFromWasmAbi,FromWasmAbi,OptionIntoWasmAbi,IntoWasmAbiandWasmDescribefor types previously annotated with#[tsify(into_wasm_abi, from_wasm_abi)].Main:
This change:
To check the backwards compatibility of the TypeScript API, I built the WASM bindings using the "build-wasm.sh" script on this change and main. I manually inspected the diffs. The type definitions and signatures appear to be the same. This is consistent with the tsify documentation which says that the generated TypeScript is unchanged when changing to the
Tswrappers.Issue #, if available
Resolves: #1744
Checklist for requesting a review
The change in this PR is (choose one, and delete the other options):
cedar-policy.I confirm that this PR (choose one, and delete the other options):
I confirm that
cedar-spec(choose one, and delete the other options):I confirm that
docs.cedarpolicy.com(choose one, and delete the other options):