From 76ab86386ae5e9358822c2f0a58167fc97499165 Mon Sep 17 00:00:00 2001 From: Zeljko Mihaljcic <7150613+zehiko@users.noreply.github.com> Date: Mon, 4 Nov 2024 11:32:45 +0100 Subject: [PATCH] rebase main --- .github/workflows/labels.yml | 39 +++++++++ Cargo.lock | 30 ++----- Cargo.toml | 8 +- crates/build/re_types_builder/src/docs.rs | 2 +- crates/store/re_entity_db/src/store_bundle.rs | 4 +- crates/store/re_ws_comms/src/server.rs | 13 ++- .../src/allocator/gpu_readback_belt.rs | 3 +- .../re_space_view_spatial/src/mesh_cache.rs | 2 +- .../re_space_view_spatial/src/proc_mesh.rs | 4 +- crates/viewer/re_viewer/src/app.rs | 4 +- crates/viewer/re_viewer/src/lib.rs | 2 +- .../viewer/re_viewer_context/src/store_hub.rs | 6 +- .../proto/a_r_capture_metadata.proto | 4 +- examples/rust/objectron/src/objectron.rs | 4 +- rerun_js/web-viewer/build-wasm.mjs | 86 ++++--------------- rerun_js/web-viewer/hashes.json | 1 - .../archetypes/video_frame_reference_ext.py | 6 +- 17 files changed, 97 insertions(+), 121 deletions(-) delete mode 100644 rerun_js/web-viewer/hashes.json diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml index a0e7ac40f10c..d298808073ee 100644 --- a/.github/workflows/labels.yml +++ b/.github/workflows/labels.yml @@ -40,3 +40,42 @@ jobs: mode: minimum count: 1 labels: "πŸ“Š analytics, 🟦 blueprint, πŸͺ³ bug, 🌊 C++ API, CLI, codegen/idl, πŸ§‘β€πŸ’» dev experience, dependencies, πŸ“– documentation, πŸ’¬ discussion, examples, exclude from changelog, πŸͺ΅ Log & send APIs, πŸ“‰ performance, 🐍 Python API, ⛃ re_datastore, πŸ” re_query, πŸ“Ί re_viewer, πŸ”Ί re_renderer, 🚜 refactor, β›΄ release, πŸ¦€ Rust API, πŸ”¨ testing, ui, πŸ•ΈοΈ web" + + wasm-bindgen-check: + name: Check wasm-bindgen version + if: ${{ github.event_name == 'pull_request' }} + runs-on: ubuntu-latest + continue-on-error: true + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: prefix-dev/setup-pixi@v0.8.1 + with: + pixi-version: v0.34.0 + + - name: Get current wasm-bindgen version + id: current-version + run: | + version=$(pixi run taplo get -f crates/viewer/re_viewer/Cargo.toml "target.*.dependencies.wasm-bindgen") + echo "current_version=$version" >> $GITHUB_OUTPUT + + - name: Get previous wasm-bindgen version + id: previous-version + run: | + prev_ref=$(git rev-parse --abbrev-ref HEAD) + git checkout main + + version=$(pixi run taplo get -f crates/viewer/re_viewer/Cargo.toml "target.*.dependencies.wasm-bindgen") + echo "previous_version=$version" >> $GITHUB_OUTPUT + + git checkout $prev_ref + + - name: Require label if versions changed + if: ${{ steps.current-version.outputs.current_version != steps.previous-version.outputs.previous_version }} + uses: mheap/github-action-required-labels@v3 + with: + mode: exactly + count: 1 + labels: "wasm-bindgen version update" diff --git a/Cargo.lock b/Cargo.lock index 217e0afc8448..b73b09d1fbed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -623,7 +623,7 @@ dependencies = [ "futures-io", "futures-lite", "parking", - "polling 3.7.3", + "polling", "rustix", "slab", "tracing", @@ -1110,7 +1110,7 @@ checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec" dependencies = [ "bitflags 2.6.0", "log", - "polling 3.7.3", + "polling", "rustix", "slab", "thiserror", @@ -2384,9 +2384,9 @@ dependencies = [ [[package]] name = "fixed" -version = "1.27.0" +version = "1.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fc715d38bea7b5bf487fcd79bcf8c209f0b58014f3018a7a19c2b855f472048" +checksum = "85c6e0b89bf864acd20590dbdbad56f69aeb898abfc9443008fd7bd48b2cc85a" dependencies = [ "az", "bytemuck", @@ -3304,9 +3304,9 @@ checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" [[package]] name = "infer" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb33622da908807a06f9513c19b3c1ad50fab3e4137d82a78107d502075aa199" +checksum = "bc150e5ce2330295b8616ce0e3f53250e53af31759a9dbedad1621ba29151847" dependencies = [ "cfb", ] @@ -4715,22 +4715,6 @@ dependencies = [ "wasm-bindgen-futures", ] -[[package]] -name = "polling" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" -dependencies = [ - "autocfg", - "bitflags 1.3.2", - "cfg-if", - "concurrent-queue", - "libc", - "log", - "pin-project-lite", - "windows-sys 0.48.0", -] - [[package]] name = "polling" version = "3.7.3" @@ -6552,7 +6536,7 @@ dependencies = [ "document-features", "ewebsock", "parking_lot", - "polling 2.8.0", + "polling", "re_format", "re_log", "re_log_types", diff --git a/Cargo.toml b/Cargo.toml index 51a2323dae49..55e8b6b6b0a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -178,7 +178,7 @@ econtext = "0.2" # Prints error contexts on crashes ehttp = "0.5.0" enumset = "1.0.12" env_logger = { version = "0.10", default-features = false } -fixed = { version = "<1.28", default-features = false } # 1.28+ is MSRV 1.79+ +fixed = { version = "1.28", default-features = false } flatbuffers = "23.0" futures-channel = "0.3" futures-util = { version = "0.3", default-features = false } @@ -192,7 +192,7 @@ image = { version = "0.25", default-features = false } indent = "0.1" indexmap = "2.1" # Version chosen to align with other dependencies indicatif = "0.17.7" # Progress bar -infer = "0.15" # infer MIME type by checking the magic number signaturefer MIME type by checking the magic number signature +infer = "0.16" # infer MIME type by checking the magic number signaturefer MIME type by checking the magic number signature insta = "1.23" itertools = "0.13" js-sys = "0.3" @@ -223,7 +223,7 @@ pathdiff = "0.2" pico-args = "0.5" ply-rs = { version = "0.1", default-features = false } poll-promise = "0.3" -polling = "2.2.0" +polling = "3.7.3" pollster = "0.3" prettyplease = "0.2" proc-macro2 = { version = "1.0", default-features = false } @@ -318,7 +318,7 @@ wgpu = { version = "22.1", default-features = false, features = [ wgpu-core = "22.1" wgpu-types = "22.0" xshell = "0.2" -zip = { version = "0.6", default-features = false } +zip = { version = "0.6", default-features = false } # We're stuck on 0.6 because https://crates.io/crates/protoc-prebuilt is still using 0.6 # --------------------------------------------------------------------------------- diff --git a/crates/build/re_types_builder/src/docs.rs b/crates/build/re_types_builder/src/docs.rs index 6aa6c73696b1..3f9084d09a5a 100644 --- a/crates/build/re_types_builder/src/docs.rs +++ b/crates/build/re_types_builder/src/docs.rs @@ -1,6 +1,6 @@ use crate::{codegen::Target, Objects}; -/// A high-level representation of the contetns of a flatbuffer docstring. +/// A high-level representation of the contents of a flatbuffer docstring. #[derive(Debug, Clone)] pub struct Docs { /// All docmentation lines, including the leading tag, if any. diff --git a/crates/store/re_entity_db/src/store_bundle.rs b/crates/store/re_entity_db/src/store_bundle.rs index 9829ed43b853..45fa833e02ee 100644 --- a/crates/store/re_entity_db/src/store_bundle.rs +++ b/crates/store/re_entity_db/src/store_bundle.rs @@ -78,7 +78,7 @@ impl StoreBundle { /// One is created if it doesn't already exist. pub fn entry(&mut self, id: &StoreId) -> &mut EntityDb { self.entity_dbs.entry(id.clone()).or_insert_with(|| { - re_log::debug!("Creating new store: {id}"); + re_log::trace!("Creating new store: '{id}'"); EntityDb::new(id.clone()) }) } @@ -96,7 +96,7 @@ impl StoreBundle { let mut blueprint_db = EntityDb::new(id.clone()); - re_log::debug!("Creating a new blueprint {id}"); + re_log::trace!("Creating a new blueprint '{id}'"); blueprint_db.set_store_info(re_log_types::SetStoreInfo { row_id: *re_chunk::RowId::new(), diff --git a/crates/store/re_ws_comms/src/server.rs b/crates/store/re_ws_comms/src/server.rs index 97b7bede2bd6..08c737921c3f 100644 --- a/crates/store/re_ws_comms/src/server.rs +++ b/crates/store/re_ws_comms/src/server.rs @@ -183,12 +183,15 @@ impl RerunServer { // on the same poller. let listener_poll_key = 1; - if let Err(err) = poller.add(listener_socket, Event::readable(listener_poll_key)) { + #[allow(unsafe_code)] + // SAFETY: `poller.add` requires a matching call to `poller.delete`, which we have below + if let Err(err) = unsafe { poller.add(listener_socket, Event::readable(listener_poll_key)) } + { re_log::error!("Error when polling listener socket for incoming connections: {err}"); return; } - let mut events = Vec::new(); + let mut events = polling::Events::new(); loop { if let Err(err) = poller.wait(&mut events, None) { re_log::warn!("Error polling WebSocket server listener: {err}"); @@ -199,7 +202,7 @@ impl RerunServer { break; } - for event in events.drain(..) { + for event in events.iter() { if event.key == listener_poll_key { Self::accept_connection( listener_socket, @@ -210,7 +213,11 @@ impl RerunServer { ); } } + events.clear(); } + + // This MUST be called before dropping `poller`! + poller.delete(listener_socket).ok(); } fn accept_connection( diff --git a/crates/viewer/re_renderer/src/allocator/gpu_readback_belt.rs b/crates/viewer/re_renderer/src/allocator/gpu_readback_belt.rs index a3d9f2d6810c..ed0f5855f805 100644 --- a/crates/viewer/re_renderer/src/allocator/gpu_readback_belt.rs +++ b/crates/viewer/re_renderer/src/allocator/gpu_readback_belt.rs @@ -274,8 +274,7 @@ impl GpuReadbackBelt { } else { // Allocation might be bigger than a chunk! let buffer_size = self.chunk_size.max(size_in_bytes); - // Happens relatively rarely, this is a noteworthy event! - re_log::debug!( + re_log::trace!( "Allocating new GpuReadbackBelt chunk of size {:.1} MiB", buffer_size as f32 / (1024.0 * 1024.0) ); diff --git a/crates/viewer/re_space_view_spatial/src/mesh_cache.rs b/crates/viewer/re_space_view_spatial/src/mesh_cache.rs index 0baafbc4bb4d..3ce84008c586 100644 --- a/crates/viewer/re_space_view_spatial/src/mesh_cache.rs +++ b/crates/viewer/re_space_view_spatial/src/mesh_cache.rs @@ -63,7 +63,7 @@ impl MeshCache { .or_default() .entry(key) .or_insert_with(|| { - re_log::debug!("Loading CPU mesh {name:?}…"); + re_log::trace!("Loading CPU mesh {name:?}…"); let result = LoadedMesh::load(name.to_owned(), mesh, render_ctx); diff --git a/crates/viewer/re_space_view_spatial/src/proc_mesh.rs b/crates/viewer/re_space_view_spatial/src/proc_mesh.rs index f402a79254eb..b3ec23731fbb 100644 --- a/crates/viewer/re_space_view_spatial/src/proc_mesh.rs +++ b/crates/viewer/re_space_view_spatial/src/proc_mesh.rs @@ -164,7 +164,7 @@ impl WireframeCache { .or_insert_with(|| { re_tracing::profile_scope!("proc_mesh::WireframeCache(miss)", format!("{key:?}")); - re_log::debug!("Generating wireframe mesh {key:?}…"); + re_log::trace!("Generating wireframe mesh {key:?}…"); match generate_wireframe(&key, render_ctx) { Ok(mesh) => Some(Arc::new(mesh)), @@ -311,7 +311,7 @@ impl SolidCache { .or_insert_with(|| { re_tracing::profile_scope!("proc_mesh::SolidCache(miss)", format!("{key:?}")); - re_log::debug!("Generating solid mesh {key:?}…"); + re_log::trace!("Generating solid mesh {key:?}…"); match generate_solid(&key, render_ctx) { Ok(mesh) => Some(mesh), diff --git a/crates/viewer/re_viewer/src/app.rs b/crates/viewer/re_viewer/src/app.rs index 28647a9c3926..64976999388c 100644 --- a/crates/viewer/re_viewer/src/app.rs +++ b/crates/viewer/re_viewer/src/app.rs @@ -1178,7 +1178,7 @@ impl App { // updates the app-id when changing the recording. match store_id.kind { StoreKind::Recording => { - re_log::debug!("Opening a new recording: {store_id}"); + re_log::trace!("Opening a new recording: '{store_id}'"); store_hub.set_active_recording_id(store_id.clone()); // Also select the new recording: @@ -1214,7 +1214,7 @@ impl App { } StoreKind::Blueprint => { if let Some(info) = entity_db.store_info() { - re_log::debug!( + re_log::trace!( "Activating blueprint that was loaded from {channel_source}" ); let app_id = info.application_id.clone(); diff --git a/crates/viewer/re_viewer/src/lib.rs b/crates/viewer/re_viewer/src/lib.rs index 1abf935d79f9..94d254b89465 100644 --- a/crates/viewer/re_viewer/src/lib.rs +++ b/crates/viewer/re_viewer/src/lib.rs @@ -252,7 +252,7 @@ pub fn wake_up_ui_thread_on_each_msg( break; } } - re_log::debug!("Shutting down ui_waker thread"); + re_log::trace!("Shutting down ui_waker thread"); }) .unwrap(); new_rx diff --git a/crates/viewer/re_viewer_context/src/store_hub.rs b/crates/viewer/re_viewer_context/src/store_hub.rs index b5e3d08745cb..192990f46ae2 100644 --- a/crates/viewer/re_viewer_context/src/store_hub.rs +++ b/crates/viewer/re_viewer_context/src/store_hub.rs @@ -487,7 +487,7 @@ impl StoreHub { } } - re_log::debug!("Switching default blueprint for {app_id} to {blueprint_id}"); + re_log::trace!("Switching default blueprint for '{app_id}' to '{blueprint_id}'"); self.default_blueprint_by_app_id .insert(app_id.clone(), blueprint_id.clone()); @@ -532,8 +532,8 @@ impl StoreHub { ) -> anyhow::Result<()> { let new_id = StoreId::random(StoreKind::Blueprint); - re_log::debug!( - "Cloning {blueprint_id} as {new_id} the active blueprint for {app_id} to {blueprint_id}" + re_log::trace!( + "Cloning '{blueprint_id}' as '{new_id}' the active blueprint for '{app_id}' to '{blueprint_id}'" ); let blueprint = self diff --git a/examples/python/objectron/objectron/proto/a_r_capture_metadata.proto b/examples/python/objectron/objectron/proto/a_r_capture_metadata.proto index 42e8d69ebef9..f3f02c55c2f2 100644 --- a/examples/python/objectron/objectron/proto/a_r_capture_metadata.proto +++ b/examples/python/objectron/objectron/proto/a_r_capture_metadata.proto @@ -336,7 +336,7 @@ message ARPlaneAnchor { // The classification status for the plane. enum PlaneClassificationStatus { - // The classfication process for the plane anchor has completed but the + // The classification process for the plane anchor has completed but the // result is inconclusive. UNKNOWN = 0; // No classication information can be provided (set on error or if the @@ -344,7 +344,7 @@ message ARPlaneAnchor { UNAVAILABLE = 1; // The classification process has not completed. UNDETERMINED = 2; - // The classfication process for the plane anchor has completed. + // The classification process for the plane anchor has completed. KNOWN = 3; } diff --git a/examples/rust/objectron/src/objectron.rs b/examples/rust/objectron/src/objectron.rs index 6bd4f2f9f858..a51843d96af5 100644 --- a/examples/rust/objectron/src/objectron.rs +++ b/examples/rust/objectron/src/objectron.rs @@ -688,7 +688,7 @@ pub mod ar_plane_anchor { )] #[repr(i32)] pub enum PlaneClassificationStatus { - /// The classfication process for the plane anchor has completed but the + /// The classification process for the plane anchor has completed but the /// result is inconclusive. Unknown = 0, /// No classication information can be provided (set on error or if the @@ -696,7 +696,7 @@ pub mod ar_plane_anchor { Unavailable = 1, /// The classification process has not completed. Undetermined = 2, - /// The classfication process for the plane anchor has completed. + /// The classification process for the plane anchor has completed. Known = 3, } impl PlaneClassificationStatus { diff --git a/rerun_js/web-viewer/build-wasm.mjs b/rerun_js/web-viewer/build-wasm.mjs index 81ca9d67c5ea..70522e6f59b0 100644 --- a/rerun_js/web-viewer/build-wasm.mjs +++ b/rerun_js/web-viewer/build-wasm.mjs @@ -31,9 +31,8 @@ function buildWebViewer(mode) { } } -async function re_viewer_js(mode) { +function re_viewer_js() { let code = fs.readFileSync(path.join(__dirname, "re_viewer.js"), "utf-8"); - await checkHash(mode, "re_viewer.js", code); // this transforms the module, wrapping it in a default-exported function. // calling the function produces a new "instance" of the module, because @@ -89,9 +88,8 @@ return Object.assign(__wbg_init, { initSync, deinit }, __exports); fs.writeFileSync(path.join(__dirname, "re_viewer.js"), code); } -async function re_viewer_d_ts(mode) { +function re_viewer_d_ts() { let code = fs.readFileSync(path.join(__dirname, "re_viewer.d.ts"), "utf-8"); - await checkHash(mode, "re_viewer.d.ts", code); // this transformation just re-exports WebHandle and adds a default export inside the `.d.ts` file @@ -104,77 +102,27 @@ export default function(): wasm_bindgen; fs.writeFileSync(path.join(__dirname, "re_viewer.d.ts"), code); } -async function hash(data) { - const buffer = await crypto.subtle.digest("sha-256", data); - return Array.from(new Uint8Array(buffer)) - .map((b) => b.toString(16).padStart(2, "0")) - .join(""); -} - -async function checkHash(mode, id, data) { - const storedHash = hashes?.[mode]?.[id]; - const computedHash = await hash(new TextEncoder().encode(data)); - - if (updateHashes) { - hashes[mode] ??= {}; - hashes[mode][id] = computedHash; - return; - } +function main() { + const args = util.parseArgs({ + options: { + mode: { + type: "string", + }, + }, + }); + const mode = args.values.mode; - if (storedHash !== computedHash) { - console.error(` -============================================================== -Output of "${id}" changed. -Update the \`build-wasm.mjs\` script to handle the new output, -then run \`pixi run node build-wasm.mjs --update-hashes\`. -============================================================== -`); - process.exit(1); + if (!mode) { + throw new Error("Missing required argument: mode"); } -} -async function run(mode) { buildWebViewer(mode); - await re_viewer_js(mode); - await re_viewer_d_ts(mode); -} - -const args = util.parseArgs({ - options: { - mode: { - type: "string", - }, - "update-hashes": { - type: "boolean", - }, - }, -}); - -let updateHashes = !!args.values["update-hashes"]; -let hashes; -try { - hashes = JSON.parse( - fs.readFileSync(path.join(__dirname, "hashes.json"), "utf-8"), - ); -} catch (e) { - hashes = {}; + re_viewer_js(); + re_viewer_d_ts(); } try { - if (updateHashes) { - await run("release"); - await run("debug"); - fs.writeFileSync( - path.join(__dirname, "hashes.json"), - JSON.stringify(hashes), - ); - } else { - if (!args.values.mode) { - throw new Error("Missing required argument: mode"); - } - - await run(args.values.mode); - } + main(); } catch (e) { - console.error(e.message); + console.error(e); } diff --git a/rerun_js/web-viewer/hashes.json b/rerun_js/web-viewer/hashes.json deleted file mode 100644 index 6dd33989c499..000000000000 --- a/rerun_js/web-viewer/hashes.json +++ /dev/null @@ -1 +0,0 @@ -{"release":{"re_viewer.js":"9548c50002f6c6844e50ceb154641a4ca547413a54eb3214b18909848776492f","re_viewer.d.ts":"d533906cbd59ac7b2f4a962a24daad55c5df854343414b8b6db08e2d956fdee3"},"debug":{"re_viewer.js":"74ec126e7deeb831c72c7a2ccffb98c3c63fb7268f27feffdfb2da286db65816","re_viewer.d.ts":"c642a7f1990d414d9953f0b215d8114418502b3b9f0240ca81b039766d5236b0"}} \ No newline at end of file diff --git a/rerun_py/rerun_sdk/rerun/archetypes/video_frame_reference_ext.py b/rerun_py/rerun_sdk/rerun/archetypes/video_frame_reference_ext.py index 95d0f56fd485..864e7c1afc78 100644 --- a/rerun_py/rerun_sdk/rerun/archetypes/video_frame_reference_ext.py +++ b/rerun_py/rerun_sdk/rerun/archetypes/video_frame_reference_ext.py @@ -28,15 +28,15 @@ def __init__( Note that this uses the closest video frame instead of the latest at this timestamp in order to be more forgiving of rounding errors for inprecise timestamp types. - Mutally exclusive with `seconds` and `nanoseconds`. + Mutually exclusive with `seconds` and `nanoseconds`. seconds: Sets the timestamp to the given number of seconds. - Mutally exclusive with `timestamp` and `nanoseconds`. + Mutually exclusive with `timestamp` and `nanoseconds`. nanoseconds: Sets the timestamp to the given number of nanoseconds. - Mutally exclusive with `timestamp` and `seconds`. + Mutually exclusive with `timestamp` and `seconds`. video_reference: Optional reference to an entity with a [`archetypes.AssetVideo`][rerun.archetypes.AssetVideo].