Skip to content

feat(core): merge gossip-discovered rooms into listRooms - #138

Merged
Mearman merged 1 commit into
mainfrom
feat/room-discovery-listrooms
Sep 16, 2026
Merged

Mearman merged 1 commit into
mainfrom
feat/room-discovery-listrooms

Conversation

@Mearman

@Mearman Mearman commented Sep 16, 2026

Copy link
Copy Markdown
Member

listRooms now also surfaces every public/private room this store has heard gossiped by another device (via room/hosted, #131/#132) but never joined or otherwise locally recorded, mixed into its existing Room[] result as a display-only placeholder -- id/name/type/owner/description real, everything membership-shaped (members, memberJoins, etc.) genuinely empty, since a gossip hint is not the same as admission. A room already known locally always wins; a gossip advert for it is silently ignored rather than shadowing the real record.

MeshTransport gains an optional listKnownDevices method (matching WireMeshTransport's own already-shipped implementation, #130) so RoomLifecycle can read it through the existing abstract requireTransport() port rather than depending on the concrete WireMeshTransport type -- absent for any transport implementation that doesn't offer it, in which case the merge step is a no-op.

A gossiped candidate is narrowed through a real type guard (isHostedRoomAdvert) before use, matching the codebase's own "an advert not participating in this convention is not an error" gossip-consumption pattern already established for presence/status.

Caught a real bug before this ever reached CI: my first implementation extracted transport.listKnownDevices into a bare variable before calling it, which drops the method's own this binding to the WireMeshTransport instance and crashes with "Cannot read properties of undefined" the moment a real transport is exercised anywhere in the suite -- found by running the full test suite, not just the new test file, then fixed by calling it as a normal property-access method call instead.

This closes out the last piece #48's own P3.8 tracking called genuinely open on the room-discovery side: createRoom's own room_upsert broadcast can now be retired once this is verified equivalent in production, though that retirement itself stays its own follow-up rather than bundled in here.

Refs #48.

listRooms now also surfaces every public/private room this store has
heard gossiped by another device (via room/hosted, #131/#132) but
never joined or otherwise locally recorded, mixed into its existing
Room[] result as a display-only placeholder -- id/name/type/owner/
description real, everything membership-shaped (members, memberJoins,
etc.) genuinely empty, since a gossip hint is not the same as
admission and this store has nothing else real to report for it. A
room already known locally always wins; a gossip advert for it is
silently ignored rather than shadowing the real record.

MeshTransport gains an optional listKnownDevices method (matching
WireMeshTransport's own already-shipped implementation) so
RoomLifecycle can read it through the existing abstract requireTransport()
port rather than depending on the concrete WireMeshTransport type --
absent for any transport implementation that doesn't offer it, in
which case the merge step is simply a no-op, matching every
construction site that predates this feature.

A gossiped candidate is narrowed through a real type guard
(isHostedRoomAdvert) before use, matching the codebase's own
"an advert not participating in this convention is not an error"
gossip-consumption pattern already established for presence/status.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review Completed 2026-09-16T03:24:35.349064Z 5b80a6f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Mearman
Mearman merged commit a753487 into main Sep 16, 2026
6 checks passed
@Mearman
Mearman deleted the feat/room-discovery-listrooms branch September 16, 2026 03:25
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.27.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Mearman added a commit that referenced this pull request Sep 16, 2026
…es into listAgents

WireMeshTransport's gossip tick gains a third optional source
(getSelfAgentAdvert), gossiping this side's own name/harness/cwd/pid/
startedAt/tags/subscribedRooms under agent/self -- the write half of
P3.8's eventual agent register/update/offline retirement. Deliberately
excludes status (already carried separately under presence/status)
and visibility (only ever populated for a "visible" agent in the
first place, so a discovered entry's visibility is always exactly
"visible" by construction).

MeshStore.selfAgentAdvert reads this store's own agent record and
withholds the advert entirely for anything other than "visible" --
gossip reaches every connected peer regardless of mesh-approval
status, so advertising a hidden or ghost agent's identity this way
would leak exactly what those visibility levels exist to withhold.

AgentRegistry.listAgents merges in a gossip-discovered agent not
otherwise locally known, mirroring listRooms' own room-discovery
merge (#138): a display-only placeholder AgentIdentity, real facts
from the gossiped advert, status read from the existing presence/
status key, never merged into the local agents map, and always
shadowed by a real local record when one exists.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant