Skip to content

refactor: align matcher names and regex argument order - #290

Merged
FalkWoldmann merged 1 commit into
httpmock:masterfrom
danieleades:agent/destutter-internal-names
Oct 7, 2026
Merged

FalkWoldmann merged 1 commit into
httpmock:masterfrom
danieleades:agent/destutter-internal-names

Conversation

@danieleades

@danieleades danieleades commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Matcher internals use different words for the same operations, and regex comparators take their boolean arguments in the opposite order to other string comparators. This change aligns the names and uses (case_sensitive, negated) consistently, updating all callers together.

  • Retain the Comparator suffix while standardising verbs and Json casing, including StringIncludesComparator, StringMatchesComparator and JsonEqualsComparator.
  • Rename KeyValueOperator variants to And and Implication and remove the associated lint exception.
  • Align helper and test names, correct the two tests that exercise case-insensitive matching, and remove redundant comparator banner comments.

All changes are confined to crate-private matcher code. Public APIs and matching behaviour are unchanged. This is not intended for 0.9.

The backend and HTTP client renames are deferred in draft #332, following the review comment. The two PRs are independent.

Validation: cargo +stable test --offline --all-features (142 library tests, 149 integration tests and 136 doctests passed; 4 integration tests ignored), cargo +stable clippy --offline --all-targets --all-features, and cargo +stable fmt --all -- --check.

@codecov

codecov Bot commented Aug 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.11765% with 20 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/api/backend/local.rs 57.14% 9 Missing ⚠️
src/api/backend/remote.rs 75.00% 8 Missing ⚠️
src/server/matchers/generic.rs 40.00% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@danieleades
danieleades marked this pull request as draft August 13, 2026 12:28
@danieleades
danieleades force-pushed the agent/destutter-internal-names branch from 19e874f to 979fc8d Compare August 14, 2026 06:15
@danieleades danieleades changed the title breaking: name types without repeating their module path breaking: hide matcher internals and simplify internal names Aug 14, 2026
@danieleades
danieleades force-pushed the agent/destutter-internal-names branch 4 times, most recently from af4b76f to 00fea4c Compare August 16, 2026 12:46
@danieleades
danieleades marked this pull request as ready for review August 16, 2026 14:07
@danieleades
danieleades force-pushed the agent/destutter-internal-names branch from 00fea4c to 01194c0 Compare August 17, 2026 18:48
@danieleades
danieleades force-pushed the agent/destutter-internal-names branch from 25be21f to 75758f0 Compare September 20, 2026 14:09
@FalkWoldmann

Copy link
Copy Markdown
Member

@alexliesenfeld i really like these changes but since it's a rather big change, what do u think about it?

@danieleades
danieleades force-pushed the agent/destutter-internal-names branch from 75758f0 to f6f003e Compare September 20, 2026 15:36
@alexliesenfeld

Copy link
Copy Markdown
Member

I think this PR removes a bit too much context and speaking names may become question marks in certain contexts. suppose somebody imports the data structures and a reference to the mock server is "Remote". In our context it makes sense, but in the context of the using file, maybe not so much.

I'd say this is a somewhat opinionated change, I'm probably a bit old-school in this regard and would stick to our naming if possible.

I like the visibility changes though. Do you think we can revert the names?

@danieleades

Copy link
Copy Markdown
Contributor Author

I think this PR removes a bit too much context and speaking names may become question marks in certain contexts. suppose somebody imports the data structures and a reference to the mock server is "Remote". In our context it makes sense, but in the context of the using file, maybe not so much.

I'd say this is a somewhat opinionated change, I'm probably a bit old-school in this regard and would stick to our naming if possible.

I like the visibility changes though. Do you think we can revert the names?

I'll split the PRs. the visibility change should land regardless, I can leave the naming conventions PR open for discussion and review whether all the names used make sense in context and are appropriately qualified. Will stack that on the visibility PR

@danieleades
danieleades force-pushed the agent/destutter-internal-names branch from f6f003e to 5c10550 Compare September 23, 2026 12:08
@danieleades danieleades changed the title breaking: hide matcher internals and simplify internal names refactor: simplify and qualify internal names Sep 23, 2026
@danieleades
danieleades force-pushed the agent/destutter-internal-names branch 3 times, most recently from c6a3e52 to b1b50da Compare September 30, 2026 07:37
@FalkWoldmann

Copy link
Copy Markdown
Member

Thanks for splitting out #312, that one's in. For the rest I'd keep this out of 0.9 since it's all crate-private anyway. I'd happily take the matcher side though: the unified verbs, Json casing, And/Implication, the regex arg order and the test name fixes. Could you keep the Comparator suffix on those and drop the backend and http client renames for now? I have some changes to those internals in the works that touch the same lines, and Alex prefers the longer names there. Happy to look at common::http_client again after that.

@danieleades
danieleades force-pushed the agent/destutter-internal-names branch from b1b50da to b77b9b3 Compare October 6, 2026 12:13
@danieleades danieleades changed the title refactor: simplify and qualify internal names refactor: align matcher names and regex argument order Oct 6, 2026
@danieleades

danieleades commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor Author

I've narrowed this to the matcher changes and kept the Comparator suffix. The backend and HTTP client renames are now in draft #332 for later

@FalkWoldmann

Copy link
Copy Markdown
Member

thanks!

@FalkWoldmann
FalkWoldmann merged commit 02f5ed2 into httpmock:master Oct 7, 2026
13 checks passed
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.

3 participants