Skip to content

feat: expose inspector object wrapping - #2041

Open
satouriko wants to merge 2 commits into
denoland:mainfrom
satouriko:feat/inspector-wrap-object
Open

feat: expose inspector object wrapping#2041
satouriko wants to merge 2 commits into
denoland:mainfrom
satouriko:feat/inspector-wrap-object

Conversation

@satouriko

Copy link
Copy Markdown

Part of #2033.

Summary

Expose V8 Inspector's V8InspectorSession::wrapObject API and the generated-header build plumbing it requires.

  • add the generated Inspector protocol include directory to GN and bindgen
  • expose an opaque, owned RemoteObject without leaking generated protocol classes into the public Rust API
  • serialize remote objects to CRDTP/CBOR through AppendSerialized
  • add a focused Inspector test proving wrapped object IDs interoperate with Runtime.getProperties

This intentionally contains only the build plumbing and wrapObject; releaseObjectGroup is handled separately in #2040, and unwrapObject remains follow-up work as requested in #2033.

Testing

  • cargo fmt --check
  • clang-format-19 --verbose --Werror --dry-run src/*.cc src/*.hpp src/*.h
  • V8_FROM_SOURCE=1 LIBCLANG_PATH=/usr/lib/llvm-19/lib cargo clippy --all-targets --locked -- -D clippy::all
  • V8_FROM_SOURCE=1 LIBCLANG_PATH=/usr/lib/llvm-19/lib cargo nextest run --locked (287 passed)

V8InspectorSession can wrap embedder-provided values as Inspector remote
objects, but rusty_v8 did not expose wrapObject or make its generated protocol
type available to the bindings.

Build plumbing:
- add the generated Inspector protocol include directory to GN and bindgen
- keep the generated RemoteObject type opaque in Rust bindings

Rust and C++ bindings:
- add wrap_object with scoped Context and Value handles
- own and destroy RemoteObject instances through the existing C++ ownership pattern
- serialize remote objects to CRDTP/CBOR with AppendSerialized
- reuse the existing C++ byte-vector bridge for owned Rust bytes

Tests:
- verify wrapped object IDs interoperate with Runtime.getProperties

Verification:
- cargo fmt --check
- clang-format-19 --verbose --Werror --dry-run src/*.cc src/*.hpp src/*.h
- V8_FROM_SOURCE=1 LIBCLANG_PATH="$PWD/third_party/rust-toolchain/lib" cargo clippy --all-targets --locked -- -D clippy::all
- V8_FROM_SOURCE=1 LIBCLANG_PATH="$PWD/third_party/rust-toolchain/lib" cargo nextest run --locked (289 passed)
@satouriko
satouriko force-pushed the feat/inspector-wrap-object branch from 0e25a49 to 2b4d839 Compare August 1, 2026 14:45
Actions cache fallbacks could restore Cargo artifacts produced by another
build.rs. Cargo could then reuse a stale Clippy build-script fingerprint even
after the exact cache key missed.

Cache keys:
- partition fallback caches by the build.rs content hash
- keep Cargo.lock and submodule status in exact keys for selective rebuilds
- apply the same policy to matrix, ASAN, and Windows ARM caches

Verification:
- cargo fmt --check
- YAML parse and cache-key assertions (4/4)
- V8_FROM_SOURCE=1 LIBCLANG_PATH=third_party/rust-toolchain/lib cargo nextest run --locked (289 passed)
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.

1 participant