Skip to content

Drop LLM and Panicking; state the device scope - #3

Merged
verygoodsoftwarenotvirus merged 1 commit into
mainfrom
chore/drop-server-tier-modules
Sep 20, 2026
Merged

verygoodsoftwarenotvirus merged 1 commit into
mainfrom
chore/drop-server-tier-modules

Conversation

@verygoodsoftwarenotvirus

Copy link
Copy Markdown
Contributor

Why this PR is small

I went in expecting to cut a server tier out of this port the way the TypeScript one needed (primitives-ts#71 drops 13 packages). Auditing the modules one at a time, almost nothing qualified — Swift builds apps here and never services, so this port was already written for the device.

The audit is the valuable part of this PR; the diff is the small consequence.

What goes

Module Why
LLM AnthropicProvider + OpenAIProvider over URLSession — both need a vendor API key on the handset. Calls like these belong behind a platform-go service.
Panicking A Go-ism. Swift's failure model isn't panic/recover; the module wrapped fatalError/assertionFailure to mirror a seam Go needs and Swift doesn't.

Neither was imported by any other module — only by its own tests — so the cut is clean.

What stays, and why it looks server-shaped but isn't

These share names with packages being deleted from primitives-ts, which is exactly why they're worth calling out. Same name, different thing:

Module What it actually is
Database SQLiteDatabase — on-device SQLite. No server driver in it. The target even linkedLibrary("sqlite3").
Search SQLiteTextSearcher + InMemoryVectorIndex over that local store
Uploads URLSessionPresignedUploader, FileManagerUploader, ImageThumbnailer — the client half of presign → PUT → confirm
Capitalism StoreKitClient, StoreKitPurchaseManager, RevenueCatConfig — on-device IAP, not a secret-key payment manager
Notifications DeviceTokenBroadcaster, SystemNotificationCenterManager — receiving, where TS's providers were apns.node/fcm.node sending
Secrets KeychainSecretSource
Authentication JWT parsing + TOTP generation — a client decodes the token it was handed and generates codes; it issues and hashes nothing
HealthCheck ReachabilityChecker, DiskSpaceChecker — device health, not DB/cache/queue readiness probes

Left for a follow-up

Embeddings ships both an OnDeviceEmbedder (fine, and it's what Search's vector index feeds on) and an OpenAIEmbedder (same API-key-on-device problem as LLM). Trimming one provider out of a kept module changes its public surface, so it wants its own PR.

Verification

swift build clean · swift test — 1152 tests in 251 suites passing.

🤖 Generated with Claude Code

Swift builds apps here, never services, so the scope correction other primitives ports
need barely applies to this one. Auditing every module against "would a handset ever
construct this" left only two that fail:

- LLM — Anthropic and OpenAI URLSession clients, which require a vendor API key to sit
  on the device. Calls like these belong behind a platform-go service.
- Panicking — a Go-ism. Swift's failure model is not panic/recover, and the module
  wrapped fatalError/assertionFailure to mirror a seam Go needs and Swift does not.

Everything else stays, and deliberately: Database is SQLite on device (no server driver
in it), Search is a SQLiteTextSearcher plus an in-memory vector index over that, Uploads
is URLSession presigned upload and thumbnailing, Capitalism is StoreKit/RevenueCat,
Notifications is device tokens and UNUserNotificationCenter, Secrets is Keychain,
Authentication is JWT *parsing* and TOTP generation, HealthCheck is reachability and
disk space. None of those are the server-tier packages of the same name elsewhere.

Neither removed module was imported by any other module — only by its own tests.

Verified: swift build clean, swift test 1152 tests in 251 suites passing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@verygoodsoftwarenotvirus
verygoodsoftwarenotvirus merged commit 97f8fbc into main Sep 20, 2026
2 checks passed
@verygoodsoftwarenotvirus
verygoodsoftwarenotvirus deleted the chore/drop-server-tier-modules branch September 20, 2026 17:38
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