stack/apps/e2e
Bilal Godil 7f4a15078d Address review findings on subscription wind-down handling
- Clear cancel_at_period_end when switching plans on a Stripe sub —
  paying to switch is an explicit "keep me subscribed", and Stripe
  otherwise persists the flag so the newly paid plan would still die
  at the period boundary. Also reset the locally written canceledAt /
  endedAt wind-down marks so the reactivated sub doesn't end early.
- Prefer active subs over winding-down ones when several in-effect
  subs share a productId in the product list (partial cancel of a
  stackable product could otherwise hide the cancel button).
- Extract isSubscriptionCancelable and use it in both the product
  list's is_cancelable field and the cancel route's filter, so
  is_cancelable: false always implies the DELETE returns 400 — for
  Stripe subs too, which previously re-ran the cancel silently. The
  cancel route now also updates the local row eagerly (mirroring the
  refund route) instead of waiting for the webhook sync.
- Give the by-subscription-id cancel branch the same already-canceled
  error, and stop claiming past_due/incomplete subs are "already
  canceled" — they get their own message.
- Treat canceled-at-period-end subs as replaceable conflicts in
  validatePurchaseSession, so buying another plan in the same product
  line during a wind-down is no longer rejected as "already has a
  one-time purchase". Scoped narrower than isSubscriptionInEffect so
  payment retries of incomplete subs aren't rejected as duplicates.
- Make isSubscriptionInEffect's parameter a union so callers must
  actually have one of the endedAt fields, and rename
  resolveActivePlanSubscription to resolveInEffectPlanSubscription to
  match its new semantics.
- Tests: unit tests for both predicates and the plan-usage wind-down
  resolution, a validatePurchaseSession wind-down conflict test, and
  e2e coverage for stackable partial-cancel shadowing, by-id double
  cancel, and same-line replacement during wind-down.
2026-07-16 14:03:08 -07:00
..
tests Address review findings on subscription wind-down handling 2026-07-16 14:03:08 -07:00
.env Rename STACK_* env vars to HEXCLAVE_* in env templates, with legacy dual-read (#1588) 2026-06-19 18:58:53 -07:00
.env.development [Feat] [Refactor]: Implement Bulldozer JS (#1700) 2026-07-02 10:09:46 -07:00
.eslintrc.cjs tsup for stack-shared (#647) 2025-04-28 21:26:52 -07:00
LICENSE Create users & auth endpoints in backend (#85) 2024-07-01 22:42:08 -07:00
package.json chore: update package versions 2026-07-06 23:34:27 +00:00
tsconfig.json In-source unit tests (#429) 2025-02-14 11:47:52 -08:00
vitest.config.ts Fix CI: stop e2e dev-env leaking into hermetic package tests + refresh stale project snapshots (#1744) 2026-07-08 12:01:46 -07:00