Promotions, Deals & Coupons · Documentation

Architecture

Promotions, Deals & Coupons's pipeline, its owned data, the events it emits/consumes, and what is out of scope.

Promotions, Deals & Coupons
briefoptionaldraft-copymeteredvalidatestatus·min·cappriceclampedmetered · LLMdeterministic · $0
Live diagram — coupon validation and pricing are deterministic; only the deal-copy draft is metered.
brief$0$draft-copymeteredvalidate$0price$0COST LEVER · copy cached → $0
Live diagram — spend accrues on a fresh deal-copy draft; an identical brief replays from demo_cache at $0.

Promo catalog + enforcement

The app owns demo_eco_promotion and reads the shared booking for its analytics. Coupon evaluation is a pure function — status gate → usage-limit gate → minimum-spend gate → price (percent / flat / package, clamped to the cart) — shared by the guest checkout and the owner console, so there is one enforcement path. The same rule code runs unchanged over real rows in Stage-2.

Events + the data invariant

It emits promo.applied on the in-process event spine when a coupon is redeemed. The data invariant holds: owner deals are canonical (credential_id NULL); a viewer's created deals and usage ticks are credential-scoped, ephemeral, and reset-clearing, and can never mutate a canonical row.

Metered AI + out of scope

The deal-copy draft is the one genuinely metered C7 stage and runs dual-mode: Cloud claude-haiku-4-5 (cost-capped, fail-closed) / OSS qwen3:8b recorded on local M4 hardware ($0). The output is deterministic-cacheable, keyed (slug · stage · prompt_version · input_hash), so an identical brief hits demo_cache and is $0 regardless of mode; on a cap or missing key it fails closed to the recorded $0 output — never a fabricated cloud cost. The discount applies to a sample cart, not a real PSP; coupon validation is deterministic $0. All instrumentation is inspector-only.

Architecture · Promotions, Deals & Coupons · Abhishek Saxena