fix(marmot-interop): publish kind:0 for B and C before sanity probes

Several public relays (damus.io in particular) silently drop kind:1059 /
10050 / 30443 from accounts they've never seen before — the sanity
check in the interactive harness reports exactly this failure mode
when the three-relay default set is in use, because wn's identities are
brand-new and have nothing on file.

Before the kind:30443 + 10050/1059/445 probes, publish a kind:0
profile event for each wn identity via `wn profile update --name
--about`. That marks both accounts as "known" on the relay and lets
the subsequent gift-wrap and KeyPackage publishes land. Runs inside
configure_relays (after relays are added, before the first sanity
probe) so the sequencing is: add relay -> advertise profile -> publish
KPs -> start exchanging welcomes.

Does not help when a relay outright refuses the kind (some relays
whitelist only kind:1 / 3 / 7); those still need --local-relays.
This commit is contained in:
Claude
2026-04-22 18:32:31 +00:00
parent fda58f4413
commit 414fd31bf9
+30
View File
@@ -281,6 +281,36 @@ configure_relays() {
add_relay wn_c "$r"
done
# Push a kind:0 profile for each wn identity BEFORE the kind:30443 /
# 10050 / 1059 probes. Several public relays (damus.io in particular)
# silently drop non-profile kinds from accounts they've never seen
# before, so a fresh wn identity created inside the harness never gets
# its gift wraps or inbox lists stored. Publishing kind:0 first
# registers the account in the relay's "known users" set, which lets
# every later publish go through.
publish_profile() {
local who="$1" wnfn
if [[ "$who" == "B" ]]; then wnfn=wn_b; else wnfn=wn_c; fi
local name="marmot-interop $who"
local about="Scripted wn identity for Amethyst<->whitenoise-rs interop harness"
local out
if out=$("$wnfn" profile update --name "$name" --about "$about" 2>&1); then
info "$who kind:0 published (name=\"$name\")"
printf '%s profile update: %s\n' "$who" "$out" >>"$LOG_FILE"
else
warn "$who profile update failed: $out"
printf '%s profile update: %s\n' "$who" "$out" >>"$LOG_FILE"
fi
}
step "publishing kind:0 profiles so relays treat B and C as 'known' accounts"
publish_profile B
publish_profile C
# Give the relay a beat to persist + ack the kind:0 before the next
# publish (some relays gate subsequent writes on the profile being
# indexed, and without this pause the first `keys publish` that
# follows sometimes races ahead of the kind:0 commit).
sleep 2
step "B relay list after configure"
local relay_list
relay_list=$(wn_b --json relays list 2>/dev/null || true)