Skip to content

chore: remove udb as a dependency of envoy-client#4587

Merged
MasterPtato merged 1 commit intomainfrom
04-07-chore_remove_udb_as_a_dependency_of_envoy-client
Apr 8, 2026
Merged

chore: remove udb as a dependency of envoy-client#4587
MasterPtato merged 1 commit intomainfrom
04-07-chore_remove_udb_as_a_dependency_of_envoy-client

Conversation

@NathanFlurry
Copy link
Copy Markdown
Member

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copy link
Copy Markdown
Contributor

@MasterPtato MasterPtato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unnecessary, rivet-util is not a heavy dep.

@MasterPtato MasterPtato force-pushed the 04-07-chore_remove_udb_as_a_dependency_of_envoy-client branch from d52f9f7 to ac386ed Compare April 8, 2026 20:30
@MasterPtato MasterPtato force-pushed the 04-07-chore_revert_actor_v2_hack branch from 8262c65 to d758690 Compare April 8, 2026 20:30
@claude
Copy link
Copy Markdown

claude bot commented Apr 8, 2026

PR Review: chore: remove udb as a dependency of envoy-client

Summary: This PR extracts serde utilities from rivet-util into a new rivet-util-serde crate to reduce the dependency footprint of envoy-client and envoy-protocol.


Motivation Clarity

MasterPtato's review (now dismissed) questioned whether this is necessary. The PR description does not include evidence for why this is needed. A cargo tree snippet showing which heavy transitive deps rivet-util pulls into envoy-client that would not otherwise be there would clarify the value.


build.rs Post-Processing Hack

The most significant concern is the post_process_generated_rust function in engine/sdks/rust/envoy-protocol/build.rs. This function does a string-replacement on generated _generated.rs files to rewrite rivet_util::serde::HashableMap to rivet_util_serde::HashableMap because the upstream code generator (vbare_compiler) hard-codes the old path.

Issues with this approach:

  1. Fragile — if vbare_compiler changes its output format, the replacement silently does nothing and compilation breaks without a clear cause.
  2. Wrong layer — the fix belongs in vbare_compiler::Config::with_hashable_map() as a configurable type path, not as a post-processing step in a consuming crate's build script.
  3. Incremental build risk — Cargo determines whether to re-run build scripts based on declared inputs. Patching generated files in OUT_DIR can have subtle interactions with incremental builds where the patch may or may not re-apply.

Recommendation: Update vbare_compiler to accept a custom path for the hashable map type (e.g. Config::with_hashable_map_path("rivet_util_serde::HashableMap")) rather than patching generated output after the fact.


Minor: Unnecessary Trait Bounds on FakeMap::From<Vec>

(Pre-existing code now prominently in the new crate.)

The From<Vec<(K, V)>> impl has an unnecessary K: Eq + Hash bound. FakeMap is a Vec-backed structure and does not need hashing for this conversion. This unnecessarily restricts use with non-hashable key types that FakeMap would otherwise support.


Code Quality

The refactoring itself is clean:

  • The new crate's Cargo.toml properly uses workspace dependencies.
  • engine/packages/util/src/serde.rs is cleanly reduced to pub use rivet_util_serde::*;, maintaining backward compatibility for existing callers.
  • Import paths in envoy-client and envoy-protocol are updated consistently.

Summary

Area Note
Motivation A cargo tree diff would justify why this extraction is worth the new crate
Blocking build.rs string-replacement workaround should be replaced with a vbare_compiler config option
Minor Unnecessary Eq + Hash bound on FakeMap::From<Vec>

The refactoring structure is sound. The build.rs post-processing hack is the main thing worth addressing before merging.

Copy link
Copy Markdown
Contributor

MasterPtato commented Apr 8, 2026

Merge activity

  • Apr 8, 8:52 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Apr 8, 9:30 PM UTC: Graphite rebased this pull request as part of a merge.
  • Apr 8, 9:31 PM UTC: @MasterPtato merged this pull request with Graphite.

@MasterPtato MasterPtato changed the base branch from 04-07-chore_revert_actor_v2_hack to graphite-base/4587 April 8, 2026 21:26
@MasterPtato MasterPtato changed the base branch from graphite-base/4587 to main April 8, 2026 21:28
@MasterPtato MasterPtato force-pushed the 04-07-chore_remove_udb_as_a_dependency_of_envoy-client branch from ac386ed to 9a3a117 Compare April 8, 2026 21:29
@MasterPtato MasterPtato merged commit 1669483 into main Apr 8, 2026
4 of 8 checks passed
@MasterPtato MasterPtato deleted the 04-07-chore_remove_udb_as_a_dependency_of_envoy-client branch April 8, 2026 21:31
@MasterPtato MasterPtato mentioned this pull request Apr 9, 2026
11 tasks
@NathanFlurry NathanFlurry mentioned this pull request Apr 9, 2026
11 tasks
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