@revturbine/sdk 0.10.2 → 0.10.4

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,83 @@ also require a changelog entry.
47
47
 
48
48
  ---
49
49
 
50
+ ## 0.10.4
51
+
52
+ ### Every payload is a selection candidate, not just the first (BL-0122)
53
+
54
+ **What changed.** A placement's payloads are now *all* candidates on both
55
+ selection paths, in all three ports. Previously each port considered exactly one
56
+ payload per placement — TypeScript took `payloads[0]`, Python and Rust the first
57
+ payload with `status == "active"` — so payloads 2+ were never candidates and
58
+ their `target.segment_chips` could not be evaluated at all.
59
+
60
+ | | Before | After |
61
+ |---|---|---|
62
+ | Candidacy | one payload per placement | every payload (Python/Rust: every `active` payload) |
63
+ | `target.segment_chips` on payloads 2+ | never evaluated | evaluated per payload |
64
+ | Drag precedence | a pre-filter — it chose the only candidate | a tiebreaker among the payloads the user **matches** |
65
+ | Direct lookup by name/id | mapped a name to one payload | maps a name to every payload, gated individually, first eligible wins |
66
+
67
+ The contract this restores is
68
+ [`placement-prioritization.md`](https://github.com/revt-eng/revturbine-devkit/blob/main/docs/specs/scaffold/placement-prioritization.md)
69
+ §1 stage 3 — "Targeting — the user's plan and segment match **a payload**" — with
70
+ §4 and Appendix D scoping drag precedence to payloads that are equally eligible.
71
+
72
+ **Why it mattered.** A placement holding an admin payload and a member payload
73
+ gave every member either the admin copy (when payload 1 was unchipped) or
74
+ nothing at all (when payload 1 was chipped to admins). An integration hit the
75
+ second shape on 0.7.13 and concluded config-driven segmentation was inert. Plan
76
+ 233 TASK-7 had already made the chip predicate real — but the predicate was only
77
+ ever asked about one payload.
78
+
79
+ **Landed in.** 0.10.4 (all three ports, plus `@revt-eng/core` 0.1.326).
80
+
81
+ **Fail-closed in.** 0.10.4 — the same release. There is no tolerance window:
82
+ a user who matches no payload now receives `visible: false` with
83
+ `segment_target_mismatch` rather than payload 1's content.
84
+
85
+ **Proving test.** `tests/parity/fixtures/segment_chip_payload_selection.json`
86
+ (cross-language), plus `local-resolver-payload-selection.test.ts`,
87
+ `server-python/tests/placements/test_payload_selection.py` and
88
+ `server-rust/tests/payload_selection.rs` — each exercising **both** the slot and
89
+ the direct-lookup path, because gating one and not the other is exactly the back
90
+ door plans 138 and 233 each had to close.
91
+
92
+ **Who is affected.** Any Playbook authoring more than one payload on a
93
+ placement where payload 1 is not the payload a given user matches. Those users
94
+ now see the payload their chips select — which is the fix, and is a live
95
+ behaviour change for such configs. Single-payload placements are unaffected.
96
+
97
+ ## 0.10.3
98
+
99
+ ### The Rust port gains the decision surfaces Python already shipped (BL-0145)
100
+
101
+ **What changed.** `RevTurbineCustomerSdk` on the Rust port (`revturbine`,
102
+ crates.io) now exposes the same decision surfaces the Python port exposes.
103
+ Nothing on the TypeScript or Python side changes; this is a Rust-only,
104
+ purely additive release.
105
+
106
+ | Added | Shape |
107
+ |---|---|
108
+ | `RevTurbineCustomerSdk::can(handle, context)` | The advertised alias of `check_entitlement`, matching the scaffold SDK function surface (canonical `checkEntitlement`, alias `can`). |
109
+ | `RevTurbineCustomerSdk::get_eligible_plans()` | `Vec<EligiblePlan>` — public, segment-eligible plan variations. |
110
+ | `RevTurbineCustomerSdk::get_eligible_addons()` | `Vec<EligibleAddon>` — the add-on twin. |
111
+ | `RevTurbineCustomerSdk::evaluate_trial_status(instances, now_iso, base_plan_handle, usage_balances)` | `TrialEvaluation`, reading `free_trial_rules` / `reverse_trial_rules` from the constructed Playbook. |
112
+ | `revturbine::format_currency_minor_units(amount, currency, locale)` | Free function, because Python exposes it as a module function. |
113
+ | `revturbine::plans` | New module carrying the catalog eligibility port and the formatter. |
114
+ | `UserContext::segment_ids` | Pre-resolved segment ids the catalog methods match against. |
115
+
116
+ `UserContext` gains a field but derives `Default`, so existing construction
117
+ with `..Default::default()` keeps compiling.
118
+
119
+ **Why it was invisible.** The cross-language parity gate was green on the
120
+ catalog and currency scenarios only because the Rust parity runner
121
+ *reimplemented* `eligible_catalog` and `format_currency_minor_units` inline
122
+ rather than calling the crate — so the comparison never touched shipped code,
123
+ and the crate could lack the capability entirely without a single fixture
124
+ going red. The runner now calls `revturbine::plans`, and the inline copies are
125
+ deleted; all 102 comparisons stay byte-identical.
126
+
50
127
  ## 0.10.2
51
128
 
52
129
  ### Local mode resolves placements by slot id (BL-0119)