API-style comments and ktlint formatting

Every comment is reduced to its first sentence plus @param, @return
and @throws tags. Comment lines: 20040 to 8526. ktlint 1.8 applied
with its default (official Kotlin) style across all modules; 262 files
reformatted. The 264 remaining ktlint findings are naming and filename
rules, which are code changes, and are left alone.

Comments and formatting only. 1208 tests pass, counted from the XML.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Paul Hitt
2026-09-08 20:02:07 -04:00
co-authored by Claude Fable 5.1
parent 8a7f40fb13
commit 2fa430f21c
262 changed files with 20797 additions and 23969 deletions
@@ -7,20 +7,8 @@ import kotlin.test.assertTrue
/**
* Parsing an address, and refusing everything that is nearly one.
*
* This runs on input nobody authenticated. An address arrives typed, or
* pasted, or scanned from a code somebody else printed, and, worst of all,
* from inside a sealed envelope written by a stranger on another relay. So the
* refusals matter more than the successes: accepting `fnid@https://x/y` would
* let a message point this client at a path on a host of the sender's choosing.
*
* The cases here deliberately mirror the Swift suite one for one. Two
* implementations that disagree about which strings are addresses open two
* threads for one person on one side and none on the other, and nothing about
* either engine's own tests would show it.
*/
class ContactCardTest {
@Test
fun `a bare address with no scheme is accepted`() {
val card = ContactCard.decode("fn1abc@relay1.flamenet.io")
@@ -45,10 +33,7 @@ class ContactCardTest {
}
/**
* Kept only so an older card still parses. Nothing reads it and nothing
* should start to: sealing uses the recipient DEVICE's key, which the
* remote directory returns, and the federated send carries no delivery key
* at all.
* Kept only so an older card still parses.
*/
@Test
fun `an older card carrying a delivery key still parses`() {
@@ -62,9 +47,7 @@ class ContactCardTest {
}
/**
* A relay is a hostname. Accepting a URL here would let a card, or a
* message from a stranger, point this client at a path on somebody else's
* host.
* A relay is a hostname.
*/
@Test
fun `a relay that is a URL is refused`() {
@@ -83,8 +66,7 @@ class ContactCardTest {
}
/**
* A second `@` means this is not one address. Splitting on the first
* would silently address a different host than the string names.
* A second `@` means this is not one address.
*/
@Test
fun `two at signs is not one address`() {
@@ -97,12 +79,13 @@ class ContactCardTest {
*/
@Test
fun `canonical gives one spelling for one address`() {
val spellings = listOf(
"fn1abc@relay1.flamenet.io",
"flamenet:fn1abc@relay1.flamenet.io",
" fn1abc@RELAY1.Flamenet.io ",
"flamenet:fn1abc@relay1.flamenet.io?k=" + "A".repeat(44),
)
val spellings =
listOf(
"fn1abc@relay1.flamenet.io",
"flamenet:fn1abc@relay1.flamenet.io",
" fn1abc@RELAY1.Flamenet.io ",
"flamenet:fn1abc@relay1.flamenet.io?k=" + "A".repeat(44),
)
val canonical = spellings.map { ContactCard.canonical(it) }.toSet()
assertEquals(setOf("fn1abc@relay1.flamenet.io"), canonical, "got $canonical")
}