noCV
PPOLICY-105 · Support controlled variation

Keep calculation and explanation revisions in the same contract family

Practice briefBugAdvanced

A quote calculated with reseller C revision 2 displays revision 1 explanation text, which omits the cap. Separate registries allow a valid calculator to be paired with an incompatible explainer.

Focused work estimate
3h 30m + prerequisites
Priority in the scenario
High
Engineering practice
Abstract factories · Version compatibility · Invariant testing

Estimated field mix

  • Backend60%
  • System design40%

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

  • Abstract FactoryCompare

    Keep the calculator and explainer revision-compatible as a family while evaluating whether a factory interface adds value beyond an immutable record.

Your next step

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

Complete these dependencies, or supply their agreed outputs before taking this ticket.

Acceptance criteria

  • Resolve calculator and structured explainer as one contract family with a shared revision identity.
  • Reject a family whose members declare different revisions before serving a quote.
  • Compare an Abstract Factory with one immutable family record; preserve independent tests for calculation and explanation.

Implementation constraints

  • Explanation output must use the actual calculation breakdown rather than recalculating the discount or parsing a display string.

Verification to include

  • Generate explanations for capped and uncapped quotes and reconcile every reported amount.
  • Deliberately pair revision 2 calculation with revision 1 explanation and assert assembly rejection.

Deliverables

  • Contract-family resolver, mismatch fixture, and design comparison

Rollout and recovery

Run family validation at local startup; keep the prior complete family available rather than rolling back individual members.

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.