Share quote assembly between the portal and nightly import
The portal and nightly CSV import each construct their own rule selector. A contract was enabled in the portal but missing from the import, producing different errors for the same customer.
- Focused work estimate
- 2h 30m + prerequisites
- Priority in the scenario
- Medium
- Engineering practice
- Composition roots · Refactoring · Contract 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
- Factory MethodCompare
Choose between an overridable creation step and an injected factory function for two workflows that must build the same pricing components.
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
- Both callers resolve the same contract revisions through one composition boundary.
- Caller-specific input parsing stays outside pricing rule creation.
- Compare an overridable Factory Method in a shared import workflow with an injected creation function; document the chosen extension boundary.
Implementation constraints
- Do not introduce dynamic module loading or a dependency-injection container for this local module.
Verification to include
- Feed equivalent portal and CSV inputs and compare rule identities, amounts, and unknown-contract errors.
- Inject a selector construction failure and confirm neither caller emits a partial quote.
Deliverables
- Shared assembly boundary and caller contract tests
Rollout and recovery
Migrate one local caller at a time with parity tests; revert caller wiring if an unexplained difference appears.
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.