Skip to content

Refactor Phase 4B: Core Buisness/Trips - #55

Closed
1mimhe wants to merge 5 commits into
masterfrom
refactor/phase-4-trip
Closed

1mimhe wants to merge 5 commits into
masterfrom
refactor/phase-4-trip

Conversation

@1mimhe

@1mimhe 1mimhe commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Phase 4 core-business pricing refactor:

- pricing.engine.ts: pure pipeline extracted verbatim from the legacy PricingService (identical arithmetic order and float behavior).

- strategies/: distance-tier, weight, special-handling, city-premium, deviation-cost, earnings + pricing-factory wiring all PRICING_* config.

- B-10 fix: tier capacities derive from cumulative bounds (upToKm - previousUpToKm) with no hand-tuned +1 constant; proven byte-identical to legacy output by a 500-check parity harness against the golden capture.

- pricing.service.ts: slim DI facade preserving the public API consumed by package.service (calculateSuggestedPrice / calculateTransporterEarnings / calculateDeviationCost / calculateDistanceCost).

- Table-driven specs per strategy + golden-equality engine spec (default variant, bit-exact floats) + facade spec.

Verification: tsc clean; full suite 53/53 suites, 401/401 tests; pricing 9/9 suites, 91/91 tests.
…yzer with parity specs

- Add pure MatchingScorer, buildTripCandidateWhere and CorridorAnalyzer
  under src/modules/package/matching/ (moved verbatim, no behavior change)
- Slim MatchingService to orchestration: delegates scoring/analysis,
  Nest Logger instead of console.error, ConfigKey.Pricing.CorridorWidth
- Fix TurfService console.error -> Logger (fallback path now covered)
- Add table-driven specs + match fixtures; extend matching.service.spec
  (Logger skip, ConfigKey read/default, default-param paths)

Verification: tsc clean, 56 suites / 437 tests green, scoped eslint 0 errors.
No API-visible change (BREAKING 4.0 stands).
@1mimhe 1mimhe closed this Oct 3, 2026
@1mimhe
1mimhe deleted the refactor/phase-4-trip branch October 4, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant