fix(trial): a product trial ends with the workspace's trial #77

Merged
sharang merged 1 commits from fix/trial-entitlement-end into main 2026-10-15 16:28:02 +00:00
Owner

Bug: a product trial started from the catalogue ran its own 14 days from that moment, whatever the workspace's trial was. A workspace whose trial staff had set to 29.10 lost Prüfwerk on 15.10. Prüfwerk then refused its managed-Git automation with entitlement_expired: new repositories weren't onboarded and pushes weren't handled. The workspace trial itself and the admin page looked fine apart from the 15.10 expiry on the entitlement.

Fix

  • POST /v1/catalog/trial-request: in a workspace on trial, the product trial ends when the workspace's trial ends. In a paying workspace it keeps the product's own trial days.
  • Migration 0019 repairs existing rows on deploy. It touches product trials (config.source = trial, no preview) of workspaces still on trial whose end lies before the workspace trial end: each gets the workspace trial's end, is enabled again, and gets an entitlement.trial_aligned audit entry (actor "migration 0019", system). Booked products, preview grants, trials that end later and paying workspaces are left alone. The down migration does nothing.

Tests: TestProductTrialEnd (cases), TestProductTrialEndsWithTheWorkspaceTrial (the endpoint), and TestMigrate_0019AlignsTrialEntitlements (Postgres: one row aligned and audited, three left alone). Run locally with the existing round-trip test.

Effect on prod after promotion: the affected workspace's Prüfwerk entitlement runs to its trial end again. Within 30 minutes Prüfwerk's managed-Git sync creates the repositories it missed.

🤖 Generated with Claude Code

**Bug:** a product trial started from the catalogue ran its own 14 days from that moment, whatever the workspace's trial was. A workspace whose trial staff had set to 29.10 lost Prüfwerk on 15.10. Prüfwerk then refused its managed-Git automation with `entitlement_expired`: new repositories weren't onboarded and pushes weren't handled. The workspace trial itself and the admin page looked fine apart from the 15.10 expiry on the entitlement. **Fix** - `POST /v1/catalog/trial-request`: in a workspace on trial, the product trial ends when the workspace's trial ends. In a paying workspace it keeps the product's own trial days. - **Migration 0019** repairs existing rows on deploy. It touches product trials (`config.source = trial`, no preview) of workspaces still on trial whose end lies before the workspace trial end: each gets the workspace trial's end, is enabled again, and gets an `entitlement.trial_aligned` audit entry (actor "migration 0019", system). Booked products, preview grants, trials that end later and paying workspaces are left alone. The down migration does nothing. **Tests:** `TestProductTrialEnd` (cases), `TestProductTrialEndsWithTheWorkspaceTrial` (the endpoint), and `TestMigrate_0019AlignsTrialEntitlements` (Postgres: one row aligned and audited, three left alone). Run locally with the existing round-trip test. **Effect on prod after promotion:** the affected workspace's Prüfwerk entitlement runs to its trial end again. Within 30 minutes Prüfwerk's managed-Git sync creates the repositories it missed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
sharang added 1 commit 2026-10-15 15:47:18 +00:00
fix(trial): a product trial ends with the workspace's trial
ci / shared (pull_request) Successful in 16s
ci / test (pull_request) Successful in 25m37s
ci / image (pull_request) Skipped
bf302a4ab1
A product trial started from the catalogue ran its own 14 days from that
moment. In a workspace whose trial staff had set to a later day, the product
stopped before the trial did: Prüfwerk refused the managed-Git automation of
a workspace on trial until 29.10 with entitlement_expired on 15.10.

- trial-request: in a workspace on trial, the product trial ends when the
  workspace trial ends; otherwise (a paying workspace) it keeps its own days.
- Migration 0019 aligns the existing product trials of workspaces still on
  trial that end before their trial (re-enabled), with an audit entry each
  (entitlement.trial_aligned). Booked products, preview grants and trials
  that end later are left alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sharang merged commit 3f4dfa0cdc into main 2026-10-15 16:28:02 +00:00
sharang deleted branch fix/trial-entitlement-end 2026-10-15 16:28:02 +00:00
Sign in to join this conversation.