Skip to content

Remove Identifiers; Fake.xid() becomes a seeded opaqueID() - #6

Merged
verygoodsoftwarenotvirus merged 1 commit into
mainfrom
chore/remove-identifiers
Sep 20, 2026
Merged

verygoodsoftwarenotvirus merged 1 commit into
mainfrom
chore/remove-identifiers

Conversation

@verygoodsoftwarenotvirus

Copy link
Copy Markdown
Contributor

Closes #5.

Why

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 you proves nothing. So identifiers stays a primitives-go package 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()

Fake was the only consumer, two call sites behind a public xid(). 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:

  • 20 lowercase base32-hex characters — the right shape for test data.
  • No timestamp, no machine identity, no parsing. It is a plausible stand-in for an ID the server would have sent, not an xid.
  • Drawn entirely from the seeded source. The old xid() was documented as not seed-reproducible (FakeGenerator's type-level docs called it out by name); opaqueID() is. That doc block is updated, and FakeTests' reproducibility case now calls opaqueID() 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.swift still declared name: "platform-swift" while README.md — updated in #3 — already told consumers package: "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 build clean · swift test 1133 tests in 246 suites passing (1152 before, minus the 19 IdentifiersTests).

🤖 Generated with Claude Code

…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>
@verygoodsoftwarenotvirus
verygoodsoftwarenotvirus merged commit 056c0ce into main Sep 20, 2026
2 checks passed
@verygoodsoftwarenotvirus
verygoodsoftwarenotvirus deleted the chore/remove-identifiers branch September 20, 2026 23:26
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.

Identifiers: remove it, and decide what Fake.xid() becomes

1 participant