Repository navigation
Remove Identifiers; Fake.xid() becomes a seeded opaqueID() - #6
Merged
Merged
Conversation
…eID() primitives-conformance turned up that the four ports disagree on what `identifiers` means. Swift was the port that *agreed*: XID.swift is a real hand-written xid — 12 raw bytes, machine ID, timestamp encoding — and Tests/IdentifiersTests/XIDInteropTests.swift existed specifically to check it against Go's. It passed. Agreeing with Go by accident is still not a reason to carry a reimplementation of Go's ID format on a handset. A client has no business generating a server's identifiers: the server issues them, the client receives opaque strings, and validating an ID the server just sent proves nothing. So `identifiers` stays a primitives-go package and this port drops it, along with kt and ts. Fake was the only consumer, behind a public xid(). It becomes opaqueID(): 20 lowercase base32-hex characters, the right *shape* for test data, carrying no timestamp and no machine identity and parsing nothing. It is drawn entirely from the seeded source, so unlike the xid() it replaces — which the type's own documentation called out as not seed-reproducible — a seeded FakeGenerator now reproduces it. FakeTests' reproducibility case exercises that rather than taking it on faith. Also fixes a leftover from the rename: Package.swift still declared `name: "platform-swift"` while README.md already told consumers `package: "primitives-swift"`. Verified: swift build clean, swift test 1133 tests in 246 suites passing (1152 before, minus the 19 IdentifiersTests). Closes #5 Co-Authored-By: Claude Opus 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.
Closes #5.
Why
primitives-conformanceturned up that the four ports disagree on whatidentifiersmeans. Swift was the port that agreed —XID.swiftis a real hand-written xid (12 raw bytes, machine ID, timestamp encoding), andTests/IdentifiersTests/XIDInteropTests.swiftexisted specifically to check it against Go's. It passed.Agreeing with Go by accident is still not a reason to carry a reimplementation of Go's ID format on a handset. A client has no business generating a server's identifiers — the server issues them, the client receives opaque strings, and validating an ID the server just sent you proves nothing. So
identifiersstays aprimitives-gopackage and all three non-Go ports drop it (ts: primitives-ts#76, kt: primitives-kt#9).That an interop test suite already existed for this is the tell: the concern was live, and the answer was to keep two implementations in lockstep forever rather than to ask whether the second one should exist.
Fake.xid()→Fake.opaqueID()Fakewas the only consumer, two call sites behind a publicxid(). A fake ID that looks like a server ID is genuinely useful in a client's tests, so the capability stays and the semantics go:xid()was documented as not seed-reproducible (FakeGenerator's type-level docs called it out by name);opaqueID()is. That doc block is updated, andFakeTests' reproducibility case now callsopaqueID()so the claim is exercised rather than asserted — it wasn't in that test before.This is option 1 from #5. Option 2 (delete it outright) would push every test that wanted an ID-shaped value into hand-rolling one.
Also in here
Package.swiftstill declaredname: "platform-swift"whileREADME.md— updated in #3 — already told consumerspackage: "primitives-swift". One line, a leftover from the rename, fixed here because leaving a manifest and its README disagreeing is worse than the small scope creep. Say the word if you'd rather it went separately.Verification
swift buildclean ·swift test1133 tests in 246 suites passing (1152 before, minus the 19IdentifiersTests).🤖 Generated with Claude Code