@openlup/platform 0.24.0 → 0.26.0

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.
Files changed (61) hide show
  1. package/CHANGELOG.md +127 -432
  2. package/README.md +46 -11
  3. package/dist/communications/contracts/subscriptionPaymentExpired.d.ts +3 -2
  4. package/dist/communications/contracts/subscriptionPaymentExpired.js +1 -1
  5. package/dist/communications/contracts/subscriptionPaymentFailed.d.ts +4 -3
  6. package/dist/communications/contracts/subscriptionPaymentFailed.js +4 -5
  7. package/dist/composition/index.d.ts +1 -0
  8. package/dist/composition/index.js +1 -0
  9. package/dist/composition/subscriptionContribution.d.ts +18 -0
  10. package/dist/composition/subscriptionContribution.js +19 -0
  11. package/dist/inventory/index.d.ts +2 -0
  12. package/dist/inventory/index.js +1 -0
  13. package/dist/inventory/postgresStockAvailability.d.ts +24 -0
  14. package/dist/inventory/postgresStockAvailability.js +48 -0
  15. package/dist/subscriptions/commandExamples.d.ts +6 -0
  16. package/dist/subscriptions/commandExamples.js +20 -0
  17. package/dist/subscriptions/contracts/commands.d.ts +8 -1
  18. package/dist/subscriptions/contracts/index.d.ts +2 -2
  19. package/dist/subscriptions/contracts/renewal.d.ts +2 -0
  20. package/dist/subscriptions/contracts/stockWait.d.ts +12 -1
  21. package/dist/subscriptions/index.d.ts +22 -4
  22. package/dist/subscriptions/index.js +22 -3
  23. package/dist/subscriptions/lifecycleMessages.d.ts +9 -0
  24. package/dist/subscriptions/lifecycleMessages.js +38 -0
  25. package/dist/subscriptions/paymentOutcomes.js +1 -1
  26. package/dist/subscriptions/postgresCommandStore.d.ts +44 -0
  27. package/dist/subscriptions/postgresCommandStore.js +172 -0
  28. package/dist/subscriptions/postgresRetryStore.d.ts +6 -0
  29. package/dist/subscriptions/postgresRetryStore.js +11 -0
  30. package/dist/subscriptions/postgresStockWaitStore.d.ts +62 -0
  31. package/dist/subscriptions/postgresStockWaitStore.js +174 -0
  32. package/dist/subscriptions/renewalCycleFailureMechanism.js +3 -2
  33. package/dist/subscriptions/services.d.ts +31 -0
  34. package/dist/subscriptions/services.js +15 -0
  35. package/package.json +2 -2
  36. package/release-gates.json +2 -2
  37. package/sql/20261024170000_subscription_command_lifecycle.sql +404 -0
  38. package/sql/20261024180000_subscription_stock_wait.sql +330 -0
  39. package/sql/20261024183000_inventory_available_to_promise.sql +70 -0
  40. package/sql/20261024184000_subscription_renewal_reserve_uses_seam.sql +147 -0
  41. package/sql/20261024184500_subscription_retry_late_positive_stock.sql +59 -0
  42. package/sql/20261024184600_subscription_retry_candidate_payment_filter.sql +22 -0
  43. package/src/communications/contracts/subscriptionPaymentExpired.ts +4 -3
  44. package/src/communications/contracts/subscriptionPaymentFailed.ts +8 -8
  45. package/src/composition/index.ts +1 -0
  46. package/src/composition/subscriptionContribution.ts +25 -0
  47. package/src/inventory/index.ts +2 -0
  48. package/src/inventory/postgresStockAvailability.ts +54 -0
  49. package/src/subscriptions/commandExamples.ts +19 -0
  50. package/src/subscriptions/contracts/commands.ts +35 -2
  51. package/src/subscriptions/contracts/index.ts +2 -2
  52. package/src/subscriptions/contracts/renewal.ts +2 -1
  53. package/src/subscriptions/contracts/stockWait.ts +14 -2
  54. package/src/subscriptions/index.ts +30 -3
  55. package/src/subscriptions/lifecycleMessages.ts +37 -0
  56. package/src/subscriptions/paymentOutcomes.ts +1 -1
  57. package/src/subscriptions/postgresCommandStore.ts +183 -0
  58. package/src/subscriptions/postgresRetryStore.ts +11 -0
  59. package/src/subscriptions/postgresStockWaitStore.ts +170 -0
  60. package/src/subscriptions/renewalCycleFailureMechanism.ts +3 -1
  61. package/src/subscriptions/services.ts +21 -0
