Capture the reseller examples before splitting the pricing branch
Support cannot explain why a reseller receives a different total after a harmless-looking cleanup. Recreate a small baseline: direct pricing uses list price; reseller A gets 10% off; reseller B gets 15% off only from ten units. Round the final discount down to whole cents.
- Focused work estimate
- 1h 30m + prerequisites
- Priority in the scenario
- High
- Engineering practice
- Characterization testing · Domain modeling · Tradeoff analysis
Estimated field mix
- Backend60%
- Quality engineering40%
Field percentages are editorial estimates of the ticket's engineering focus. They total 100%; they are not measured time, proficiency scores, or ownership evidence.
Pattern topics
- StrategyCompare
Compare a small function table with interchangeable pricing strategies before adding an interface to three fixed contract rules.
Review it, then add it to your workspace.
The board opens an editable draft; nothing is saved until you confirm it. Sign-in and workspace permissions apply, and Demo boards remain ephemeral.
Project context
A fictional equipment-rental service supports direct customers and two reseller contracts. Pricing now lives in a long conditional with subclasses left over from a discontinued campaign. Build a local TypeScript quoting module and synthetic fixtures; no starter repository, real charges, tax advice, or payment connection is supplied. Amounts use integer cents and the exercise supports USD only.
Setup prerequisites
- Pure functions
- Object composition
- Integer arithmetic
Preceding work
No earlier ticket is required. Complete the project setup above.
Acceptance criteria
- Record input, contract identity, quantity, list amount, discount, and final amount for each example.
- Cover quantities 1, 9, 10, and 11 plus a list amount that produces a fractional-cent discount.
- Document whether a function table or Strategy interface would make the current three rules easier to change; either is acceptable with reasons.
Implementation constraints
- Keep the baseline independent of the replacement implementation; reject non-integer quantities and negative list amounts.
Verification to include
- Check manually calculated expected totals against the baseline fixtures.
- Introduce an off-by-one tier boundary and confirm the relevant fixture fails.
Deliverables
- Characterization fixtures and a one-page abstraction decision
Rollout and recovery
Use this baseline as the comparison gate for later local changes; retain the original calculations until all differences are explained.
Value of the work
For the engineer: Practice choosing, testing, and removing object-design abstractions around versioned business rules and tenant isolation.
For the team: Review changes that let a team introduce a contract without silently changing existing quotes, together with the maintenance costs of the chosen design.
Evidence boundaries
Outcome Evidence: Tests, patches, and runbooks are requested deliverables. They become Outcome Evidence only through a qualified Mission and immutable Evidence IDs.
Ownership Evidence: Independent adaptation must be observed under a declared verification policy and cite immutable Evidence IDs. Completing a planning ticket establishes no Ownership Evidence.