@revturbine/sdk 0.11.11 → 0.11.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -47,6 +47,43 @@ also require a changelog entry.
47
47
 
48
48
  ---
49
49
 
50
+ ## 0.11.12
51
+
52
+ ### `builtin_dimensions` now reaches the browser SDK from the client-context fetch (BL-0312, plan 279 TASK-5)
53
+
54
+ **What changed.** `0.11.11` (BL-0310/BL-0311) taught the shared evaluator to
55
+ stamp `rt_<dimension>` segment traits from a `builtin_dimensions` object on the
56
+ user context, but nothing yet delivered that object into `web-sdk`'s held
57
+ context. `fetchClientContext` (`GET /api/sdk/client-context`) now maps the
58
+ response's `builtin_dimensions` onto `RevTurbineUserContext.builtin_dimensions`,
59
+ overlaying per leaf the same way it overlays `plan_handle`: a leaf the server
60
+ evaluated on this fetch replaces the held value; a leaf it did not evaluate
61
+ leaves whatever the app (or a prior fetch) had set untouched. A leaf absent on
62
+ both sides stays absent — unknown is trait absence (plan 255), never a
63
+ sentinel.
64
+
65
+ The hash-skip that decides whether a fetch actually changed anything and
66
+ should re-apply (and so re-evaluate segments) now accounts for
67
+ `builtin_dimensions`. This surfaced a real gap: the shared
68
+ `computeUserContextHash` helper re-projects its input to a fixed key set
69
+ (`plan_handle`, `plan`, `usage`, `custom`, `trial`, `instances`) and silently
70
+ drops anything outside it, so simply adding `builtin_dimensions` to the object
71
+ passed to it was a no-op. `builtin_dimensions` is folded into the skip key as
72
+ a literal suffix instead — the same technique already used for the coarse
73
+ `payment_at_risk` signal, which has the identical problem.
74
+
75
+ **Landed in:** 0.11.12 (`web-sdk` only; `server-python`/`server-rust` bumped
76
+ in lockstep with no behavior change — the ports have no client-context fetch
77
+ of their own and resolve built-ins only from an app-supplied
78
+ `builtin_dimensions`, per plan 279's TASK-17 backlog note).
79
+ **Fail-closed in:** 0.11.12. Before this release, a client-context response
80
+ that changed only `builtin_dimensions` was hash-skipped and segments never
81
+ re-evaluated against the new value.
82
+ **Proving test:** `web-sdk/customer-side-client-context.test.ts`, describe
83
+ block `builtin_dimensions (plan 279 AC-4)` — server-overlays-app, an
84
+ unevaluated leaf survives, a changed value re-applies (new context object),
85
+ an unchanged value does not.
86
+
50
87
  ## 0.11.11
51
88
 
52
89
  ### Built-in segment dimensions: reserved `rt_*` segment traits (BL-0310/BL-0311, plan 279 TASK-3/TASK-4)
@@ -20937,6 +20937,25 @@ interface RevTurbineUserContext extends Omit<UserContextInput, 'custom' | 'entit
20937
20937
  * `string | number` when serialized.
20938
20938
  */
20939
20939
  personalization?: SdkTraits;
20940
+ /**
20941
+ * Server-evaluated built-in segment dimensions (plan 279 PD-3), one leaf
20942
+ * per resolved dimension keyed by its dimension key (e.g.
20943
+ * `subscription_state`, `region`) — see the built-in segment resolution
20944
+ * contract in `targeting-studio-ui.md` §4.1 for the full vocabulary.
20945
+ *
20946
+ * `fetchClientContext` delivers this from `GET /api/sdk/client-context`
20947
+ * and merges it the way it merges `plan_handle`: **server values overlay
20948
+ * app-set values**, per leaf. A dimension the server did not evaluate on a
20949
+ * given fetch leaves whatever the app (or a prior fetch) had set for that
20950
+ * leaf untouched; a dimension is simply absent when neither side has ever
20951
+ * set it (unknown is trait absence — plan 255).
20952
+ *
20953
+ * Feeds the reserved `rt_<dimension>` segment traits that built-in
20954
+ * Playbook segments match on — never read or write those trait keys
20955
+ * directly. Set this yourself only to seed `local_only` mode or a
20956
+ * server-side port, which has no client-context fetch of its own.
20957
+ */
20958
+ builtin_dimensions?: UserContextInput['builtin_dimensions'];
20940
20959
  }
20941
20960
  /** Page-level context automatically inferred or manually set. */
20942
20961
  interface RevTurbinePageContext {