package/CHANGELOG.md CHANGED
@@ -10,6 +10,133 @@ in the source repository.
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.26.0]
14
+
15
+ - Publishable on the npm `latest` dist-tag as `0.26.0`, from tag
16
+ `openlup-platform-v0.26.0`.
17
+
18
+ Managed dunning attempt replay.
19
+
20
+ Carry the exact applied failure attempt through renewal propagation. Managed
21
+ same/stale observations replay the canonical result; newer attributed failures
22
+ advance and revoke prior recovery authority, including used tokens.
23
+
24
+ Migration: `CycleChargeFailurePropagationPort.openDunningCase` now requires nullable `failedPaymentAttemptId`; update host implementations and callers to pass the applied transition's identity.
25
+ Migration: `applyFailedResult` may return `paymentAttemptId?: string | null`; return the durable applied attempt so propagation can forward it, including on replay.
26
+ Migration: managed hosts must pass exact applied-transition attribution to the new overloads. Fresh missing attribution refuses with SQLSTATE `55000`; do not substitute the current or prepared attempt. Already-applied donor schema/backfill requires the explicit host mapping in DATA_AND_MIGRATIONS.
27
+
28
+ Native attempt-replay parity remains REGISTERED with M10; these managed forwards
29
+ do not implement native parity or authorize host activation.
30
+
31
+ ## [0.25.0]
32
+
33
+ - Publishable on the npm `latest` dist-tag as `0.25.0`, from tag
34
+ `openlup-platform-v0.25.0`.
35
+
36
+ - Re-pin the pending M10/F17 control fixtures after landed M08/M09 without
37
+ changing either installation rail, the migration manifest or landed N1. The
38
+ 16-entry packet has seven native and nine managed pins. Native X restores
39
+ ATP-counted late-positive stock recovery; Y filters paid retry candidates
40
+ before LIMIT. Fold command-preview receipt replay into uninstalled N2, keeping
41
+ apply unchanged. Preserve the historical 14-pin approval reader and exact
42
+ prefix, definition, statement, ACL and catalog controls. Real PostgreSQL
43
+ witnesses cover ATP, starvation, all 43 fresh command scenarios and raw preview
44
+ replay with no counts/columns/xmin delta.
45
+
46
+ No package SQL asset, export, runtime activation or external CI dependency is
47
+ introduced. The development-preview boundary remains.
48
+
49
+ - Fix uninstalled N3 normal_due pagination to exclude waiting/stock_secured cases before LIMIT, preventing normal-renewal starvation.
50
+
51
+ - Repair uninstalled N2 donor no-op truth for native bundle/resize, plan, package, add-on and same-UTC-day slide commands before repricing: preserve locked prices after catalogue changes, writing only the command receipt, with no quote, event or version increment. Native resize compares lines/cadence; portion mode/factor remain host-owned without native storage. Predicate-removal mutants cover every mapped donor action; apply stays unchanged.
52
+
53
+ - Audit pending M10 donor change and no-op semantics together. N2 plan edits
54
+ apply requested core lines; new add-ons normalize quantity, preserve cadence
55
+ and compare UUIDs by value. N3 preserves paused waits, filters eligible recovery
56
+ before LIMIT, binds frozen reads to the current active schedule, reports free
57
+ stock separately from own holds, and ignores closed/unpaid realization notices.
58
+ Real PostgreSQL tables cover applied state, no-op/refusal/replay and rolled-back
59
+ assignment mutants. Installed rails and N2 apply remain unchanged; channel
60
+ exposure/admission parity stays outside the frozen stock-seam claim.
61
+
62
+ - Close the 0.24.0 known limitation that managed dunning exhaustion still pauses active subscriptions.
63
+ - Land the reviewed managed M1/M2 prefix: refunds preserve subscription lifecycle and paid history; exhausted dunning stays open with NULL retry and active service until authorized same-cycle repair.
64
+ - Folded scope E-gate-replay-loop-landed-untested: retain the existing interleaving-aware catalog replay and add the Docker-free landed N1/M1/M2 witness.
65
+ - Folded scope D-earlier-pin-digest-unplanted: prove CI and release refuse changed earlier M1 bytes beneath landed M2.
66
+
67
+ Migration notes: Apply M1 then M2. Existing paused, expired and refund-cancelled history is not rewritten or reactivated. The existing first-cycle refund stock-release guard remains; later refund-evidence parity and stock-wait/winback changes are separate. No runner is activated.
68
+
69
+ - Add native N2 command preview/apply stores and a P1 command adapter with atomic future terms, actor/key/actual-command receipts and applied/replayed/noop/refused outcomes; preserve frozen current obligations and existing native callers.
70
+ - Type-level flip for dev-preview consumers: `NATIVE_SUBSCRIPTION_CAPABILITIES.genericBundleCommands.supported` and `.commandBoundReceipts.supported` change from `false` to `true`; command results now include `SubscriptionCommandRefusal`.
71
+
72
+ Migration: install N1 then N2 through the complete native manifest; preserve receipts on rollback. Accepted future prices use lock_until_edit, proration none. Address mutation and private introductory/graduation policy stay host-owned; native activation continues to require captured payment evidence.
73
+
74
+ Migration (C73, temporary limitation): managed `subscription_create_provisional_for_checkout` stamps an explicit timezone literal equal to today's `subscriptions.timezone` column DEFAULT. Adopters changing that DEFAULT must also replace the function until the scheduled follow-up forward follows the DEFAULT; no managed SQL changes here.
75
+
76
+ Migration: `SubscriptionCommandPort.apply()` may now return `SubscriptionCommandRefusal` (`outcome: "refused"`), so callers must handle it.
77
+
78
+ - Type-level change visible to dev-preview consumers: `RenewalPaymentRail.execute` adds an optional `failure` field for explicit failure evidence.
79
+ - A host or driver skips `openCase` after a replayed `applyFailure` receipt only when that rung's case propagation already committed; otherwise recovery must complete propagation. The P8 retry driver must add a replay/case-advanced signal and a zero-delta witness for replay after committed propagation.
80
+ - N2 preview follows the supplied core lines for plan-length changes (omitted lines retain stored expansion); new add-ons normalize missing/nonpositive quantity to one, add-on actions preserve cadence, and quantity updates/removals compare variant UUIDs case-insensitively.
81
+
82
+ Land the seven reviewed managed stock-wait/ATP and F17 refund-parity forwards.
83
+ Managed hosts can use the service-role SQL functions and pgTAP witnesses; the
84
+ package declares the SQL surface and keeps TypeScript stock recovery unavailable
85
+ because no managed adapter implements the stock-wait/availability ports.
86
+
87
+ Migration: apply the complete managed prefix through `20261024185100` before
88
+ calling stock-wait or refund-evidence functions. M4 extends M2's active/open
89
+ continuity with wait exclusion before LIMIT. M5 makes positive customer
90
+ cancellations immediately winback-eligible within 120 days, retaining episode
91
+ dedupe, and maps started/resumed notices. F17 accepts cumulative provider snapshots,
92
+ emits one refunded event on transition, and preserves M1 refund/lifecycle
93
+ independence. Keep captured obligations and receipts on rollback and disable the
94
+ host stock-wait driver first. SQL installs no scheduler or payment executor.
95
+
96
+ ATP protects active upcoming demand within 14 days plus live provider hard holds.
97
+ The exposure hook remains zero; current donor channel admission is deferred.
98
+ This is a development-preview SQL surface, not a composed managed TypeScript port
99
+ or a claim of advance future-cycle reservations or stable installation support.
100
+
101
+ Native stock-wait persistence, frozen discovery and stock-only refusal recovery
102
+ now have transaction-bound adapters. The native ATP/new-purchase read protects
103
+ hard holds and fixed 14-day soft subscription demand; the renewal allocator uses
104
+ the same seam. X restores late-paid released stock once, and Y filters paid and
105
+ settled retry obligations before LIMIT. Managed stock wait and runner composition
106
+ remain separate; native selection still requires passing real-PostgreSQL proof.
107
+
108
+ Migration: install the native N3, ATP seam, allocator, X and Y prefix in filename
109
+ order, with their package twins and regenerated selected-catalog-v2 inventory.
110
+ Migration: upgrading hosts must grant their native inventory-reserving runtime
111
+ role EXECUTE on public.inventory_available_to_promise(text,text,timestamptz,boolean)
112
+ and public.inventory_channel_exposure_quantity(text,text), plus SELECT on the
113
+ seam's underlying relations as listed in Data and migrations, before using the
114
+ updated allocator or N3 stock-wait paths.
115
+ `StockWaitStorePort.listCandidates` now returns `StockWaitFrozenCase[]`: discovery
116
+ may have no durable case yet. Hosts must retain its frozen snapshot and binding.
117
+ Frozen discovery requires the active current schedule; paused current waits remain open.
118
+ Deficits separate own reserved units from free ATP and subtract both for missing
119
+ units. Closed or pending-payment resume callbacks return null without writes; paid
120
+ fulfillment-pending orders can complete realization admission.
121
+ No advance reservation, physical coverage guarantee or one-time checkout writer
122
+ is introduced. No pause, payment execution or parcel-arrival fact is added.
123
+ Uncaptured stock refusals rotate on the operation selection timestamp even when
124
+ missing or stale stock prevents case creation, allowing replenished work through
125
+ a bounded candidate page.
126
+
127
+ M10 P6 + P8: composed subscriptions (development preview)
128
+
129
+ Migration: Additive `./subscriptions` facades are `createSubscriptionServices`, `createSubscriptionCommandExamples`, `createSubscriptionLifecycleMessages` and `subscriptionLifecycleTemplate`; hosts explicitly supply readiness, execution, commands and M04 delivery. No factory activates serving work. `SubscriptionLifecycleFact` is exported from this entry; `subscriptionLifecycleTemplate(kind, retryAttempt?)` preserves the installed payment-failure rungs (1, 2, otherwise 3). `runRenewalBatchRows` exposes the existing per-row error-result isolation for composed hosts.
130
+ Migration: Additive `./composition` entry `createSubscriptionContribution` describes exactly one selected subscription schedule; off supplies none. Hosts bind its callable to their existing population lease and observe the complete installed schema.
131
+ Migration: `createPostgresRetryStore` adds `failureProgress(operationId,key)`, returning receipt replay and committed case progression. The native retry driver completes interrupted propagation and skips already advanced cases; existing applyFailure/openCase signatures remain unchanged.
132
+
133
+ The inert native reference binding composes mandatory G23, dunning and stock wait.
134
+ Captured alignment cases retain authority under off. Prepared attempts reconcile
135
+ without re-execution; ordinary retries bind the frozen mandate and logical cycle.
136
+ M04 owns delivery; M12 owns aggregation. No SQL asset, serving swap, release or
137
+ managed TypeScript recovery is introduced. Native multi-cycle prepaid and M07
138
+ prepared-attempt-store capabilities retain their named unsupported boundaries.
139
+
13
140
  ## [0.24.0]
