debug(marmot): log publishMarmotKeyPackages path for Test 13 diagnosis
Test 13 (KeyPackage rotation) fails with "no new KP event_id observed" — the interop log shows three `needsKeyPackageRotation=true` triggers (once per group join), each of which invokes `account.publishMarmotKeyPackages()` from `processMarmotWelcomeFlow`, but no subsequent `kind:30443` publish ever appears in the logcat. `publishMarmotKeyPackages` was completely silent: no-op guards, the needsRotation check, the rotated-events count, and the per-event publish all ran without a log line. We can't tell whether the rotation produces events that never reach a relay, produces zero events, short-circuits on needsRotation=false, or is never called at all. Mirror the addMarmotGroupMember log pattern: entry guards (manager null / not writeable), the needsRotation + relay count at decision time, the rotateConsumedKeyPackages produce-count, and a per-event publish line with id + target relay list. Next rerun of Test 13 will tell us which branch is silently dropping the rotation.
This commit is contained in:
@@ -2167,15 +2167,33 @@ class Account(
|
|||||||
* Publish or rotate KeyPackage events.
|
* Publish or rotate KeyPackage events.
|
||||||
*/
|
*/
|
||||||
suspend fun publishMarmotKeyPackages() {
|
suspend fun publishMarmotKeyPackages() {
|
||||||
val manager = marmotManager ?: return
|
val manager =
|
||||||
if (!isWriteable()) return
|
marmotManager ?: run {
|
||||||
|
Log.w("MarmotDbg") { "publishMarmotKeyPackages: marmotManager is NULL — no-op" }
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!isWriteable()) {
|
||||||
|
Log.w("MarmotDbg") { "publishMarmotKeyPackages: account is not writeable — no-op" }
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
val relays = keyPackagePublishRelays()
|
val relays = keyPackagePublishRelays()
|
||||||
|
val needsRotation = manager.needsKeyPackageRotation()
|
||||||
|
Log.d("MarmotDbg") {
|
||||||
|
"publishMarmotKeyPackages: needsRotation=$needsRotation relays=${relays.size}"
|
||||||
|
}
|
||||||
|
|
||||||
if (manager.needsKeyPackageRotation()) {
|
if (needsRotation) {
|
||||||
val rotatedEvents = manager.rotateConsumedKeyPackages(relays.toList())
|
val rotatedEvents = manager.rotateConsumedKeyPackages(relays.toList())
|
||||||
|
Log.d("MarmotDbg") {
|
||||||
|
"publishMarmotKeyPackages: rotateConsumedKeyPackages produced ${rotatedEvents.size} event(s)"
|
||||||
|
}
|
||||||
rotatedEvents.forEach { event ->
|
rotatedEvents.forEach { event ->
|
||||||
cache.justConsumeMyOwnEvent(event)
|
cache.justConsumeMyOwnEvent(event)
|
||||||
|
Log.d("MarmotDbg") {
|
||||||
|
"publishMarmotKeyPackages: publishing rotated kind:${event.kind} id=${event.id.take(8)}… " +
|
||||||
|
"→ ${relays.size} relay(s): ${relays.map { it.url }}"
|
||||||
|
}
|
||||||
client.publish(event, relays)
|
client.publish(event, relays)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user