Repository navigation
Stoic 0.4.0
Pre-releaseStoic 0.4.0 adds downloads, sealed storage, and settings files people edit by hand, each driven by what Lodestar needed.
New libraries
-
StoicDownloads (design/23). Resumable, verified, durable file downloads. Bodies stream with backpressure on Apple platforms. Digests (SHA-256 or git-blob SHA-1) are checked while the bytes arrive, not in a second pass. A resume carries an
If-Rangevalidator, and the retry schedule resets whenever bytes arrive. The finished file is placed with fsync, rename and a directory sync. ADownloadBundlefetches several files and swaps the whole directory in at once, for models. It can adopt a partial file it did not write. Behind theCryptotrait. -
StoicSealed (design/24). Encryption at rest with AES-256-GCM through swift-crypto:
- A
Keyringheld in aKeyCustody. - Sealed files,
SealedObjectFilefor per-object keys, andSealedJournal, whose compaction can rotate the key so deleted records are gone for good. - Failures are told apart: tampered, torn, unknown key, not sealed.
- The contract states the threat model plainly.
Behind the
Cryptotrait, so adopters who do not enable it fetch nothing new. - A
-
StoicSealedKeychain.
SecretStoreCustody, which turns anySecretStore(such as the Keychain) into a keyring's custody. A locked or refusing keychain is never read as an absent key.
Settings people edit by hand (design/18)
A .handEdited settings file is never moved or overwritten when it doesn't parse. The last good value is kept, and the problem carries a line and column. An update first reads the file again under a lock, so an edit made a moment ago is not lost.
New in this release:
- Writing the file:
- A canonical sparse layout, with caller-supplied key order and a file header.
materialize(), andreplaceUnusableFile(...), which copies the broken file aside first.
- Locking:
blockingUpdate(waitingUpTo:)for synchronous callers that wait for the lock. - Watching the file:
watch(debounce:)follows rename-saves. - Streams:
changes(), with cause and source;problems(). - Dialect:
- Comments can be refused.
- A repeated key is read last-wins with a warning, never as a reason to fall back to defaults.
- JSON:
JSONChangediffs and applies documents for undo history, plus path operations onJSONValue.
Store, Outbox and HTTP
PosixFileSystem(newFileMode:newDirectoryMode:)creates private files with no chmod window.FileSystem.watchFilewatches a file for changes.- Journals:
Journal.readOnlyReplaylets a second process read a journal without repairing it.Journal.removedeletes a journal with its sidecars.
- Outbox:
- Breaking: a delivery closure now returns a
DeliveryResult(.delivered,.discard(reason:),.keep). Outbox.deliver(_:using:)awaits the outcome for one entry.- Undecodable entries and expiry each get a policy.
- Breaking: a delivery closure now returns a
- HTTP:
HTTPClient.streamstreams a response body.HTTPPolicy.singleAttemptmakes one attempt and leaves retrying to the caller.keyedConflictIsInProgresscontrols whether a 409 on a keyed request means "in progress".
KeychainSecretStore(loginKeychainService:)uses the macOS login keychain, for Developer ID apps without an application identifier.
Fixes
- StoicTesting: a use-after-free in the simulation executor. An
enqueuefrom another thread could signal an executor its simulation had already freed. Found under AddressSanitizer, with a deterministic regression test. - StoicTesting:
TestClock.waitForSleepersworks from XCTest without importing Testing.
Breaking changes
These are listed in api-breakage-allowlist.txt:
- The Outbox delivery closure's result.
AtomicFile.Options.newFileModeis now optional (nilmeans the file system's mode).- New
SettingsStore.UpdateErrorcases.