14
141
 
15
142
  - Publishable on the npm `latest` dist-tag as `0.24.0`, from tag
@@ -227,435 +354,3 @@ These are notes carried from the landed design, not fixes in this preparation.
227
354
  - PDF content-type normalization retains OpenLup behavior; signature checks are
228
355
  stricter than donor ASCII decoding. `invoicePdfFilename` falls back to English
229
356
  `invoice`; supply host captions (PR #344).
230
-
231
- ## [0.23.0]
232
-
233
- - Publishable on the npm `latest` dist-tag as `0.23.0`, from tag
234
- `openlup-platform-v0.23.0`.
235
-
236
- - Add `approveTrackingUrl` inputs to `verifyAndNormalizeFulfillmentObservation`,
237
- `PostgresFulfillmentShipmentSpineOptions`, `FulfillmentAdapterConformanceSubject`
238
- and reconciliation `trackingCodecs`. Under the strict default, provider tracking
239
- URLs persist only with host approval and must be query-free and credential-free
240
- HTTPS; host-built tracking URLs pass unchanged, including query strings.
241
- - Existing `reconcileFulfillmentObservations` callers now receive row-local unknown
242
- readback failures (`ok: false` with `failures`) while recognized rows still
243
- process.
244
- - Observation ingest (`verifyAndNormalizeFulfillmentObservation`, the native
245
- `recordObservation`, `reconcileFulfillmentObservations` and
246
- `runFulfillmentReconciliationPage`) now applies the durable-sink sanitizer: provider-derived
247
- references outside the opaque reference rule (for example `#1001` or
248
- `ORD/2026/1`) are stored as null or redacted and counted instead of verbatim,
249
- and `firstReceivedAt` must be an RFC 3339 timestamp with an offset; other
250
- values fail ingest or the reconciliation row. A correlation refused to null can
251
- be quarantined as `missing_correlation` in reconciliation.
252
- - Fulfillment reconciliation inputs replace `readLocalFulfillmentState` with
253
- `readLocalFulfillmentStatus`, `latestStatusOccurredAt` and `readHandedOverAt`;
254
- migrate host persistence implementations to these three reads.
255
- - Add exported page observation contracts and `runFulfillmentReconciliationPage`
256
- for host-owned scheduling, checkpoint resume and HTTP/ledger result projection;
257
- exact lookup remains separate. `providerCalls` counts logical page-port reads,
258
- including failures and exhaustion, separately from transport retries.
259
- - Add redacted dispatch transcript/mapping fields, typed operation errors,
260
- acceptance recovery evidence and provider-status occurrence evidence. Existing
261
- unchanged stage/live dispatch identities retain their stored evidence for native replay.
262
- - Migration: shadow drafts/attempts recorded by `0.22.0`'s native dispatch store
263
- do not replay after this change: shadow now hashes the local candidate rather
264
- than the provider-prepared command. Claim may consume a remap or raise
265
- `fulfillment_dispatch_remap_exhausted`; an existing attempt may raise
266
- `fulfillment_attempt_key_conflict`. Complete or abandon such drafts before
267
- upgrading. The `0.22.0` native dispatch store has no adopter; no compatibility
268
- transition is supplied.
269
- - D2 KEEP-GAP: native `fulfillment_dispatch_finish` drops rejected/unknown error
270
- detail; durable retention is a scheduled SQL follow-up.
271
-
272
- - Compatibility: `getStock()` and `getStockMovements()` now return a row union;
273
- consumers must discriminate rejections with
274
- `"kind" in row && row.kind === "rejected"` before reading observation fields.
275
- Provider read failures now return failed worker results (`ok: false`) with
276
- persisted `providerError` diagnostics when the provider supplies a typed failure,
277
- instead of throwing. Hosts can map those
278
- failures to HTTP 502; terminal cursor-write failures still reject.
279
- Cursor reads, running-cursor writes, local stock/class/reservation reads and
280
- stock/evidence writes or SKU evidence resolution now also resolve `ok: false`
281
- instead of rejecting when a terminal failed cursor can be persisted.
282
- - `SyncCursor` adds optional `syncRunId`, `counts`, `items`, `alerts`, `staleSync`
283
- and `error`, worker results add `rejected`, `items`, `providerError` and `refusal`,
284
- and `fulfillment_stock_sync_cursors.error_code` now stores safe operation reasons
285
- (including `operation:SQLSTATE`) or typed provider/admission reasons instead of
286
- the generic `io_failure`.
287
- - Mixed valid/rejected batches with valid stock rows succeed, retain rejection
288
- counts and diagnostics, evaluate/resolve alerts for valid SKUs and advance
289
- `lastStockSyncedAt`; an empty stock response is also valid, but a nonempty stock
290
- response with no valid stock rows is malformed and non-retryable even with valid
291
- movements, preserves prior coverage gaps and cannot resolve stale alerts.
292
- Typed disabled, not-ready and bad-identity refusals retain their original reason
293
- and retryability in the worker result and cursor.
294
- Blank stock SKU references are skipped before persistence; stale-sync recovery
295
- resolves after the terminal cursor, with cleanup failure preserving success.
296
- Stock and movement rejection diagnostics carry a `kind` discriminator.
297
- Stock-sync redirects are non-retryable, report `redirect_refused` and make only
298
- one GET attempt; exhausted stock network reads remain retryable through the stock
299
- failure projection. Product-sync retains the base client diagnostics and retry
300
- behavior, including `retryable: false` after exhausted network reads.
301
- - Stock-sync alert fingerprints now contain only `requestKey`, `skuRef` and
302
- `thresholdKind`: changing quantities, severity or run evidence under the same
303
- key returns `replayed: true`. Different SKUs or thresholds use different keys;
304
- a changed identity under a reused key still conflicts.
305
- - Closed the scheduled KEEP-GAP for stock alert refresh/reopen with native forward
306
- `20261022165000_fulfillment_stock_evidence_replay_reopen.sql`. Matching-identity
307
- replay reopens the alert, refreshes severity/quantities and clears `resolved_at`;
308
- identity mismatches retain SQLSTATE `23505`.
309
-
310
- Migration: install the complete native catalogue through `20261022165000` before
311
- stock adoption. The package descriptor and SQL asset project that same forward;
312
- replay preserves the row identity, first-seen time and historical resolver run.
313
- There is no managed forward or legacy fingerprint rewrite.
314
-
315
- Migration: alert rows written by 0.22.0's native port carry the earlier whole-input fingerprint; subsequent writes under those keys conflict with SQLSTATE `23505`, and resolve only marks the row resolved while retaining its key and fingerprint, so it does not clear the conflict. Legacy fingerprints are documented only; this change does not rewrite them.
316
-
317
- - Fulfillment ingress exposes receipt IDs, a host-neutral HTTP result mapping,
318
- counted correlation/timestamp/tracking refusals and persisted safe superseded
319
- causes. The opt-in adapter preserves donor webhook key bytes and defaults to
320
- strict opaque references. Adopters can explicitly allow wider reference shapes
321
- through `observationCodecs.approveReference`; tracking URLs retain their strict
322
- default policy. `carrierRef` now stores the service-derived lowercase carrier
323
- prefix by default, or the safe kind returned by `normalizeCarrier`, and effects
324
- receive that same value as `carrierKind`. Both are null when no kind is available
325
- or service evidence is refused; raw provider carrier codes have no fallback,
326
- matching donor deduplication. Strict timestamp validation applies only at
327
- webhook ingress, accepting compact offsets and local timestamps as before;
328
- reconciliation and stock-movement timestamp parsing retain PR2 behavior.
329
- Hosts retain referenced raw evidence.
330
-
331
- Migration (observation ingress): donor-format colon identities remain the
332
- compatibility target. Observation receipts/effects recorded by 0.22.0's native
333
- stores under package digest keys are not recognized under the incumbent colon
334
- keys, so retrying such an event can apply tracking again. Replaying a superseded
335
- receipt processed by 0.22.0 fails with `fulfillment_observation_outcome_conflict`.
336
- Drain in-flight observation retries before upgrading. No bridges or aliases are
337
- provided for these native rows. Wider incumbent correlation/tracking references
338
- require an explicit adopter allowlist; the default refuses and reports them.
339
-
340
- Close the scheduled native stock-evidence refresh/reopen gap with forward
341
- `20261022165000_fulfillment_stock_evidence_replay_reopen.sql` and its byte-identical
342
- fulfillment package projection. Matching fingerprints refresh severity and nullable
343
- quantities, reopen status, and clear `resolved_at`; identity, first-seen time and
344
- historical resolver metadata survive. Existing-row replays and resolution serialize
345
- on the row lock. Fingerprint mismatches still raise `23505`.
346
-
347
- Migration: install the complete canonical native catalogue through `20261022165000`
348
- before stock adoption, preserving its immutable ledger prefix. Sparse package SQL
349
- is not a standalone install chain. The managed baseline already has this behavior.
350
- Legacy 0.22.0 whole-input fingerprints are not rewritten and still conflict with
351
- PR1 identity fingerprints, including after resolution.
352
-
353
- - Add experimental invoicing declarations and explicit default-off capability selection, preserving exact absence, uncertain effects, correction identity and owed-duty visibility.
354
- - Freeze host fiscal/facts/seller/money, registry, artifact, delivery, payout-item and safe account-history seams without installing a worker, store, provider or route.
355
-
356
- Approve only the exact frozen M10/F17 native and managed SQL packet through a separate forward-control class, with inert fixtures, refusal plants and a required real PostgreSQL/pgTAP catalog gate. This control adds no migration, runtime activation or new permission to an installation.
357
-
358
- - Add experimental subscription contracts and exact server/browser subpaths, preserving schedule identity, graph transaction boundaries, deferred admission and explicit native capability refusals.
359
- - Contribute the unchanged hosted cycle, refusal and durable failure mechanisms with injected policy and their characterization; preserve native captured-case protection through rollback until actual arrival.
360
-
361
- - Add injected native renewal and retry stores and a native executor using the subscription ports; bind hosted charge/failure facades to the contributed mechanism and existing M07 policies.
362
- - Type-level change visible to dev-preview consumers: `capabilities.retryRecovery` changes from `"unavailable"` to `"selected"` (asserted in packages/platform/test/subscriptions/portFit.test.ts).
363
-
364
- Migration: Install native N1 through the full ordered manifest before composing the retry driver. Native declines can retry or recover the original obligation instead of stalling indefinitely (F16); exhaustion leaves an active subscription and open case with no next retry. Preserve ledgers on rollback. The initial binding preserves case-before-outcome order and atomic terminal/bookkeeping writes. An existing immutable receipt short-circuits initial terminal replay before settlement, rebinding or case propagation, preserving all later retry effects; no runner is activated and M07 native prepared-store parity remains unavailable.
365
-
366
- Host obligations: establish explicit logical-cycle correlation before invoking the runner (including prepare/execute). Ordinary retries must use the frozen mandate/authorization; N1 does not bind an ordinary retry method, so the P8 retry driver or host must enforce this, with a composition witness added in P8. Prepared retries retain the existing non-terminal `retry_scheduled` disposition with no next dispatch date. Bare `failed` execution status without explicit failure evidence requires verified readback (or remains awaiting an ACK).
367
-
368
- A host or driver must never call `openCase` after a replayed `applyFailure` receipt, and the P8 retry driver must add a zero-delta replay witness.
369
-
370
- ### Warehouse product-sync parity
371
-
372
- A3 #311 restores product-sync parity and safe diagnostics in the opt-in warehouse
373
- adapter, including product/pack projection and injected transport behavior.
374
- It remains default-off with offline evidence only and no provider-account proof.
375
-
376
- Migration: upgrade the complete core/outbox/platform set from `0.22.0` to
377
- `0.23.0` for exact peers. Install the complete canonical native chain through
378
- position 76 (`20261022165000_fulfillment_stock_evidence_replay_reopen.sql`),
379
- including native N1, before selecting native stores. Sparse package SQL is not
380
- an installation chain. Follow the shadow-draft, observation-retry and legacy
381
- alert-fingerprint migration notes above; rollback preserves the forward ledger.
382
-
383
- ### Experimental stages: no adopter activation
384
-
385
- M10 subscription renewal/retry is **EXPERIMENTAL, INCOMPLETE and DEFAULT-OFF**,
386
- not for adopter activation. This set includes P1 exports, the forward controls,
387
- and P2 native renewal/retry stores and executor with native N1 SQL landed.
388
- No runner is activated. G23 composition and N1 correlation, frozen authorization
389
- and replay obligations remain pending: compose admission before any new cycle,
390
- bind a logical cycle before prepare/execute, enforce frozen authorization on
391
- ordinary retries, and never open a case after a replayed failure receipt.
392
- The later retry driver still owes its zero-delta replay witness.
393
-
394
- M09 invoicing capability selection and type-only contracts are
395
- **EXPERIMENTAL, INCOMPLETE and DEFAULT-OFF**, not for adopter activation.
396
- There is no invoicing SQL, store, worker, provider or route in this stage.
397
- Installing the set does not register subscription or invoicing routes, workers
398
- or a renewal runner; host composition remains explicit.
399
-
400
- ### Known limitations
401
-
402
- - Managed dunning exhaustion still pauses active subscriptions; retaining active status needs a managed forward. Native N1 lands the bounded retry/failure repair, with the host obligations below still pending.
403
- - D8-1: native advisory v2 promo-code candidates/rejection details unavailable.
404
- - D8-2: native mounted v2 issue/honor/fallback unavailable.
405
- - D8-3: native acquisition-only mounted issuance/honor unavailable.
406
- - D8-4: full native/managed eligibility equivalence unavailable.
407
- - Bundle-1: independent DB human-only actor-kind enforcement absent natively; first in the native-backend parity round.
408
- - Bundle-2: managed-equivalent actor-kind/email history absent natively.
409
- - Bundle-3 closes injected-reader M05 mounted admin/feed readback only. Native new-purchase stock read absent despite P5a installed-store proof; deferred second after bundle-1 (owner 2026-10-21); readiness refuses.
410
- - Bundle-4: incumbent real-PostgreSQL contention only; no exactly-once guarantee.
411
- - Managed schema/pgTAP retain `44.404`; removal needs owner decision/forward; reference composition supplies it to app code.
412
- - A1 offline only; account/hosted-time/owner TEST evidence unclaimed; `communications/klaviyo` verification-pending.
413
- - M05 omitted opt-ins preserve defaults/outputs/read order/schedules/refusals/acceptance-token bytes/SQL.
414
- - Native inventory adjustment unavailable; address writes refuse readiness. Flat-rate save needs selected port/Core readiness/applied-seed observation.
415
- - Native shipping audit unavailable; handler swallows best-effort audit failure.
416
- - Native flat-rate integer bounds (0 through host maximum; reference 100,000 minor units) use request schema, not DB CHECK.
417
- - Managed ATP/forecast/dated-supply/pagination readback unproved/pending M06.
418
- - Managed two-session locks/concurrency/uncovered compensation unproved/pending M06.
419
- - Managed exact-prefix upgrade/ledger unproved/pending M06.
420
- - Managed address idempotency/conflict/readback unproved/pending M06.
421
- - Managed successful flat-rate read/save unproved/pending host authority.
422
- - M06 stock-wait lifecycle/durable timing/staging controls retain C5/C6; busy/try-gate, continuity/flag/TTL transfers are dispositions, not PASS.
423
- - Shipping national-registry fields/locale-specific `canonicalAddressKey` fold await M16 host market pack/key migration; reference shipping copy stays locale-specific until M16.
424
- - Native durable prepared storage, method setup, absence reopen and cumulative refunds unavailable; no production installation parity claimed.
425
- - Typed refusal-envelope forwarding unavailable (`failureReason` only); reusable registration needs host ownership resolution.
426
- - Incomplete chargebacks stay refunds/unapplied: reclassification bypasses evidence validation into dispute apply; limited operator recovery.
427
- - Audit compatibility still detects `chargeId`; refund operation identity/original money supply no typed charge identity.
428
- - M07 follow-up: repair poll can clear host redirect; post-timeout verify never restarts polling; unlocalized poller; fixture builds/never calls handler.
429
- - M07 follow-up: reference status route wrong-rail witness.
430
- - M07 follow-up: explicit reference-route refusal for unsupported method setup.
431
- - M07 follow-up: deployment-neutral disabled-verify reason.
432
- - M07 follow-up: reference card normalizer missing-amount path; package settling evidence already requires positive money.
433
-
434
- - Native delivery alignment stays off or shadow until a host composes the native automatic-renewal runner with the G23 renewal admission decorator. The decorator alone neither composes nor activates the runner.
435
- - The core fulfillment status map carries localized adopter labels; replace them with host-injected labels or internationalization keys at the host presentation boundary.
436
- - The warehouse adapter example is opt-in and has offline conformance only; no provider-account proof or activation is established. Exact absence, label create/void and cancellation remain unsupported.
437
- - After an alignment extension, a deferred renewal operation at the old schedule remains claimed with no reader or reservation effect. Changed terms snapshots conflict under the existing snapshot-conflict rules.
438
-
439
- Native parity remains host-owned at these seams. Missing native bindings use the shared `FULFILLMENT_NATIVE_UNSUPPORTED` refusal; no partial write or parity claim is implied.
440
-
441
- | Amendment | Host-owned seam and native boundary |
442
- | --- | --- |
443
- | G18 | Replacement creation and atomic eligibility/replay receipts; native replacement callback refuses. |
444
- | G19 | Operator mutations, actor attribution and replay receipts; native mutation callbacks refuse. |
445
- | G20 | Customer alignment rows; native reader refuses, while the pure delay projection remains callable. |
446
- | G21 | Commerce list/detail and shipments overview; native read callbacks refuse. |
447
- | G22 | Authoritative preparation edits, authorization and replay receipts; missing preparation binding refuses before dispatch, after disabled/selection/readiness checks. |
448
-
449
- - M08 parity D2 KEEP-GAP: native dispatch finish still loses rejected/unknown error detail.
450
- - M08 parity KEEP-GAP: immutable stock snapshot/alert evidence storage is absent; cursor JSON is overwritten. Hosts retain referenced evidence.
451
- - Stock-evidence replay/reopen is CLOSED by native position 76; legacy `0.22.0` alert fingerprints still conflict with `23505`, including after resolution.
452
-
453
- ## [0.22.0]
454
-
455
- - Publishable on the npm `latest` dist-tag as `0.22.0`, from tag
456
- `openlup-platform-v0.22.0`.
457
-
458
- - Add eleven experimental reference-application support exports on the existing payment vendor subpaths. Reuse contributed execution, readback, mapping and diagnostic helpers; preserve the no-charge error class identity. Neutral payment exports and default activation remain unchanged.
459
-
460
- Migration: none.
461
-
462
- ### Opt-in warehouse fulfillment example
463
-
464
- Add the experimental, opt-in warehouse fulfillment entry described in the README behind the frozen neutral fulfillment ports: explicit injected I/O, prepared-byte binding, closed evidence, token observations and positive readback. Default-off; account readiness is host-owned. Exact absence, label create/void and cancellation remain unsupported.
465
-
466
- Missing or malformed evidence refuses before credential resolution or HTTP.
467
-
468
- Migration: none
469
-
470
- ### Offline warehouse fulfillment conformance
471
-
472
- Prove the opt-in warehouse fulfillment entry described in the README with M08's offline conformance runner using injected
473
- HTTP and synthetic fixtures. Cover dispatch replay and refusals, observation,
474
- readback, stock and product sync, plus real-worker host-ledger fences after
475
- restart and retention eviction. No provider-account or activation proof is claimed.
476
-
477
- Migration: none
478
-
479
- ### Fulfillment contracts and status canon
480
-
481
- Add experimental `fulfillment` and type-only `fulfillment/contracts` entries with
482
- contributed status decisions, strict core parser bindings, concrete provider/store
483
- ports and injected default-off capabilities. No adapter, executor, route or default
484
- profile is activated; existing reference integrations remain unchanged.
485
-
486
- Declared adaptation: empty or absent provider selection is a typed refusal in the
487
- new package, rather than the donor host's implicit simulator alias. The donor alias
488
- remains an open owner follow-up; this contribution does not change donor logic.
489
- Private provider trace columns and registry/environment values are excluded from
490
- the neutral package; persisted command fingerprints and opaque host keys are retained.
491
-
492
- Migration: none (new surface; no existing reference behavior changes).
493
-
494
- ### Fulfillment paid handoff and fenced dispatch
495
-
496
- Add the paid outbox handler/recovery classifier, injected dispatch worker and
497
- separate durable command-ledger protocol through the new fulfillment entry.
498
- Preserve one contact remap, opaque host keys, actual-command fingerprints,
499
- readback/attempt/begin order and local accepted-proof repair without another POST.
500
- Provider/money/inventory authority remains injected; no SQL, route or activation.
501
-
502
- Approved port amendment G14 adds recordProviderAttempt to the new
503
- FulfillmentStorePort. It records only sanitized prepared DispatchEvidence plus
504
- mode/recorded status and opaque references, after authoritative claim readback;
505
- same-key replay writes no second attempt and contact remap retains its own key.
506
- No new named export or subpath is added by this method. Other contracts are unchanged.
507
-
508
- Correctable draft re-claim must refresh fingerprint and evidence atomically.
509
- Store conformance and native durability/fencing and SQL proofs remain later work.
510
-
511
- Migration: none (new surface; contracts and orchestration land in one release).
512
-
513
- ### Fulfillment observation and sync workers
514
-
515
- Add neutral observation effects, verified ingress, observation reconciliation,
516
- tracking, stock/product sync, read-only evidence handlers and the offline
517
- runFulfillmentAdapterConformance at the existing fulfillment entry.
518
-
519
- Migration: approved G15 extends the unreleased SyncCursor with optional
520
- coverageGapSkus (legacy absence reads as []). Only consecutive succeeded runs
521
- confirm a reservation coverage gap; running/failed cursors clear the set.
522
- Migration: approved G16 changes readLocalInventoryStock(requestedAt) to typed
523
- unaggregated lines with skuRef, quantity balances, fulfillable, locationStatus,
524
- lotStatus and expiresAt. The worker filters/sums at the captured clock; expiry
525
- exactly then is excluded. Inventory authority and the provider stock-sync shape
526
- are unchanged.
527
- Migration: approved G17 adds inline localPersistence: ingress records eventKey
528
- receipts preserving firstReceivedAt and marks processing idempotently;
529
- reconciliation reads local status/latestStatusOccurredAt/handedOverAt. No named
530
- persistence type is exported. Durable replay and processing remain host obligations.
531
- A superseding conflict returns superseded but persists only processed status,
532
- without a dedicated superseded-reason field.
533
-
534
- Correlated ingress requires a nonblank observation or dispatch external reference
535
- before acceptance/status/effects/processed mark; failure leaves the receipt
536
- unprocessed. Stock-contention annotation is best-effort before the original stock
537
- failure is rethrown; recovered-picked receipt diagnostics remain typed. Effects
538
- retain stock → handover → tracking → invoice and callback/throw order.
539
- Reconciliation fails the run on unknown readback and projects unmapped correlation
540
- evidence before host calls. Product evidence reads retain safe authorization/read
541
- refusal detail. Private codecs, keys, carrier URLs and provider errors stay
542
- host-owned; typed evidence replaces raw payload pass-through. The conformance
543
- runner accepts adapter-owned offline subjects and returns sanitized evidence;
544
- fixture checks do not establish durable store atomicity or arrival alignment.
545
-
546
- ### Fulfillment native persistence and delivery alignment
547
-
548
- Add native shipment, evidence, stock, recovery, dispatch, paid-handoff and
549
- alignment stores through the existing fulfillment entry. Sparse migration
550
- projections bind native units 5/27/51/73/74; install the complete catalogue.
551
- Coverage-gap cursor state and received/status/processed evidence are
552
- durable, while local inventory lines and contact preparation remain explicit
553
- host inputs. Native 3pl acceptance uses a dispatch evidence receipt and preserves
554
- the cancellation fence without inventing an owned label or physical packing.
555
-
556
- Native admission: overdue-delivery admission guards only NEW cycle
557
- admission/insert, matching the donor's guard_cycle_insert. Existing-cycle retries
558
- through renewal operations and dunning bypass admission and neither mint nor
559
- consume a one-use receipt. No retry_scheduled state or payments lifecycle change is
560
- introduced. Native continuity requires the complete canonical migration graph,
561
- real-PostgreSQL installation, replay and access-control checks.
562
-
563
- ### Fulfillment operator lifecycle and customer delay projection
564
-
565
- Add host-owned operator and replacement handlers through the fulfillment entry.
566
- Mutation callbacks require actor attribution and idempotency keys; the host owns
567
- atomic replay receipts and replacement eligibility, reservation and hold effects.
568
- Native bindings return a shared typed unsupported refusal without writing.
569
- Customer delay projection keeps absent cases distinct, hides aligned history
570
- when the schedule advances and never presents manual review as protection.
571
- Label helpers preserve transient downloads and cleanup uncertainty. Current
572
- parcel helpers retain sequence selection and companion attribution. These
573
- exports mount no route, dispatch no parcel and attest no replacement arrival.
574
-
575
- ### Fulfillment commerce reads and recorded progress
576
-
577
- Add host-owned commerce list/detail projections, a shipments overview handler and
578
- typed read callbacks. Projected payment status passes through unchanged and
579
- native reads return the shared unsupported refusal. Preserve opaque host overview
580
- buckets and the legacy shipment-status facade. Progress completion requires
581
- recorded milestones and uses the host-resolved customer step.
582
-
583
- ### Fulfillment internal simplification
584
-
585
- Reuse the empty stock-balance constructor in aggregation and sync, and append to
586
- private recovery groups without copying each growing array. Fulfillment results,
587
- public contracts, key bytes and effect order remain unchanged.
588
-
589
- ### Fulfillment service composition and preparation
590
-
591
- Add explicit default-off fulfillment services, a structural contribution and an
592
- inert reference preparation binding. Authoritative source edits and redacted
593
- context synchronization share the native dispatch and shipment locks. Missing
594
- preparation refuses readiness. No route, schedule, renewal wrapper or automatic
595
- dispatch is activated.
596
-
597
- ### Fulfillment presentation ownership
598
-
599
- The status canon, actual-evidence tracking progress, current-parcel selection and
600
- canonical fact parsers belong to `@openlup/core/fulfillment`. Platform keeps thin
601
- compatibility re-exports and preserves its existing narrowed fact type names.
602
- Fulfillment contracts re-export the shared status and progress types from core.
603
- Server orchestration remains in platform. Browser code, including the host
604
- status, fact and current-parcel facades and the account order views, imports
605
- these helpers from core, so no browser graph loads the platform fulfillment
606
- runtime.
607
-
608
- Migration: existing platform imports remain valid; no application or schema
609
- migration is required. Core exposes narrowed fact aliases with a `Canonical`
610
- prefix while its generic fact exports retain their names.
611
-
612
- Migration: upgrade core, outbox and platform together from `0.21.0` to `0.22.0` for exact peer pins. Install the complete canonical native migration chain through units 73/74 (`20261022080000_fulfillment_command_ledger.sql` and `20261022090000_fulfillment_delivery_alignment.sql`), never the sparse package projections alone. Before, these fulfillment services were host-owned; after, explicitly compose selected ports and default-off services. Nothing mounts routes, schedules dispatch or composes the native renewal runner automatically. Keep native alignment off or shadow until the G23 decorator is composed. Arrival alignment remains once and later-only; undelivered replacements remain outstanding, and replacement confirmation must only record actual customer arrival. Preserve G15–G17 cursor, receipt and local-status persistence when implementing host stores. An application rollback does not reverse the forward migrations; older runners refuse the extended ledger.
613
-
614
- ### Known limitations
615
-
616
- - Portable dunning repair has no managed twin: exhaustion still pauses active subscriptions there; retaining active status needs a managed forward.
617
- - D8-1: native advisory v2 promo-code candidates/rejection details unavailable.
618
- - D8-2: native mounted v2 issue/honor/fallback unavailable.
619
- - D8-3: native acquisition-only mounted issuance/honor unavailable.
620
- - D8-4: full native/managed eligibility equivalence unavailable.
621
- - Bundle-1: independent DB human-only actor-kind enforcement absent natively; first in the native-backend parity round.
622
- - Bundle-2: managed-equivalent actor-kind/email history absent natively.
623
- - Bundle-3 closes injected-reader M05 mounted admin/feed readback only. Native new-purchase stock read absent despite P5a installed-store proof; deferred second after bundle-1 (owner 2026-10-21); readiness refuses.
624
- - Bundle-4: incumbent real-PostgreSQL contention only; no exactly-once guarantee.
625
- - Managed schema/pgTAP retain `44.404`; removal needs owner decision/forward; reference composition supplies it to app code.
626
- - A1 offline only; account/hosted-time/owner TEST evidence unclaimed; `communications/klaviyo` verification-pending.
627
- - M05 omitted opt-ins preserve defaults/outputs/read order/schedules/refusals/acceptance-token bytes/SQL.
628
- - Native inventory adjustment unavailable; address writes refuse readiness. Flat-rate save needs selected port/Core readiness/applied-seed observation.
629
- - Native shipping audit unavailable; handler swallows best-effort audit failure.
630
- - Native flat-rate integer bounds (0 through host maximum; reference 100,000 minor units) use request schema, not DB CHECK.
631
- - Managed ATP/forecast/dated-supply/pagination readback unproved/pending M06.
632
- - Managed two-session locks/concurrency/uncovered compensation unproved/pending M06.
633
- - Managed exact-prefix upgrade/ledger unproved/pending M06.
634
- - Managed address idempotency/conflict/readback unproved/pending M06.
635
- - Managed successful flat-rate read/save unproved/pending host authority.
636
- - M06 stock-wait lifecycle/durable timing/staging controls retain C5/C6; busy/try-gate, continuity/flag/TTL transfers are dispositions, not PASS.
637
- - Shipping national-registry fields/locale-specific `canonicalAddressKey` fold await M16 host market pack/key migration; reference shipping copy stays locale-specific until M16.
638
- - Native durable prepared storage, method setup, absence reopen and cumulative refunds unavailable; no production installation parity claimed.
639
- - Typed refusal-envelope forwarding unavailable (`failureReason` only); reusable registration needs host ownership resolution.
640
- - Incomplete chargebacks stay refunds/unapplied: reclassification bypasses evidence validation into dispute apply; limited operator recovery.
641
- - Audit compatibility still detects `chargeId`; refund operation identity/original money supply no typed charge identity.
642
- - M07 follow-up: repair poll can clear host redirect; post-timeout verify never restarts polling; unlocalized poller; fixture builds/never calls handler.
643
- - M07 follow-up: reference status route wrong-rail witness.
644
- - M07 follow-up: explicit reference-route refusal for unsupported method setup.
645
- - M07 follow-up: deployment-neutral disabled-verify reason.
646
- - M07 follow-up: reference card normalizer missing-amount path; package settling evidence already requires positive money.
647
-
648
- - Native delivery alignment stays off or shadow until a host composes the native automatic-renewal runner with the G23 renewal admission decorator. The decorator alone neither composes nor activates the runner.
649
- - The core fulfillment status map carries localized adopter labels; replace them with host-injected labels or internationalization keys before any stable-framework claim.
650
- - The warehouse adapter example is opt-in and has offline conformance only; no provider-account proof or activation is established. Exact absence, label create/void and cancellation remain unsupported.
651
- - After an alignment extension, a deferred renewal operation at the old schedule remains claimed with no reader or reservation effect. Changed terms snapshots conflict under the existing snapshot-conflict rules.
652
-
653
- Native parity remains host-owned at these seams. Missing native bindings use the shared `FULFILLMENT_NATIVE_UNSUPPORTED` refusal; no partial write or parity claim is implied.
654
-
655
- | Amendment | Host-owned seam and native boundary |
656
- | --- | --- |
657
- | G18 | Replacement creation and atomic eligibility/replay receipts; native replacement callback refuses. |
658
- | G19 | Operator mutations, actor attribution and replay receipts; native mutation callbacks refuse. |
659
- | G20 | Customer alignment rows; native reader refuses, while the pure delay projection remains callable. |
660
- | G21 | Commerce list/detail and shipments overview; native read callbacks refuse. |
661
- | G22 | Authoritative preparation edits, authorization and replay receipts; missing preparation binding refuses before dispatch, after disabled/selection/readiness checks. |