studio-scenario-library¶
Cloud Run / CQS queue name: studio-scenario-library
Legacy name: platform-scenario-service (deprecated)
Tech stack: Quarkus (GraalVM native image, Java 21), Gradle, Cloud Spanner, Liquibase
studio-scenario-library is the authoring and storage service for communication packs. A communication pack is a versioned collection of scenarios, where each scenario is a set of CEL (Common Expression Language) rules that map item property conditions to a target design ID. Studio users build packs through the UI, selecting which designs should appear on an ESL when item properties match certain criteria. The service stores packs durably, versions them, and publishes communicationpack.v1 DTOs to DTOflow whenever a pack changes. It does not evaluate any rules itself — evaluation is the exclusive responsibility of studio-link-evaluator, which subscribes to the communication pack DTOs.
DTO Ownership¶
| DTO | Version | Why this service owns it |
|---|---|---|
communicationpack |
v1 | Versioned collection of scenario rules: each scenario contains a CEL expression and a target design ID. When the active pack for a store changes, the service publishes a new DTO version so evaluators react immediately. |
CQS Subscriptions¶
studio-scenario-library has no CQS subscriptions. It is a primary data source driven entirely by user actions via the REST API. The communicationpack.v1 DTO it produces is consumed by studio-link-evaluator.
Processing Logic¶
Communication pack structure: A pack is composed of one or more scenarios ordered by priority. Each scenario contains:
- A CEL expression that references item property fields (e.g. item.category == "dairy" && item.price < 5.0)
- A target design_id that should be applied to the ESL when the expression evaluates to true
- An optional fallback design for ESLs where no scenario matches
Authoring flow: Studio users create and edit packs via the Designer API. Each save creates a new version in Cloud Spanner. When the user activates a pack for a store or a set of ESLs, the service marks it active and publishes the communicationpack.v1 DTO. DTOflow distributes this change to all subscribers.
Native image: The service compiles to a GraalVM native executable for fast cold-start times on Cloud Run. Several gRPC Netty and Vert.x classes require explicit --initialize-at-run-time build args due to PooledByteBufAllocator and native compression library references that cannot be serialised into the native image heap at build time. Runtime Brotli and Zstd dependencies are added to satisfy Netty's compression class loading.
Database: Cloud Spanner with Liquibase. Schema migrations run in the deployment pipeline before each environment promotion, not at application startup.
Related services¶
- studio-link-evaluator — subscribes to
communicationpack.v1; re-evaluates all affected ESLs when a pack changes - studio-design-library — design IDs referenced inside scenario rules must exist and be published here
actions-library— subscribes tocommunicationpack.v1to attach action definitions to active packs