Skip to content

chore: add #[non_exhaustive] and mutation methods to improve compatibility#715

Merged
alexhancock merged 4 commits intomainfrom
jamadeo/v1.0-changes
Mar 3, 2026
Merged

chore: add #[non_exhaustive] and mutation methods to improve compatibility#715
alexhancock merged 4 commits intomainfrom
jamadeo/v1.0-changes

Conversation

@jamadeo
Copy link
Contributor

@jamadeo jamadeo commented Mar 2, 2026

In preparation for a 1.0 release, we should use #[non_exaustive] for most public structs/enums to help reduce backwards-incompatible changes.

While we don't foresee being strict with the semver guidelines, we should aim to keep backwards compatibility as much as possible between minor releases.

Motivation and Context

This will prevent clients from writing code that will break and require updates in future versions.

How Has This Been Tested?

Breaking Changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@jamadeo jamadeo requested a review from a team as a code owner March 2, 2026 20:53
@github-actions github-actions bot added T-documentation Documentation improvements T-test Testing related changes T-core Core library changes T-examples Example code changes T-macros Macro changes T-model Model/data structure changes T-service Service layer changes T-transport Transport layer changes labels Mar 2, 2026
alexhancock
alexhancock previously approved these changes Mar 2, 2026
@github-actions github-actions bot added T-dependencies Dependencies related changes T-config Configuration file changes labels Mar 3, 2026
@jamadeo jamadeo changed the title chore: add #[non_exhaustive] to most public structs/some public enums chore: bump to 1.0.0-alpha, add #[non_exhaustive] and mutation methods to improve compatibility Mar 3, 2026
@alexhancock alexhancock self-requested a review March 3, 2026 15:17
alexhancock
alexhancock previously approved these changes Mar 3, 2026
@jamadeo jamadeo force-pushed the jamadeo/v1.0-changes branch from d447ed7 to 3cad234 Compare March 3, 2026 15:30
@github-actions github-actions bot removed T-dependencies Dependencies related changes T-config Configuration file changes labels Mar 3, 2026
@jamadeo jamadeo changed the title chore: bump to 1.0.0-alpha, add #[non_exhaustive] and mutation methods to improve compatibility chore: add #[non_exhaustive] and mutation methods to improve compatibility Mar 3, 2026
@alexhancock alexhancock self-requested a review March 3, 2026 15:32
@alexhancock alexhancock merged commit f63718d into main Mar 3, 2026
16 checks passed
@alexhancock alexhancock deleted the jamadeo/v1.0-changes branch March 3, 2026 15:38
Comment on lines +1459 to +1466
pub fn with_logger(level: LoggingLevel, logger: impl Into<String>, data: Value) -> Self {
Self {
level,
logger: Some(logger.into()),
data,
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

The with_ prefix means "take ownership of self, set a fieThe with_ prefix means "take ownership of self, set a field, and return self." When callers look at the method list, they'll expect to see new().with_logger("name") chaining. I suggest we stick to the conventional build pattern here.

Suggested change
pub fn with_logger(level: LoggingLevel, logger: impl Into<String>, data: Value) -> Self {
Self {
level,
logger: Some(logger.into()),
data,
}
}
}
pub fn with_logger(mut self, logger: impl Into<String>) -> Self {
self.logger = Some(logger.into());
self
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@DaleSeo I agree. I think most of them follow this pattern you're suggesting, and we should keep it consistent

Copy link
Member

Choose a reason for hiding this comment

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

@jamadeo Quick follow-up: #720

This was referenced Mar 3, 2026
@DaleSeo DaleSeo mentioned this pull request Mar 3, 2026
9 tasks
@github-actions github-actions bot mentioned this pull request Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-core Core library changes T-documentation Documentation improvements T-examples Example code changes T-macros Macro changes T-model Model/data structure changes T-service Service layer changes T-test Testing related changes T-transport Transport layer changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants