Skip to content

Serialize host-await FFI arguments as compact JSON - #884

Open
Mark Birger (kusha) wants to merge 1 commit into
microsoft:mainfrom
kusha:kusha-compact-host-await-json
Open

Mark Birger (kusha) wants to merge 1 commit into
microsoft:mainfrom
kusha:kusha-compact-host-await-json

Conversation

@kusha

Copy link
Copy Markdown
Contributor

Summary

Use serde_json::to_string in regorus_rvm_get_host_await_argument to avoid pretty-printing overhead at the Rust-to-C# boundary. The change is local to this accessor: public Value::to_json_str(), unrelated FFI accessors, error propagation, and memory-budget/unwind guards remain unchanged.

Add an exported-FFI regression checking exact compact output for a single string (["abc"]), escaped characters including NUL, meaningful whitespace inside strings, and a nested object containing an array, numbers, a boolean, null, and an escaped string. Deserialize the actual output to verify argument-array shape and value preservation.

Validation

  • Confirmed the original regression fails against pretty-printed output before the serialization change.
  • All 34 RVM FFI tests passed using cargo test --manifest-path bindings/ffi/Cargo.toml --no-default-features --features std,rvm,regorus/arc,contention_checks,allocator-memory-limits rvm:: -- --test-threads=1.
  • The expanded regression including the nested-object case passed after the review update.
  • Formatting and diff checks passed; the complete diff was inspected.
  • Default-feature FFI testing is blocked by pre-existing deprecated_in_future errors for core::char::from_digit in Azure Policy code.
  • The pre-commit hook passed the root all-targets build and formatting, then failed on the same Azure Policy errors and unrelated existing Clippy warnings. Git hooks were bypassed for commit and push with explicit user approval.

Use compact serde_json serialization only for the host-await argument accessor and cover exact output for strings and nested objects.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.

2 participants