Rust codegen: MarshallerRef::get rejects omitted optional arguments from JS instead of returning undefined
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 66/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- cpp, javascript, rust, typescript
Hướng nghiên cứu
Start in valdi_core/src/valdi_core/rust/marshaller.rs at MarshallerRef::get, then compare its out-of-range behavior with valdi_rust_marshaller_get in valdi_core/src/valdi_core/cpp/Marshalling/RustValdi.cpp. Check how generated bindings deserialize optional and required parameters. Done when omitted trailing optional arguments become None and required arguments still report a type mismatch.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Found while reviewing https://github.com/Snapchat/Valdi/pull/211 (native Rust code generation). Not blocking that PR.
MarshallerRef::get rejects omitted optional arguments from JS instead of returning undefined
File: valdi_core/src/valdi_core/rust/marshaller.rs
When TypeScript or JavaScript calls a Rust module method, proxy method, or callback and omits a trailing optional argument (for example calling echoOptionalPoint() instead of echoOptionalPoint(undefined)), the call fails with a missing Valdi argument at index error instead of treating the omitted argument as None. This starts in MarshallerRef::get, which rejects any index at or above self.len.
Users calling any generated Rust API with an optional parameter receive an error whenever trailing optional arguments are omitted rather than explicitly passed as undefined.
On the C++ side, ValueMarshallerFunctionTrampoline::forwardCall only forwards the arguments JavaScript actually passed (auto resolvedParametersSize = std::min(_parametersSize, parametersSize);), so argument_count in ValdiCall is smaller than the declared parameter count even though generated Rust bindings unconditionally request every parameter with arguments.get(index)?. While valdi_rust_marshaller_get in valdi_core/src/valdi_core/cpp/Marshalling/RustValdi.cpp already returns &Valdi::Value::undefinedRef() for out-of-range indices (matching ValueFunctionCallContext::getParameter), MarshallerRef::get returns an error before reaching it.
Return a ValueRef to Valdi's undefined singleton when index >= self.len (for instance via a valdi_rust_value_undefined FFI helper) so Option<T> deserializes as None and non-optional parameters report a type mismatch.
- Ngôn ngữ chính
- C++
- Star
- 16.4k
- Fork
- 539
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Snapchat/Valdi
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Rust codegen: RustMethodResolver fails to unwrap .nullable on optional interface/module methodsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Snapchat/Valdi
Issue tương tự
-
RTL-SDR: re-enumerating while streaming removes the in-use entry from the device selection dialogCó thể đã có người làm @dpc00 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
throneproj/Throne#2227 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
deepseek-ai/DeepGEMM-Ascend#49 ·
Maintainer thường phản hồi trong vòng 1 ngày