Cleanup: shared MatchScorer + remove dead import code (follow-up to #494)#498
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Follow-up cleanup to the dive-matching / file-import consolidation work (#494) that removes unreachable UDDF import code paths and consolidates fuzzy-matching scoring into a shared, config-driven scorer to keep file-import and download matching consistent.
Changes:
- Removed unused/obsolete parameters in duplicate detection and updated affected tests.
- Deleted dead standalone UDDF import providers/widgets and the orphaned universal-import “review/consolidation” UI subtree, along with their tests.
- Introduced
MatchScorer+bandScoreas shared matching primitives and refactored both matchers to delegate to the shared scorer (behavior preserved via existing + new tests).
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/features/universal_import/presentation/providers/universal_import_notifier_test.dart | Removes tests for deleted notifier behaviors (dive-resolution + performImport subtree). |
| test/features/universal_import/data/models/import_enums_test.dart | Removes tests for deleted DiveDuplicateResolution. |
| test/features/dive_import/presentation/widgets/uddf_entity_card_test.dart | Deletes tests for removed dead UDDF import UI widget. |
| test/features/dive_import/presentation/providers/uddf_import_providers_test.dart | Deletes tests for removed dead UDDF import provider/notifier flow. |
| test/features/dive_import/data/services/uddf_parser_service_test.dart | Deletes tests for removed dead UDDF parser wrapper service. |
| test/features/dive_import/data/services/uddf_duplicate_checker_test.dart | Deletes tests for removed dead UDDF duplicate checker. |
| test/features/dive_computer/data/services/dive_import_service_test.dart | Updates mocks/expectations for removed fingerprint argument. |
| test/core/matching/match_scorer_test.dart | Adds focused unit coverage for shared scoring primitives and gating behavior. |
| lib/features/universal_import/presentation/widgets/import_review_step.dart | Deletes unreachable/orphaned universal-import review UI step. |
| lib/features/universal_import/presentation/widgets/import_dive_card.dart | Deletes unreachable/orphaned dive review card UI. |
| lib/features/universal_import/presentation/providers/universal_import_state.dart | Removes diveResolutions from state now that the UI/flow is gone. |
| lib/features/universal_import/presentation/providers/universal_import_providers.dart | Removes dead performImport + resolution logic and related unused imports. |
| lib/features/universal_import/data/services/import_duplicate_checker.dart | Updates doc comment to avoid referencing deleted UDDF checker. |
| lib/features/universal_import/data/models/import_enums.dart | Removes the unused DiveDuplicateResolution enum. |
| lib/features/dive_log/data/repositories/dive_computer_repository_impl.dart | Refactors download-side match scoring to use shared MatchScorer. |
| lib/features/dive_import/presentation/widgets/uddf_entity_card.dart | Deletes dead UDDF import UI widget implementation. |
| lib/features/dive_import/presentation/providers/uddf_import_providers.dart | Deletes dead standalone UDDF import provider/notifier implementation. |
| lib/features/dive_import/domain/services/dive_matcher.dart | Refactors file-import matcher to use shared MatchScorer with time gating preserved. |
| lib/features/dive_import/data/services/uddf_parser_service.dart | Deletes dead UDDF parser wrapper service. |
| lib/features/dive_import/data/services/uddf_duplicate_checker.dart | Deletes dead UDDF duplicate checker implementation. |
| lib/features/dive_computer/data/services/dive_import_service.dart | Removes unused depthTolerance param and stops passing removed fingerprint. |
| lib/core/matching/match_scorer.dart | Adds shared scorer implementation (bandScore + MatchScorer). |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #494, addressing the four tech-debt items surfaced while investigating the dive-matching / file-import-consolidation work. Pure cleanup + one behavior-preserving refactor — no user-facing behavior change.
1. Remove inert matcher params (
7a71b3a)findMatchingDiveWithScoredeclared afingerprintparam it never read (fingerprint matching happens upstream indetectDuplicate), anddetectDuplicatedeclared an unuseddepthTolerance. Removed both (one real call site; zero fordepthTolerance).2. Remove the dead standalone UDDF import path (
3364373)uddf_import_providers.dart+UddfDuplicateChecker+UddfParserService+UddfEntityCardwere unreachable — no route, page, or menu action mounts them; the live file-import path isUniversalAdapter. Deleted the 4 files + their 4 tests. (UddfEntityImporter, which the live path does use, is kept.)3. Remove orphaned file-import consolidation UI (
eeb783c)The old standalone universal wizard's review path (
ImportReviewStep,ImportDiveCard,UniversalImportNotifier.performImport+ helpers, thediveResolutionsstate field, and theDiveDuplicateResolutionenum) is superseded by the liveUniversalAdapter. Removed it and its tests.performConsolidationsis kept — it is now live viaUniversalAdapter(from #494).UniversalImportNotifieritself stays (the adapter reads its state); only the deadperformImportsubtree was removed.4. Extract a shared
MatchScorer(a12fa71)The two matchers (file-import
DiveMatcher, downloadfindMatchingDiveWithScore) had duplicated, subtly-divergent scoring logic. Every sub-score is a linear falloff, so this introduces a singlebandScore(value, full, zero)primitive + aMatchScorerconfig (lib/core/matching/match_scorer.dart), and both matchers now delegate to it with their own weights / breakpoints / units:gateOnZeroTime: trueBehavior-preserving: each matcher's existing tests pass unchanged; missing-data defaults and the percent-depth guard are expressed as caller-side sentinels (
0→ 1.0 via afull: 0band;infinity→ 0.0). The misleading download-matcher comments ("within 0.5 m = 100%") are gone with the inline math.Testing
flutter analyzeclean (whole project);dart formatclean.match_scorer_test.dartcoversbandScore+MatchScorer(weights, gate, sentinels).