Repository navigation
Description
Describe the desired outcome from the user's perspective
As a Zilla operator who configures a value transform (#2325/#2326) against a topic that already has existing records predating it, I want those older records to be brought under the same transform as they're fetched from the broker and stored in the cache, so that the cache converges toward full transform coverage over time without requiring records to be re-produced.
0. Implementation layer
This lives in the shared kafka cache storage implementation, the same layer #1688 writes the produce-path staging mechanism into. kafka-cache-server resolves the model and hands it to the storage layer's fetch-and-store path; running the transform and persisting its result are the storage layer's own behavior.
Acceptance criteria
1. Applying the transform on fetch
When a record is fetched from the broker for storage, run it through the same composed value transform the produce path uses (#2325/#2326), before persisting it. Whether a given fetched record has already had this transform applied is not something this storage layer determines generically — it has no way to inspect an arbitrary transform's output and tell whether the transform already ran. This is left to the transform's own contract: a transform that only ever needs to run once per record either needs a way to signal "already applied, no-op" (an open design question for whichever transform first needs this — not resolved here), or is written to be safely idempotent to reapply.
2. Convergence, not conversion
This mechanism persists its result into the cache, so it genuinely converges: each record this issue touches stays transformed from that point on, and the cache trends toward full coverage as more of the topic's history passes through fetch. That property depends entirely on persistence — the identical apply-on-fetch shape applied by a stateless consumer with nowhere to store the result would repeat the same cost on every fetch, forever, without ever converging, so this mechanism is only sound where the result is actually kept. The cost here is justified precisely because it only has to be paid once per record.
3. The read path must handle the transition window this creates
Convergence takes time, not an instant — the cache holds a mix of already-transformed and not-yet-processed records for as long as this process is in progress. Whatever composed read-side transform runs against a fetched value (#1689) needs to handle both cases correctly for as long as that window is open — this issue is why that window exists at all; without a read-side transform that already accounts for it, a not-yet-converted record would be handled incorrectly by any consumer for as long as it hadn't yet passed through this issue's mechanism.
4. Coverage
Unit and k3po coverage for: a record fetched from the broker has the transform applied and is stored with its result; a record that already carries the transform's result is not corrupted by a second application (however the specific transform in use decides "already applied" per §1); a consumer reading the cache mid-convergence sees correct behavior against both an already-converged record and a not-yet-converged one in the same fetch batch (jointly with #1689's coverage).
Additional context
Depends on #2325/#2326 (the value transform mechanism itself), #1688 (the produce-path staging mechanism this issue's fetch-time application must be able to invoke), and #1689 (the read-side mechanism that must tolerate the transition window this issue creates).
Activity
[-]Implement on-fetch plaintext encryption in kafka-cache-server[/-][+]Implement on-fetch plaintext encryption in kafka cache storage[/+][-]Implement on-fetch plaintext encryption in kafka cache storage[/-][+]Support convergent re-application of produce-path model transforms in kafka cache storage's fetch path[/+]