Skip to content

Move back to default price#694

Draft
epompeii wants to merge 1 commit intodevelfrom
u/ep/default-price
Draft

Move back to default price#694
epompeii wants to merge 1 commit intodevelfrom
u/ep/default-price

Conversation

@epompeii
Copy link
Member

@epompeii epompeii commented Mar 11, 2026

The stopgap implementation of handling multiple Stripe subscription prices (#690) is no longer needed now that we've moved over to the usage-based meters (#689).
This changeset removes the metrics prices and the preferred price selection.

This PR is in draft until the migration is complete at the end of all billing cycles.

@github-actions
Copy link

🤖 Claude Code Review

PR: #694
Base: devel
Head: u/ep/default-price
Commit: 051ef9af16f6aff8e7921cc217700fe9a23ff5ef


Here's my review:


PR Review: default_price (051ef9a)

Summary

This PR removes the metered billing migration scaffolding that was introduced in #689 (Stripe usage-based meters). It consolidates the "default" and "metrics" price entries into a single "default" entry per product tier and removes the filter_subscription_items / preferred_price_ids methods that were only needed during the transition period.

Assessment: Looks Good

This is a clean removal of temporary migration code. The changes are well-scoped and consistent.

Potential Concern

Risk of breakage if migration isn't complete: The filter_subscription_items method existed to handle subscriptions that still have both old and new price items. By removing it, get_subscription_item (biller.rs:568) now receives the raw subscription.items.data directly and will return BillingError::MultipleSubscriptionItems if a subscription still has more than one item. If any live Stripe subscriptions haven't been migrated yet (i.e., still have both the old "default" and new "metrics" subscription items), this will start erroring at runtime. Confirm that all existing subscriptions have been cleaned up in Stripe before deploying.

Code Quality

  • Unused imports (HashSet, PriceId, DEFAULT_PRICE_NAME, METRICS_METER_EVENT_NAME) are properly removed
  • The BillingError::NoMatchingSubscriptionItem variant is correctly removed from error.rs
  • Tests are updated consistently: migration-specific filter tests deleted, remaining tests now use DEFAULT_PRICE_NAME instead of METRICS_METER_EVENT_NAME
  • Test data simplified from two metered entries per product to one, matching the new config shape
  • No dead code left behind

No Issues Found With

  • Security: No concerns; this is internal billing plumbing with no new external inputs
  • Performance: Slight improvement — removes an unnecessary HashSet allocation and filtering pass
  • CLAUDE.md compliance: No lint suppressions added, thiserror used for errors, strong types throughout

Model: claude-opus-4-6

@epompeii epompeii marked this pull request as draft March 11, 2026 02:45
@github-actions
Copy link

🐰 Bencher Report

Branchu/ep/default-price
Testbedubuntu-22.04
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
microseconds (µs)
(Result Δ%)
Upper Boundary
microseconds (µs)
(Limit %)
Adapter::Json📈 view plot
🚷 view threshold
3.67 µs
(+8.26%)Baseline: 3.39 µs
4.59 µs
(79.91%)
Adapter::Magic (JSON)📈 view plot
🚷 view threshold
3.66 µs
(+8.13%)Baseline: 3.38 µs
4.51 µs
(81.05%)
Adapter::Magic (Rust)📈 view plot
🚷 view threshold
25.83 µs
(+0.80%)Baseline: 25.62 µs
30.81 µs
(83.83%)
Adapter::Rust📈 view plot
🚷 view threshold
2.83 µs
(-0.70%)Baseline: 2.85 µs
3.34 µs
(84.52%)
Adapter::RustBench📈 view plot
🚷 view threshold
2.86 µs
(+0.50%)Baseline: 2.84 µs
3.32 µs
(86.03%)
head_version_insert/batch/10📈 view plot
🚷 view threshold
106.03 µs
(+6.59%)Baseline: 99.48 µs
123.53 µs
(85.83%)
head_version_insert/batch/100📈 view plot
🚷 view threshold
242.58 µs
(+2.65%)Baseline: 236.31 µs
269.29 µs
(90.08%)
head_version_insert/batch/255📈 view plot
🚷 view threshold
462.04 µs
(+0.55%)Baseline: 459.51 µs
489.08 µs
(94.47%)
head_version_insert/batch/50📈 view plot
🚷 view threshold
163.81 µs
(+2.59%)Baseline: 159.67 µs
185.38 µs
(88.36%)
threshold_query/join/10📈 view plot
🚷 view threshold
149.87 µs
(+4.83%)Baseline: 142.97 µs
170.46 µs
(87.92%)
threshold_query/join/20📈 view plot
🚷 view threshold
165.51 µs
(+5.36%)Baseline: 157.08 µs
185.47 µs
(89.24%)
threshold_query/join/5📈 view plot
🚷 view threshold
139.63 µs
(+3.30%)Baseline: 135.16 µs
160.49 µs
(87.00%)
threshold_query/join/50📈 view plot
🚷 view threshold
201.61 µs
(+1.84%)Baseline: 197.97 µs
228.38 µs
(88.28%)
🐰 View full continuous benchmarking report in Bencher

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant