Skip to content

chore(feature flags): code review follow-ups (documentation and bug fixes)#56

Merged
dmarticus merged 9 commits intomainfrom
dmarticus/code-review-followups
Jan 30, 2026
Merged

chore(feature flags): code review follow-ups (documentation and bug fixes)#56
dmarticus merged 9 commits intomainfrom
dmarticus/code-review-followups

Conversation

@dmarticus
Copy link
Contributor

Summary

Code review follow-ups from PR #36 (the one where I added feature flags support). This PR addresses quick wins that don't require significant refactoring:

  • Fixed poisoned mutex handling - Use .ok()? instead of .unwrap() in regex cache to gracefully handle poisoned mutexes
  • Added Clone to LocalEvaluator - Enables more flexible usage patterns
  • Added comprehensive doc comments - Documented all public types including FlagValue, FeatureFlag, FeatureFlagFilters, Property, LocalEvaluationResponse, Cohort, FlagCache, LocalEvaluationConfig, FlagPoller, AsyncFlagPoller, LocalEvaluator, Error, ClientOptions, FlagDetail, FlagReason, FlagMetadata, FeatureFlagsResponse, hash_key, and get_matching_variant
  • Added error handling examples to README - Three patterns: match on error type, unwrap_or for defaults, and ? propagation
  • Added date parsing edge case tests - Tests for empty strings, missing units, invalid formats, and large values

dmarticus and others added 8 commits January 29, 2026 15:46
- Add Clone derive to LocalEvaluator for flexibility
- Handle poisoned mutex gracefully in regex cache (use lock().ok()?)
- Add date parsing edge case tests (empty strings, malformed dates, large values)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Documents FlagValue, InconclusiveMatchError, FeatureFlag, FeatureFlagFilters,
FeatureFlagCondition, Property, MultivariateFilter, and MultivariateVariant.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Shows three patterns for handling errors:
1. Full match on error types
2. unwrap_or for simple defaults
3. Propagating errors with ?

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Document LocalEvaluationResponse, Cohort, FlagCache,
LocalEvaluationConfig, FlagPoller, AsyncFlagPoller,
and LocalEvaluator with rustdoc comments.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Document all Error variants and add module-level documentation
to ClientOptions with usage examples.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Document the flag evaluation detail types with field-level
documentation explaining each property's purpose.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Document the response enum variants and the hash_key and
get_matching_variant functions used for flag bucketing.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Replace "under development" notice with a proper introduction
listing the SDK's capabilities.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@dmarticus dmarticus changed the title chore(feature flags): code review follow-ups – documentation and bug fixes chore(feature flags): code review follow-ups (documentation and bug fixes) Jan 30, 2026
Copy link

@haacked haacked left a comment

Choose a reason for hiding this comment

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

Nice!

Address Phil's code review feedback:
- Log warning when regex cache mutex is poisoned instead of silently
  returning None
- Add tests verifying `regex` returns false for invalid patterns
- Add tests verifying `not_regex` returns true for invalid patterns

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@dmarticus dmarticus merged commit aa86459 into main Jan 30, 2026
8 checks passed
@dmarticus dmarticus deleted the dmarticus/code-review-followups branch January 30, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants