fix(meshcore): resolve author full public key for room server messages#3733
Conversation
Room post handler was storing the raw author_pubkey_prefix as fromPublicKey instead of resolving it to the full public key via the contacts map. This meant nameForKey() lookups in the frontend always missed the contact (prefix ≠ full key), causing the sender to display as a truncated hex string rather than their name. The fix mirrors the existing roomFullKey resolution pattern on the line above: authorContact?.publicKey ?? authorPrefixHex. Fixes #3732. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018nJjqaZZjhXFtj4JcZSHCS
|
Claude finished @Yeraze's task —— View job Claude's Review
SummaryThe fix is correct and mirrors the existing Bug: Test not updated to match fix
// This still asserts the PRE-FIX (broken) behavior:
expect(msg.fromPublicKey).toBe(authorPubkey.substring(0, 8));After this fix, when the author contact is found via expect(msg.fromPublicKey).toBe(authorPubkey);A second test case covering the unknown author fallback path (contact not in map → falls back to prefix) would also be valuable to guard against regressions. Minor Observations
The fromPublicKey: data.pubkey_prefix, // line 980 — not resolvedThe same
VerdictThe logic change is correct and safe. Please fix the stale test assertion on line 92 before merging. |
…3732) The room_message test asserted the old buggy behavior — fromPublicKey == the 8-char wire prefix — which this PR's fix intentionally changes: when the author contact is known, fromPublicKey now resolves to the full public key so nameForKey() matches it on the frontend (symmetric with toPublicKey, which the same test already expects as the full room key). Update the assertion to match. The unknown-contact fallback test is unaffected (still expects the prefix). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011JEaCGwY9Wz8jeV4e22GW4
|
CI was red: |
|
Claude finished @Yeraze's task —— View job Claude's Review
SummaryThe fix is clean, correct, and well-tested. The stale assertion from the previous review has been addressed. Here's a full pass:
|
…3747) `gh run list --branch <branch>` returns runs for EVERY commit ever pushed to the branch, so after a branch is fixed and re-pushed, watch-ci kept reporting the OLD commit's failed run forever — even though the new tip's runs all passed. This produced false "CI FAILED" verdicts (observed monitoring PR #3733, where the fix commit was green but the watcher reported the pre-fix failure). Resolve the target's current head SHA each poll cycle (PR → headRefOid, fork-safe; plain branch → commits API) and filter the run list to that SHA in jq. Re-resolving each cycle also means a push mid-watch is tracked automatically, and "no runs for this SHA yet" cleanly covers the window between a push and its runs being created. On a transient SHA-resolution failure, fall back to the last known tip rather than crashing. Also fix the failure hint, which suggested the invalid `gh run view --log-failed --branch <branch>` (run view takes a run id, not --branch), and surface the short SHA in the pass/fail summary lines. Claude-Session: https://claude.ai/code/session_011JEaCGwY9Wz8jeV4e22GW4 Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary
Fixes #3732 — room server messages showed a truncated hex string instead of the sender's name.
Root cause: The
room_messageevent handler inmeshcoreManager.tswas storingauthor_pubkey_prefix(a short prefix) directly asfromPublicKey, while the room itself was correctly resolved to its full public key viaresolveContactByPrefix(). SincenameForKey()in the frontend does an exact-match lookup, it never matched the prefix and fell back to displayingfromPublicKey.substring(0, 8)….Fix: Mirror the existing
roomFullKeyresolution pattern for the author:When the contact is in the contacts map at ingest time, the full public key is stored, allowing
nameForKey()to resolve the sender name on the frontend. If the contact isn't known yet, falls back to the prefix (same behaviour as before).Test plan
🤖 Generated with Claude Code
Generated by Claude Code