com-example-service-PricingService · git:20260914.8205252 · 2026-09-14 · sha256 b4b1e701327f77ed

com-example-service-PricingService git:20260914.8205252A

Immutable. This exact content never changes and is served at /api/v1/blob/b4b1e701327f77ed.

---
description: "AI rules for com.example.service.PricingService"
globs: **/PricingService.java
alwaysApply: false
---

<!-- VIBETAGS-START -->
# Rules for PricingService

## Context & Focus
- **Focus**: Optimize pricing calculations for accuracy and throughput. Internal algorithms may use any efficient approach.
- **Avoid**: Floating-point arithmetic for monetary values — use BigDecimal internally, but note that the contract-frozen signatures use double for backwards compatibility

### Rules for method calculatePrice
- **Rule**: Optimal complexity required. O(n^2) is forbidden on hot paths.
- **Constraint**: Must complete in <5ms p99. Called on every cart update.

## Contract-Frozen Signature
- **Constraint**: You may change internal logic, but MUST NOT modify the method name, parameters, return type, or checked exceptions.

### Rules for method applyPromoCode
- **Reason**: Promotions-service depends on this exact method signature for its async price-adjustment events. Changing parameter types would break the event deserialization.

### Rules for method calculatePrice
- **Reason**: Signature locked by OpenAPI v2 contract. checkout-service and mobile-app bind to this exact signature. A type change is a breaking API change.

### Rules for method getBulkPricing
- **Reason**: B2B portal contract v1.2 — the List<Map<String,Object>> structure is serialized directly to JSON. Changing the return type breaks portal parsing.
<!-- VIBETAGS-END -->