Skip to content

feat: trial entitlements, and expandable plan features (sc-1100) - #37

Merged
roble merged 3 commits into
mainfrom
renanroble/sc-1100/trial-entitlements
Nov 3, 2026
Merged

roble merged 3 commits into
mainfrom
renanroble/sc-1100/trial-entitlements

Conversation

@roble

@roble roble commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

What

  • Trial entitlements on subscription plans.
  • A plan's features expand and collapse in place of the "+N more" text. Vue and React.

Testing

Feature tests for entitlements; the lifetime E2E covers the toggle, including the keyboard. Full suites passed on both stacks.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Subscription plans can now define separate trial entitlements, including feature access and usage limits. These apply during the trial and switch to the plan’s regular entitlements when the trial ends.
    • Long plan feature lists can be expanded and collapsed to reveal additional features.
    • Admins can configure and review trial entitlements in plan settings.
  • Bug Fixes

    • Feature lists now preserve whether features are enabled or disabled when saved and displayed.

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 14 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 457365c9-504c-4f64-b3c4-1f80c7dd46b1
Commits

Reviewing files that changed from the base of the PR and between cc0d0dc and d0816d2.

Files selected for processing: 1
  • src/Filament/Resources/Products/Schemas/ProductForm.php
Walkthrough

Products can now store trial-specific entitlements, which apply while a subscription is on trial. The plan admin form supports configuring them. The React and Vue plan feature lists can now expand and collapse.

Changes: Trial-specific entitlements

Layer / File(s) Summary
Trial entitlement data and override contract
database/migrations/1000_00_00_000001_create_products_table.php, src/Models/Product.php, src/Data/Entitlements.php, tests/Unit/EntitlementsTest.php, tests/Feature/PlanRulesTest.php
Products store nullable trial entitlements. The model validates trial and regular entitlements. Entitlements::override() applies listed feature and limit values while retaining unspecified values.
Trial entitlement resolution
src/Models/Product.php, src/Models/Subscription.php, src/Traits/Billable.php, tests/Feature/EntitlementResolutionTest.php
Subscription::onTrial() reports whether the trial end is in the future. Billable passes that state to the plan, which applies trial entitlements. Tests cover trial expiry and lifetime entitlements.
Admin configuration and demo plan
src/Filament/Resources/Products/..., database/seeders/DemoProductSeeder.php, tests/Feature/PlanAdminTest.php, tests/Feature/DemoSeederTest.php, README.md, resources/boost/skills/saucebase-billing-development/SKILL.md
The admin form supports editing and displaying trial entitlements, including disabled features and limits. The Pro demo plan defines trial entitlements, and the documentation describes the feature.

Expandable plan feature lists

Layer / File(s) Summary
Expand and collapse feature lists
resources/js/react/components/PlanFeatures.tsx, resources/js/vue/components/PlanFeatures.vue, tests/e2e/tests/settings-billing/settings-billing.lifetime.spec.ts
Both components show a limited list by default and provide a button to expand or collapse it. The end-to-end test checks that a feature appears after expansion and is hidden again after collapse.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Billable
  participant Subscription
  participant Product
  participant Entitlements
  Billable->>Subscription: Check onTrial()
  Subscription-->>Billable: Return trial status
  Billable->>Product: Request entitlements(trial)
  Product->>Entitlements: Apply trial_entitlements override
Loading
Merge Risk: Moderate · previous review cc0d0

Existing installations may fail to save trial entitlements, and admins cannot immediately configure them when adding trial days. Add an upgrade migration and make the form field reactive before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 76.92% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies both main changes: trial entitlements and expandable plan features. It is concise and specific.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 76.92% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 13 functions across 16 files. (3 skipped: 3 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d762b5e9-6499-4ca3-9ab2-ddb32a042698
Commits

Reviewing files that changed from the base of the PR and between 4ab72ef and cc0d0dc.

Files selected for processing: 19
  • README.md
  • database/migrations/1000_00_00_000001_create_products_table.php
  • database/seeders/DemoProductSeeder.php
  • resources/boost/skills/saucebase-billing-development/SKILL.md
  • resources/js/react/components/PlanFeatures.tsx
  • resources/js/vue/components/PlanFeatures.vue
  • src/Data/Entitlements.php
  • src/Filament/Resources/Products/Pages/EditProduct.php
  • src/Filament/Resources/Products/Schemas/ProductForm.php
  • src/Filament/Resources/Products/Schemas/ProductInfolist.php
  • src/Models/Product.php
  • src/Models/Subscription.php
  • src/Traits/Billable.php
  • tests/Feature/DemoSeederTest.php
  • tests/Feature/EntitlementResolutionTest.php
  • tests/Feature/PlanAdminTest.php
  • tests/Feature/PlanRulesTest.php
  • tests/Unit/EntitlementsTest.php
  • tests/e2e/tests/settings-billing/settings-billing.lifetime.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Fix comments: Fix CodeRabbit comments on this PR

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Nov 3, 2026

Copy link
Copy Markdown

@roble
roble merged commit 22640de into main Nov 3, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant