Skip to content

fix(cache): clean up lib#4457

Open
MasterPtato wants to merge 1 commit into03-18-fix_config_allow_configuring_topo_dcs_via_map_fix_pg_ssl_mode_configfrom
03-18-fix_cache_clean_up_lib
Open

fix(cache): clean up lib#4457
MasterPtato wants to merge 1 commit into03-18-fix_config_allow_configuring_topo_dcs_via_map_fix_pg_ssl_mode_configfrom
03-18-fix_cache_clean_up_lib

Conversation

@MasterPtato
Copy link
Contributor

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

@railway-app
Copy link

railway-app bot commented Mar 19, 2026

🚅 Deployed to the rivet-pr-4457 environment in rivet-frontend

Service Status Web Updated (UTC)
frontend-cloud 😴 Sleeping (View Logs) Web Mar 23, 2026 at 5:48 am
frontend-inspector 😴 Sleeping (View Logs) Web Mar 22, 2026 at 10:18 am
website ❌ Build Failed (View Logs) Web Mar 19, 2026 at 2:08 am
mcp-hub ✅ Success (View Logs) Web Mar 19, 2026 at 2:07 am
ladle ❌ Build Failed (View Logs) Web Mar 19, 2026 at 2:06 am

Copy link
Contributor Author

MasterPtato commented Mar 19, 2026

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 19, 2026

More templates

@rivetkit/virtual-websocket

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/virtual-websocket@4457

@rivetkit/cloudflare-workers

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/cloudflare-workers@4457

@rivetkit/framework-base

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/framework-base@4457

@rivetkit/next-js

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/next-js@4457

@rivetkit/react

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/react@4457

rivetkit

pnpm add https://pkg.pr.new/rivet-dev/rivet/rivetkit@4457

@rivetkit/sql-loader

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/sql-loader@4457

@rivetkit/sqlite-vfs

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/sqlite-vfs@4457

@rivetkit/traces

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/traces@4457

@rivetkit/workflow-engine

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/workflow-engine@4457

@rivetkit/engine-runner

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/engine-runner@4457

@rivetkit/engine-runner-protocol

pnpm add https://pkg.pr.new/rivet-dev/rivet/@rivetkit/engine-runner-protocol@4457

commit: e65f84d

@claude
Copy link

claude bot commented Mar 19, 2026

Cache Lib Cleanup — Review

Overall this is a solid cleanup that simplifies the API, removes dead code, and improves type safety. A few issues need addressing before merge.

Bug: Integration Tests Will Not Compile

The integration test file (engine/packages/cache/tests/integration.rs) was not updated and references symbols that no longer exist after this PR:

  1. Wrong constructor signature (line 10): CacheInner::new_in_memory had its service_name parameter removed, so this should be new_in_memory(1000, None)
  2. Removed method (line 17): .fetch_all(...) — this method was deleted; callers should migrate to .fetch_all_json(...) or .fetch_all_json_with_keys(...)
  3. Removed types (lines 414+): rivet_cache::RateLimitConfig, rivet_cache::RateLimitBucketConfig, and cache.rate_limit(...) — these were all removed with rate_limit.rs but the tests still import and use them

This means the crate will fail to compile after this PR. The rate-limit-related tests should be deleted alongside the implementation, and the other tests should be updated to the new API.

Minor Issues

Driver is missing a Debug impl: The original had #[derive(Debug, Clone)]. This PR removes both derives without adding a manual impl Debug. The Display impl is present, but if anything upstream derives Debug on a type holding Driver non-opaquely, it would fail to compile. Worth verifying nothing depends on Driver: Debug.

Undocumented capacity bump: The default in-memory cache capacity was silently changed from 1000 to 10000 entries. This is likely intentional and correct (1000 was probably too low), but it deserves a comment or PR description note since it has a direct impact on per-instance memory usage.

What's Good

  • Type-safe RawCacheKey now flows through the entire driver interface instead of plain String, eliminating manual RawCacheKey::from(k.clone()) conversions at call sites.
  • Simplified encoder/decoder in fetch_all_convert — removing the intermediate ValueSerde type parameter makes the generic bounds much cleaner.
  • Metrics for cache purge moved to purge_local where they belong, rather than inside the driver.
  • Removing Clone from Driver/InMemoryDriver is correct since CacheInner lives behind Arc; the previous .clone() calls before every driver operation were unnecessary.
  • Removing encode_value/decode_value from Driver is the right call — serialization format is a concern of the call site, not the driver.

@MasterPtato MasterPtato force-pushed the 03-18-fix_cache_clean_up_lib branch from 175706a to 17d21f5 Compare March 19, 2026 20:53
@MasterPtato MasterPtato force-pushed the 03-18-fix_config_allow_configuring_topo_dcs_via_map_fix_pg_ssl_mode_config branch from f07072d to ea5642d Compare March 21, 2026 01:55
@MasterPtato MasterPtato force-pushed the 03-18-fix_cache_clean_up_lib branch from 17d21f5 to de18421 Compare March 21, 2026 01:55
@MasterPtato MasterPtato mentioned this pull request Mar 21, 2026
11 tasks
@MasterPtato MasterPtato force-pushed the 03-18-fix_config_allow_configuring_topo_dcs_via_map_fix_pg_ssl_mode_config branch from ea5642d to f6c3742 Compare March 24, 2026 00:30
@MasterPtato MasterPtato force-pushed the 03-18-fix_cache_clean_up_lib branch from de18421 to e65f84d Compare March 24, 2026 00:30
@MasterPtato MasterPtato mentioned this pull request Mar 24, 2026
11 tasks
@MasterPtato MasterPtato force-pushed the 03-18-fix_cache_clean_up_lib branch from e65f84d to 65200cf Compare March 24, 2026 00:36
@MasterPtato MasterPtato force-pushed the 03-18-fix_config_allow_configuring_topo_dcs_via_map_fix_pg_ssl_mode_config branch from f6c3742 to 10c9ce3 Compare March 24, 2026 00:36
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