Repository navigation
Description
Describe the desired outcome from the user's perspective
As a Zilla operator, I want a model transform to see the authorization in effect for the message it is processing, so that per-field access decisions reflect the consumer's grant at that moment rather than a snapshot taken when the stream opened.
Acceptance criteria
-
Add
long authorizationtoModelPipeline.transform(...), positioned besidetraceIdwhere per-operation authorization already sits throughout the engine (doBegin,doData, …):ModelPipelineResult transform(long traceId, long bindingId, long authorization, int flags, DirectBufferEx src, int srcIndex, int srcLimit, MutableDirectBufferEx dst, int dstIndex, int dstLimit);
-
ModelControllergains a matching read accessor,long authorization(). Without it, the value reachingModelPipeline.transform(...)has nowhere to go once the pipeline drives itsModelTransformchain — neitherModelControllernorModelTransform.transform(...)carries any authorization channel today, so a per-field stage composed into a model's transform chain by an installed extension has no way to read it:public interface ModelController { long authorization(); void reject(String diagnostic); }
The concrete pipeline implementation stores whatever
authorizationits owntransform(...)call receives and exposes it through the sameModelControllerinstance it already passes to every stage in the chain — mirroring the existingreject(String diagnostic), just read instead of write, and following the same "a signal reaches every stage unless a mediating stage overrides it" principleModelController's own Javadoc already documents for that method. A mediatingModelTransform(one that supplies its ownModelControllerto its downstream) may overrideauthorization(), e.g. to scope it further for a nested composition; the default path is a straight pass-through. -
Update every
ModelPipelineandModelControllerimplementation and every call site —KafkaCacheModeland equivalents across bindings -
The value is per message, not per stream. A pipeline may read it into a field before pumping, since pipelines are per-stream and worker-confined, so no allocation is required on the hot path
-
Javadoc stays protocol-neutral per
runtime/engine/AGENTS.md— describe the contract, not encryption or Kafka -
Unit coverage: authorization threading through a test model; a test asserting a changed value between two
transform(...)calls on the same pipeline is observed by the transform; aModelTransformstage readingcontrol.authorization()observing the same value the pipeline received on that call
Additional context
Split out of #1680, which had grown to cover four separable engine changes.
Why a parameter rather than a supplier. Capturing a LongSupplier at supplyDecoder time looks narrower — no signature change, existing callers untouched — but it is a side-channel: the grant arrives out-of-band from the bytes it applies to, and a binding that fails to refresh it silently authorizes against an expired grant. Guards expire and reauthorize mid-stream, and Kafka consume streams are long-lived, so that failure mode is reachable in normal operation. As a parameter, every call site that has not been considered is a compile error rather than a silent authorization bug.
This is the widest change in the epic — it touches Apache-licensed engine, every model implementation, and every binding that uses a model. Mechanical but broad, which is why it is its own issue.
Consumers: #1689 (consume-path per-consumer field authorization) and the equivalent proxy-side produce path — both read it via ModelController.authorization() from within a ModelTransform stage, not from ModelPipeline.transform(...) directly, since per-field access-control logic lives inside the transform chain, not the pipeline entry point.
Activity