chore(debug): route MarmotInboundProcessor diag prints to stderr

`amy_json` captures stdout for JSON output; stdout prints were
swallowed by command substitution. Switching to System.err.println
routes the diag trace to the harness log.

https://claude.ai/code/session_1469d7f4-bb66-4ffa-a44d-1dfa4b526484
This commit is contained in:
Claude
2026-04-22 07:00:04 +00:00
parent c222a5d50b
commit 4e00df7344
@@ -409,7 +409,7 @@ class MarmotInboundProcessor(
): GroupEventResult {
// Peek at content type from the PrivateMessage header
val privMsg = PrivateMessage.decodeTls(TlsReader(mlsMessage.payload))
println("[MarmotDbg] processPrivateMessage ${groupEvent.id.take(8)} contentType=${privMsg.contentType} peekEpoch=${privMsg.epoch} curEpoch=${groupManager.getGroup(groupId)?.epoch}")
System.err.println("[MarmotDbg] processPrivateMessage ${groupEvent.id.take(8)} contentType=${privMsg.contentType} peekEpoch=${privMsg.epoch} curEpoch=${groupManager.getGroup(groupId)?.epoch}")
return when (privMsg.contentType) {
ContentType.APPLICATION -> {
@@ -509,7 +509,7 @@ class MarmotInboundProcessor(
retainedEpochCount = groupManager.retainedExporterSecrets(groupId).size,
)
val mlsMessage = MlsMessage.decodeTls(TlsReader(mlsBytes))
println("[MarmotDbg] applyCommit ${commitEvent.id.take(8)} wireFormat=${mlsMessage.wireFormat} groupId=${groupId.take(8)} currentEpoch=${groupManager.getGroup(groupId)?.epoch}")
System.err.println("[MarmotDbg] applyCommit ${commitEvent.id.take(8)} wireFormat=${mlsMessage.wireFormat} groupId=${groupId.take(8)} currentEpoch=${groupManager.getGroup(groupId)?.epoch}")
when (mlsMessage.wireFormat) {
WireFormat.PRIVATE_MESSAGE -> {
@@ -520,15 +520,15 @@ class MarmotInboundProcessor(
// when it finally arrives.
val privPeek = PrivateMessage.decodeTls(TlsReader(mlsMessage.payload))
val currentEpoch = groupManager.getGroup(groupId)?.epoch
println("[MarmotDbg] applyCommit ${commitEvent.id.take(8)} PRIVATE content=${privPeek.contentType} peekEpoch=${privPeek.epoch} curEpoch=$currentEpoch")
System.err.println("[MarmotDbg] applyCommit ${commitEvent.id.take(8)} PRIVATE content=${privPeek.contentType} peekEpoch=${privPeek.epoch} curEpoch=$currentEpoch")
when {
currentEpoch != null && privPeek.epoch < currentEpoch -> {
println("[MarmotDbg] → past-epoch Duplicate")
System.err.println("[MarmotDbg] → past-epoch Duplicate")
GroupEventResult.Duplicate(groupId)
}
currentEpoch != null && privPeek.epoch > currentEpoch -> {
println("[MarmotDbg] → future-epoch Error")
System.err.println("[MarmotDbg] → future-epoch Error")
GroupEventResult.Error(
groupId,
"PrivateMessage epoch ${privPeek.epoch} is ahead of local epoch $currentEpoch; ignoring",
@@ -536,11 +536,11 @@ class MarmotInboundProcessor(
}
else -> {
println("[MarmotDbg] → decrypt+process")
System.err.println("[MarmotDbg] → decrypt+process")
val decrypted = groupManager.decrypt(groupId, mlsMessage.toTlsBytes())
if (decrypted.contentType == ContentType.COMMIT) {
val group = groupManager.getGroup(groupId)
println("[MarmotDbg] → CommitProcessed epoch=${group?.epoch}")
System.err.println("[MarmotDbg] → CommitProcessed epoch=${group?.epoch}")
GroupEventResult.CommitProcessed(groupId, group?.epoch ?: 0)
} else {
GroupEventResult.Error(