Skip to content

Unify TypeID validation boundaries and API contracts - #1

Merged
jewei merged 2 commits into
mainfrom
fix/api-contract-hardening
Aug 12, 2026
Merged

jewei merged 2 commits into
mainfrom
fix/api-contract-hardening

Conversation

@jewei

@jewei jewei commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • Caller-invalid input now always throws ValidationException (InvalidArgumentException), including fromString. ConstructorException is reserved for UUID generation failures.
  • Native serialize/unserialize re-validates invariants; corrupt payloads are rejected.
  • Bytes path uses Base32::encodeBytes / decodeBytes (no ramsey round-trip). Removed hasSuffix() and dead isValidUuidv7. Exception messages truncate and escape rejected values. Added K-sortable generate coverage.

Test plan

  • composer test (127 tests, 6203 assertions)
  • vendor/bin/pint --test
  • Confirm Packagist consumers catching ConstructorException on parse paths update to ValidationException / InvalidArgumentException

jewei added 2 commits August 12, 2026 11:50
Route all caller-invalid data through ValidationException, preserve value-object invariants during unserialization, and make raw bytes the Base32 conversion core.
Restore the Base32 bit-layout map (needed to maintain the unrolled encoder),
assert unpack failures, and give mute Pest datasets named keys.
@jewei
jewei merged commit dffa309 into main Aug 12, 2026
10 checks passed
@jewei
jewei deleted the fix/api-contract-hardening branch August 12, 2026 06:36
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.

1 participant