Rune-stone

AGENTS.md — Online Bookstore

Project Context

Conventions

Function Specifications

The following specs define the contracts for the order processing module.


calculate_order_total

SIGNATURE: def calculate_order_total(items: list[dict], tax_rate: float) -> float

INTENT: Calculates the total cost of an order including tax. Each item has a price and quantity. Returns the final total rounded to 2 decimal places.

BEHAVIOR:

TESTS:

EDGE_CASES:


validate_coupon

SIGNATURE: def validate_coupon(code: str, active_coupons: list[dict], current_date: str) -> tuple[bool, dict | str]

INTENT: Validates a coupon code against active coupons. Case-insensitive matching. Returns (True, coupon_data) if valid, (False, error_message) if not.

BEHAVIOR:

TESTS:

EDGE_CASES:


check_free_shipping

SIGNATURE: def check_free_shipping(subtotal: float, is_loyalty_member: bool, is_promo_period: bool = False) -> tuple[bool, str]

INTENT: Determines if an order qualifies for free shipping based on subtotal, loyalty status, and promotional period.

BEHAVIOR:

TESTS:

EDGE_CASES: