Files
amethyst/commons
Claude af39263444 refactor(cordn): move the file stores and EncryptedAppendLog to commonMain on okio
FileCordnStores (CordnStorageLayout and the group, key-package,
coordinator and handoff stores), FileBackedCordnScopeFactory,
CordnMigrationStores and EncryptedAppendLog move from jvmAndroid to
commonMain. They now take an okio Path, plus a FileSystem that defaults
to platformFileSystem, where they used to take a java.io.File.

The on-disk format does not change. These files hold encrypted MLS group
state that cannot be re-derived, so CordnStorageFormatGoldenTest pinned
the exact tree of paths and the bytes of every file against the java.io
implementation first. It passes against this one with its constants
untouched; only its construction glue moved from File to Path.

- Cursor framing: ByteBuffer's default big-endian putLong/getLong is now
  okio Buffer.writeLong/readLong, which is also big-endian.
- Migration base64: java.util.Base64 is now
  kotlin.io.encoding.Base64.Default with PRESENT_OPTIONAL padding, the
  same alphabet and output. A new test checks it against java.util.Base64
  in both directions, padded and unpadded.
- Failure handling: File.delete(), deleteRecursively() and
  renameTo-else-copy returned false where okio throws, so the File
  behaviour is kept by deleteQuietly, deleteRecursivelyQuietly and
  moveOrCopy in commons/util/FileSystemExt.kt.
- Durability: the log's fsyncs are FileHandle.flush(), which is
  FileDescriptor.sync() on the JVM and Android.

Callers updated: the CLI's CordnContext, CordnRuntime,
Account.cordnFilesDir (now Path?), AccountCacheState, and
EncryptedMarmotMessageStore, which stays in jvmAndroid and passes
toOkioPath() to the log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S7FuNBSKiyVecARSoE4B9P
2026-09-28 03:53:56 +00:00
..