Merged
Conversation
1. Consolidate duplicate _get_prefix logic - Export _get_prefix from uplid module - sqlalchemy._extract_prefix now wraps _get_prefix 2. Add SQLAlchemy string validation on write - Validate prefix in process_bind_param before storing - Catches prefix mismatches at write time, not read time - Add tests for wrong prefix and invalid string rejection 3. Add concurrency tests - Test concurrent ID generation produces unique IDs - Test no duplicates under high contention (50 threads) - Test ordering is maintained within threads - Validates "thread-safe" claim in README 4. Soften compile-time language in docs - Change "at compile time" to "caught by type checkers" - Change "compile-time errors" to "type errors" - More accurate representation of Python's type checking Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
81142af to
1f2b877
Compare
- Add missing Literal import in README Pydantic serialization example - Add nullable to UPLIDFieldKwargs for API consistency with UPLIDColumnKwargs - Add explanatory comments for type: ignore on UUID comparison operators Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add ASCII block art logo - Lead with "Stripe-style IDs for Python" tagline - Show before/after comparison immediately - Add coverage badge - Restructure around benefits (debuggable, type-safe, time-sortable) - Add "Inspired by Stripe" callout - Condense integration examples (FastAPI 65 -> 18 lines) - Streamline API reference section Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Move common type aliases (UserId, OrgId, ApiKeyId) to conftest.py - Move common factories to conftest.py - Add shared Hypothesis strategies to conftest.py - Add pytest fixtures for SQLAlchemy/SQLModel engines - Add autouse fixture for FastAPI test cleanup - Remove duplicate imports across all test files Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Pydantic is an external dependency. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The else branch in process_bind_param only executes if SQLAlchemy passes an unexpected type (not None, UPLID, or str), which shouldn't happen in practice. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update coverage threshold from 95% to 100%. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
factory() now validates the prefix once at creation time, then uses an internal _generate_unchecked() method. This removes ~15% overhead from ID generation when using factories. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_get_prefixlogic betweenuplid.pyandsqlalchemy.pyChanges
1. Consolidate
_get_prefixExport
_get_prefixfrom the uplid module.sqlalchemy._extract_prefixnow wraps it, convertingUPLIDErrortoTypeErrorfor SQLAlchemy context.2. SQLAlchemy write validation
process_bind_paramnow validates:This catches errors at write time rather than read time.
3. Concurrency tests
test_concurrent_generation_produces_unique_ids- 10 threads × 1000 IDstest_concurrent_generation_with_different_prefixes- 6 threads with different prefixestest_concurrent_generation_maintains_ordering- ordering within threadstest_no_duplicate_uuids_under_contention- 50 threads with barrier sync4. Documentation accuracy
5. README redesign
6. Test DRY refactoring
7. Performance optimization
factory()now validates the prefix once at creation time, then uses an internal_generate_unchecked()method. This removes ~15% overhead from ID generation when using factories.Test plan
🤖 Generated with Claude Code