not->toBeFalse(); expect($content)->toContain('recordFixedPricingVersion('); expect($content)->toContain('closeActiveFixedPricingVersion('); expect($content)->toContain('recordVehicleSubscriptionVersion('); expect($content)->toContain('closeActiveVehicleSubscriptionVersion('); expect($content)->toContain('recordDiscountOverrideVersion('); }); it('closes previous active interval before inserting a new version', function (): void { $serviceFile = app_path('classes/economic_v2_versioning_service.php'); $content = file_get_contents($serviceFile); expect($content)->not->toBeFalse(); expect($content)->toContain('AND effective_from <'); expect($content)->toContain('AND (effective_to IS NULL OR effective_to >='); expect($content)->toContain('minusOneSecond('); }); it('includes best-effort backfill with provenance and confidence metadata', function (): void { $serviceFile = app_path('classes/economic_v2_versioning_service.php'); $content = file_get_contents($serviceFile); expect($content)->not->toBeFalse(); expect($content)->toContain('runBestEffortBackfill('); expect($content)->toContain('backfill.current_fixed_pricing'); expect($content)->toContain('backfill.current_vehicle'); expect($content)->toContain('backfill.current_discount_override'); expect($content)->toContain("'inferred' =>"); }); it('anchors historical resolution on order created_at timestamps in distribution service', function (): void { $serviceFile = app_path('classes/economic_v2_distribution_service.php'); $content = file_get_contents($serviceFile); expect($content)->not->toBeFalse(); expect($content)->toContain('resolveFixedPricingVersionAt($customer_number, $created_at)'); expect($content)->toContain('resolveVehicleSubscriptionVersionsAt($customer_number, $created_at)'); expect($content)->toContain('resolveDiscountForProduct($customer_number, $product_id, $created_at)'); });