Repository navigation
refactor(client): __interop_read awaits one shared read, opens ciphertext synchronously (LAB-12943) - #229
refactor(client): __interop_read awaits one shared read, opens ciphertext synchronously (LAB-12943)#22927Bslash6 wants to merge 2 commits into
Conversation
…text synchronously An encrypting client's CacheKit::__interop_read awaited SecureCache::__interop_read before its own read, which repeated the reject, key resolution and read_bytes. That kept a secure future in the state of the generic #[cachekit] poll function every plain read shares, the coupling interop_read_swr already dropped. Both clients now reject, resolve and await read_bytes once; an encrypting client then calls SecureCache::open synchronously on the bytes. SecureCache::__interop_read is deleted. No AAD, key, key-format or wire change.
|
No actionable comments were generated in the recent review. Summary by CodeRabbit
WalkthroughThe interop read method now performs a shared read before selecting encrypted or plain decoding. The change removes the separate encrypted interop read helper. ChangesInterop cache reads
Estimated code review effort: 2 (Simple) | ~10 minutes Change: Refactor Possibly related PRs
Merge Risk:
|
Code Review Completed! 🔥The code review was successfully completed based on your current configurations. Kody Guide: Usage and ConfigurationInteracting with Kody
Providing Context (Files & MCPs)Add these hints in your PR description (or a comment) to unlock deeper checks:
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
Instruction counts: PASS122 of 122 cases measured. A case fails when its median is slower than the base by its floor or more (SLOWER). The floor is 0.5%, and such a case also fails when the head's runs spread by more than that (NOISIER), except 122 cases within noise
PR head |
…e the interop reads follow Both interop reads now resolve and read before they branch on encrypting(), so 'every value method routes through it first' no longer held. What holds, and what the protocol rule needs, is that every value method branches on it before it encodes or decodes a value.
b4a64d5
Code Review Completed! 🔥The code review was successfully completed based on your current configurations. Kody Guide: Usage and ConfigurationInteracting with Kody
Providing Context (Files & MCPs)Add these hints in your PR description (or a comment) to unlock deeper checks:
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
|
@coderabbitai review |
Action performed
|
CacheKit::__interop_read, the read a#[cachekit]function re-polls while another worker fills a cold key, now awaits oneread_bytesfor plain and encrypting clients and opens an encrypting client's bytes synchronously afterwards withSecureCache::open.SecureCache::__interop_read, which repeated the namespace reject, key resolution and read, is deleted. This is the shape #228 gaveinterop_read_swr.Why
An encrypting client's read used to
return secure.__interop_read(key).awaitbefore its own read, so the secure read's future sat in the state of__interop_read's future. The#[cachekit]poll function that awaits it is generic and instantiated in the calling crate, and plain and secure reads share it. #228 measured what that coupling costs on the SWR read: a change confined to the secure read added 34 Ir/op tomacro_hit/plain.__interop_readcarried the same coupling, plus a second copy of the reject, resolve and read.The order of operations is unchanged for both clients: reject a namespaced interop client, resolve the key, read L1 then the backend, then decode (plain) or decrypt and decode (encrypting). No AAD, key, key-format or wire change.
Instruction counts
make bench-instr BASE=<main e3a0123 build>, callgrind, release build with--features macros: 122 of 122 cases within noise, no SLOWER case.macro_hit/plainmacro_hit/relmacro_hit/encEvery
macro_hitcell moves +3 Ir/op (at most +0.05%, against a 0.50% floor).macro_hitmeasures a hit on the first read,__interop_read_swr, which no code here changes; the poll function it runs in also holds the__interop_readre-poll, so the +3 is that function's layout.Tests
make quick-checkpasses (fmt, clippy-D warnings, the native test suite).decode_bounds_testsstill refuses hostile sealed plaintext onCacheKit::__interop_readfrom the backend, from L1 and from L1 again, and decodes every sealed accept vector on each of those reads.every_sealed_accept_vector_decodes_from_the_backend_and_from_l1onCacheKit::__interop_read. The test reaches the movedopencall.cargo clippy --no-default-features --features cachekitio,l1,macros -D warnings(no encryption) and the wasm32workers,cachekitio,encryptionbuild compile.Docs: none needed. Both functions are hidden macro plumbing or private; only their rustdoc changed.