What
BillingPlanRepository.ListWithProducts (internal/store/postgres/billing_plan_repository.go:380) builds its SELECT with:
prd.Col("title").As("product_behavior"),
So the product_behavior column is filled from the product's title, not its behavior column. The billing_products table does have a real behavior column (migration 20231231021142_add_feature_behavior, mapped at billing_product_repository.go:52). As a result every product returned by ListPlans, GetPlan, and the new ListAllPlans reports behavior equal to its title.
The same block also sources plan_deleted_at from the product table (billing_plan_repository.go:374, prd.Col("deleted_at").As("plan_deleted_at")), which looks wrong for a plan's deleted-at and is worth reviewing at the same time.
Impact
Any consumer that reads a product's behavior from a plan listing gets the title instead of the behavior. Pre-existing; it was surfaced while reviewing the new ListAllPlans endpoint.
Fix
Select prd.Col("behavior").As("product_behavior") and review the plan_deleted_at source. Add a repository test that asserts the behavior round-trips.
What
BillingPlanRepository.ListWithProducts(internal/store/postgres/billing_plan_repository.go:380) builds its SELECT with:So the
product_behaviorcolumn is filled from the product's title, not itsbehaviorcolumn. Thebilling_productstable does have a realbehaviorcolumn (migration20231231021142_add_feature_behavior, mapped atbilling_product_repository.go:52). As a result every product returned byListPlans,GetPlan, and the newListAllPlansreportsbehaviorequal to its title.The same block also sources
plan_deleted_atfrom the product table (billing_plan_repository.go:374,prd.Col("deleted_at").As("plan_deleted_at")), which looks wrong for a plan's deleted-at and is worth reviewing at the same time.Impact
Any consumer that reads a product's
behaviorfrom a plan listing gets the title instead of the behavior. Pre-existing; it was surfaced while reviewing the newListAllPlansendpoint.Fix
Select
prd.Col("behavior").As("product_behavior")and review theplan_deleted_atsource. Add a repository test that asserts the behavior round-trips.