• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jpedroh / last-merge / 29671372957

19 Jul 2026 03:11AM UTC coverage: 65.348% (+1.2%) from 64.125%
29671372957

push

github

web-flow
refactor: Separate matching orchestration from ordered/unordered matching algorithms (#83)

## Description

Refactor the matching module to centralize the matching calculation
logic and make ordered/unordered matching algorithms operate on subtrees
instead of complete node pairs.

## Changes

- Extract the top-level matching orchestration into a new `calculate`
module.
- `calculate_matchings` now owns the lifecycle of a matching
computation.
- Ordered and unordered matchers only calculate subtree scores and
populate discovered matchings.

- Rename the `Matches` trait to `CanMatch` to better represent its
purpose.
- The trait now exposes `can_match`, making it clear that it only checks
whether two nodes are compatible, not whether they are fully matched.

- Refactor ordered matching:
- `ordered::calculate_matchings` was replaced by
`ordered::calculate_subtree_matching`.
- The ordered matcher now returns the subtree score instead of creating
the complete `Matchings` structure.
- Root matching is now handled consistently by the top-level calculator.

- Refactor unordered matching:
  - Split unique-label matching into its own module.
  - `unordered::calculate_subtree_matching` now combines:
    - unique-label matching
    - assignment problem matching
- Assignment matching now returns only the calculated score and appends
child matchings into the shared `Matchings` instance.

- Improve `Matchings`:
  - Add capacity initialization to reduce reallocations.
  - Simplify extending and inserting matchings through `push`.
  - Prevent replacing an existing matching with a lower score.
  - Add `len` and `is_empty` helpers.

- Hide internal implementation modules (`ordered` and `unordered`) from
the public API.
  - Consumers now only interact with `matching::calculate_matchings`.

## Motivation

Previously, the matching algorithms were responsible for both:
1. calculating subtree similarities, and
2. managing the resulting matching collection.

This made the order... (continued)

115 of 152 new or added lines in 8 files covered. (75.66%)

3 existing lines in 2 files now uncovered.

1024 of 1567 relevant lines covered (65.35%)

2.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.97
/matching/src/unordered/assignment_problem.rs


Build SHA Not Found

The commit SHA "6986c1cbf5cf4cd9c93b07ea6b85b62837fdc8c7" was not found in your repository, so the file cannot be loaded. This may be because you posted from a local development environment, or your CI created an ephemeral commit.

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc