Skip to content

Harden pattern dispatch and error contracts for 3.1 - #151

Merged
mxsm merged 1 commit into
mainfrom
mxsm/api-contract-hardening-3.1
Aug 12, 2026
Merged

Harden pattern dispatch and error contracts for 3.1#151
mxsm merged 1 commit into
mainfrom
mxsm/api-contract-hardening-3.1

Conversation

@mxsm

@mxsm mxsm commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • route starts_with, ends_with, and contains through a private sealed pattern classifier
  • retain StrPattern::as_str_pattern and its dispatch value as unchanged 3.1 compatibility surfaces
  • add downstream-style contracts for char, &str, &String, constructor errors, substring errors, display, and source chaining
  • document the exact pattern and error matrix in root API.md
  • add a pinned API compatibility workflow that applies minor-release semver rules against origin/main
  • correct stale packed-migration wording now that the stable immutable value has a safe 24-byte layout

Compatibility

  • no existing public method, trait, enum variant, type alias, or return type is removed, renamed, deprecated, or changed
  • cargo-semver-checks passed 196 checks against origin/main; no semver update is required
  • targets CheetahString 3.1.0 with Rust 1.95 MSRV
  • no files under docs/ or docs/rocketmq-doc are included

Verification

  • format, clippy, all-feature and no-default test matrices
  • 32 doctests, including the external sealed-trait compile-fail contract
  • warning-free default/all-feature rustdoc with 100% public item and example coverage
  • Rust 1.95 direct API test and packaged consumer matrix
  • Miri core/API/basic/bytes suites
  • all fuzz targets build on nightly
  • cargo audit, actionlint, Python repository contracts, package content audit
  • cargo-semver-checks minor-release comparison

Closes #150

Copilot AI lite review requested due to automatic review settings August 12, 2026 08:52
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@mxsm, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 50 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
鈿欙笍 Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 50bd1350-166c-47ee-be05-3c60c221dc46

馃摜 Commits

Reviewing files that changed from the base of the PR and between 74c4293 and da5df60.

馃搾 Files selected for processing (9)
  • .github/workflows/api-compatibility.yml
  • API.md
  • CHANGELOG.md
  • README.md
  • scripts/tests/test_repository_contracts.py
  • src/cheetah_string/pattern.rs
  • src/cheetah_string/query.rs
  • src/error.rs
  • tests/api_contract.rs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

鉂わ笍 Share

Comment @coderabbitai help to get the list of available commands.

@mxsm
mxsm merged commit 300b313 into main Aug 12, 2026
18 checks passed
@mxsm
mxsm deleted the mxsm/api-contract-hardening-3.1 branch August 12, 2026 08:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Hardens the internal pattern-dispatch implementation and codifies 3.1-compatible error/pattern contracts, including documentation and CI enforcement.

Changes:

  • Route starts_with / ends_with / contains through a private classifier while keeping StrPattern::as_str_pattern + StrPatternImpl as compatibility shims.
  • Add downstream-style contract tests for pattern dispatch and error signature/display/source behavior.
  • Introduce API compatibility documentation and a GitHub Actions workflow that gates minor-release semver compatibility vs origin/main.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/api_contract.rs Adds integration tests that lock in downstream-callable compatibility surfaces and error contracts.
src/error.rs Updates Error docs to clarify 3.1 compatibility and Utf8Error wrapping behavior.
src/cheetah_string/query.rs Switches query methods to use the new private pattern classifier.
src/cheetah_string/pattern.rs Introduces classifier enum + sealed classification method; keeps as_str_pattern/StrPatternImpl as a shim.
scripts/tests/test_repository_contracts.py Enforces repository-level contracts around private dispatch and pinned semver workflow semantics.
README.md Updates migration wording to reflect the safe 24-byte layout status.
CHANGELOG.md Notes the dispatch hardening and compatibility workflow additions; updates migration wording.
API.md Documents the exact pattern + error contract matrix and local reproduction steps.
.github/workflows/api-compatibility.yml Adds a pinned workflow that runs cargo-semver-checks against origin/main under minor rules.

馃挕 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +4 to +7
pub enum StrPatternKind<'a> {
Char(char),
Str(&'a str),
}
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.

Harden pattern dispatch and error contracts for 3.1

2 participants