Merge main and re-derive the formatting pass

Conflicting files take main's version and ktlint and the comment
pipeline are re-run on them.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Paul Hitt
2026-09-08 20:22:03 -04:00
co-authored by Claude Fable 5.1
parent b938d161ba
commit 788be4259e
43 changed files with 585 additions and 669 deletions
@@ -170,8 +170,8 @@ class AccountsClient(
.post(body.toString().toRequestBody(JSON))
.header("Accept", "application/json")
.build(),
// Only these two actually present a passphrase, so only these two can
// meaningfully report one as wrong.
// Only these two actually present a passphrase, so only these two
// can meaningfully report one as wrong.
carriesCredentials = path == "sessions" || path == "accounts",
)
@@ -143,8 +143,8 @@ class Conversations(
myUserId: Long,
mentions: List<Int> = emptyList(),
/**
* Minted by the caller, not here, because the caller also
* writes the sender's own copy and queues the retries.
* Minted by the caller, not here, because the caller also writes the
* sender's own copy and queues the retries.
*/
messageId: String? = null,
): Sent {
@@ -593,8 +593,8 @@ class Conversations(
servedFnid = keys.fnid ?: servedFnid
keys.fnid?.let { trust.rememberFnid(toUserId, it) }
val full = keys.bundles.associateBy { it.deviceId }
// Union: every device the directory knows, carrying a full bundle
// where the key route returned one.
// Union: every device the directory knows, carrying a full
// bundle where the key route returned one.
stubs.map { full[it.deviceId] ?: it }
}
// The send path had no logging at all, and that is why a message that
@@ -36,8 +36,9 @@ object LinkPreviewFetcher {
.Builder()
.url(url)
.header("Accept", "text/html")
// Identifies as a link preview rather than impersonating a browser.
// a site that wants to refuse these should be able to.
// Identifies as a link preview rather than impersonating a
// browser. a site that wants to refuse these should be able
// to.
.header("User-Agent", "FlamenetLinkPreview/1.0")
.build()
http.newCall(request).execute().use { response ->
@@ -288,8 +288,8 @@ class LocalVault(
.filter { it.parentId == parentId }
.map { Entry(it, nameOf(it), isMissing = isMissing(it)) }
.sortedWith(
// Folders first, then by name; unreadable rows last, where they
// are least in the way of the ones you can act on.
// Folders first, then by name; unreadable rows last, where
// they are least in the way of the ones you can act on.
compareByDescending<Entry> { it.isFolder }
.thenBy { it.name == null }
.thenBy(String.CASE_INSENSITIVE_ORDER) { it.name ?: "" },
@@ -171,8 +171,8 @@ class MessengerApi(
}
/**
* Changing the password invalidates other credentials, which is the point
* of changing it, so this device has to sign in again afterwards.
* Changing the password invalidates other credentials of changing it, so
* this device has to sign in again afterwards.
*/
fun updatePassword(password: String) {
raw("api/flamenet/v1/messenger/me", "PUT", JSONObject().put("password", password))
@@ -61,9 +61,9 @@ class RelayAuth(
)
return null
} ?: run {
// A non-2xx that is not 404 arrives here as null, not as a throw,
// so this branch is NOT unreachable, it was the quietest path of
// the three.
// A non-2xx that is not 404 arrives here as null, not as a
// throw, so this branch is NOT unreachable, it was the quietest
// path of the three.
warn(
"no token: /account/token answered a non-success " +
"status; falling back to Basic, which /e2e/* refuses.",
@@ -106,9 +106,9 @@ internal object Wire {
.getDecoder()
.decode(text)
// / The engine keeps its own `Bytes.sha256` `internal`, for the reason
// / above: its public surface is the protocol, not its utilities. §21.4
// / needs one here to hash a capability before uploading it, and SHA-256 has
// / The engine keeps its own `Bytes.sha256` `internal`, for the reason /
// above: its public surface is the protocol, not its utilities. §21.4 /
// needs one here to hash a capability before uploading it, and SHA-256 has
// / one right answer, so a second call site cannot drift.
fun sha256(data: ByteArray): ByteArray =
java.security.MessageDigest
@@ -442,10 +442,10 @@ class Trust(
when {
pin.size > head.size -> false
// shrank
// shrank.
pin.size == head.size -> pin.root == head.root
// same size, same root
// same size, same root.
else -> consistent(pin.size, head.size, pin.root, head.root)
}
} catch (_: Exception) {
@@ -497,8 +497,8 @@ class Trust(
val issuer =
when (val verdict = RelayIdentityPin.check(offered, vault.keyLogIssuerPin())) {
is RelayIdentityPin.Verdict.NotPublished -> {
// Nothing published and nothing pinned: a weaker deployment,
// not an attack.
// Nothing published and nothing pinned: a weaker
// deployment, not an attack.
vault.keyLogIssuerPin() ?: return
}
@@ -70,7 +70,8 @@ object UpdateCheck {
val json = JSONObject(body)
val code = json.optInt("versionCode", 0)
// A manifest that cannot say which build it describes is not one.
// A manifest that cannot say which build it describes is
// not one.
if (code <= 0) return null
Release(
versionCode = code,
@@ -89,8 +89,9 @@ class DeliveryTokenTest {
"/e2e/delivery-tokens" in path -> {
val b = JSONObject(request.body.readUtf8())
// Revoke first, so a client cutting one contact off while
// topping another up in the same call keeps what it added.
// Revoke first, so a client cutting one contact off
// while topping another up in the same call keeps what
// it added.
b.optJSONArray("revoke")?.let { a ->
(0 until a.length()).forEach { held.remove(a.getString(it)) }
}
@@ -77,9 +77,9 @@ class GossipHeadSentTest {
override fun dispatch(request: okhttp3.mockwebserver.RecordedRequest): MockResponse {
val path = request.path.orEmpty()
return when {
// `contains`, not `startsWith`: every route is under the
// REST mount, so the recorded path begins with that prefix
// rather than with `/e2e`.
// `contains`, not `startsWith`: every route is under
// the REST mount, so the recorded path begins with that
// prefix rather than with `/e2e`.
"/e2e/log/" in path -> MockResponse().setResponseCode(404)
path.contains("/e2e/messages") -> json("""{"ok":true}""")
@@ -125,10 +125,10 @@ class MultiMailboxPollTest {
relay = backupHost,
username = "me",
appPassword = "pw",
// The record names a hostname and cannot carry a port; how this
// device DIALS that host is a separate field, which is what lets a
// test, or a self-hoster on a nonstandard port, work without the
// record lying about its own name.
// The record names a hostname and cannot carry a port; how
// this device DIALS that host is a separate field, which is
// what lets a test, or a self-hoster on a nonstandard port,
// work without the record lying about its own name.
baseUrl = backup.url("/").toString(),
),
),