-
Notifications
You must be signed in to change notification settings - Fork 1
refactor!: restrict public items for misuse safety #227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@greptileai review this draft |
Greptile SummaryThis PR refactors the SDK's public API to prevent misuse by restricting direct field access and improving type safety. Key Changes:
Breaking Changes: This is correctly marked as a breaking change (refactor!) as it modifies the public API significantly. Users upgrading will need to:
All tests and examples have been updated to demonstrate the new patterns. Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant S2Config
participant S2
participant AccessTokenScopeInput
participant IssueAccessTokenInput
participant BatchingConfig
participant AppendSessionConfig
Note over S2Config: Field visibility changes
User->>S2Config: new(access_token)
Note over S2Config: Fields now private:<br/>access_token, endpoints,<br/>connection_timeout, etc.
S2Config-->>User: S2Config instance
Note over AccessTokenScopeInput: Renamed from AccessTokenScope
User->>AccessTokenScopeInput: from_op_group_perms(perms)
Note over AccessTokenScopeInput: Fields now private:<br/>basins, streams,<br/>access_tokens, ops
AccessTokenScopeInput-->>User: AccessTokenScopeInput instance
User->>IssueAccessTokenInput: new(id, scope)
Note over IssueAccessTokenInput: auto_prefix_streams replaced<br/>with AutoPrefixingMode enum
IssueAccessTokenInput-->>User: IssueAccessTokenInput
User->>IssueAccessTokenInput: with_auto_prefixing_mode(mode)
IssueAccessTokenInput-->>User: Updated input
User->>S2: issue_access_token(input)
S2-->>User: AccessTokenScope (output type)
Note over User: Separate input/output types<br/>prevent misuse
Note over BatchingConfig: Configuration safety
User->>BatchingConfig: new()
BatchingConfig-->>User: Default config
User->>BatchingConfig: with_max_batch_bytes(size)
Note over BatchingConfig: Fields now private,<br/>accessed through builders
BatchingConfig-->>User: Validated config
Note over AppendSessionConfig: Type safety improvements
User->>AppendSessionConfig: with_max_inflight_batches(NonZeroU32)
Note over AppendSessionConfig: NonZeroU32 prevents invalid values
AppendSessionConfig-->>User: Validated config
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
12 files reviewed, 1 comment
cf25aa2 to
1bd0615
Compare
1bd0615 to
6952782
Compare
No description provided.