Skip to content

Firehose phase 3: relay-lists hose (kind 10002) — retires the last legacy kind#12

Merged
melvincarvalho merged 1 commit into
gh-pagesfrom
issue-11-relaylists-hose
Jun 17, 2026
Merged

Firehose phase 3: relay-lists hose (kind 10002) — retires the last legacy kind#12
melvincarvalho merged 1 commit into
gh-pagesfrom
issue-11-relaylists-hose

Conversation

@melvincarvalho

Copy link
Copy Markdown
Contributor

Closes #11. Phase 3 of the firehose rework (after #7, #9). With this, every event kind is hose-owned and the legacy raw-upsert fallback is empty — our indexer fully owns ingestion.

What

  • src/hoses/relays.js — shared relay-directory helpers: canonicalizeRelayUrl, harvestRelays(db, urls) ($setOnInsert, never clobbers health metrics), ensureRelayDirectoryIndex. The follows hose is refactored onto them (its relayUrlsFrom now just returns the raw content-map keys; canonicalize/dedup/filter is harvestRelays' job).
  • src/hoses/relaylists.js (kind 10002):
    • Verifies the signature (content is free-form; relays live in r tags).
    • Latest-wins upsert of the raw event into relay_lists — the shape diddoc reads to build the DID document's service/Relay entries.
    • Owns pubkey + created_at indexes.
    • Harvests r-tag URLs into the relays directory — the canonical relay-URL source, which the phase-4 health prober will check. (The old relayhose did neither verification nor discovery.)
  • src/indexer.js — register the hose; LEGACY_KINDS = []. planIngest now takes the legacy-kind set as a parameter, so the plan tests are self-contained and stop needing edits each phase.

Verification

  • npm test40/40 (new relay-lists tests: verify / wrong kind / tampered / malformed / r-tag extraction; plan tests reworked to inject legacy kinds; follows test updated for the shared helper).
  • Integration smoke vs Mongo: raw event stored, latest-wins keeps the newest, stale rejected, r-tag URLs harvested as {relay} only, a pre-existing relay's online/uptime left untouched, and buildDidDocument resolves both service entries from the stored event.
  • Live 18s run: hoses: [profiles, follows, relaylists], kind-10002 events ingested (relay_lists +395, relays +103 harvested) into a scratch db.

Out of scope

Active relay-health prober (kind-less; unfreezes /relays) — phase 4 · deploy + retire the legacy server hoses — phase 5.

Last subscription kind migrated to a hose; the legacy raw-upsert fallback
is now empty.

- src/hoses/relays.js: shared relay-directory helpers (canonicalizeRelayUrl,
  harvestRelays via $setOnInsert, ensureRelayDirectoryIndex). Follows hose
  refactored onto them (its relayUrlsFrom now returns raw content-map keys;
  canonicalize/dedup/filter is harvestRelays' job).
- src/hoses/relaylists.js (kind 10002): verify signature, latest-wins upsert
  of the raw event into relay_lists (the shape diddoc reads for service
  entries), harvest r-tag URLs into the relays directory (canonical source,
  feeds the phase-4 prober). Owns pubkey + created_at indexes.
- src/indexer.js: register the hose; LEGACY_KINDS = []. planIngest now takes
  the legacy-kind set as a parameter so the plan tests are self-contained.
- tests: relaylists-hose tests (verify / r-tag extraction); plan tests
  reworked to inject legacy kinds; follows test updated for the shared helper.

npm test 40/40.

Closes #11
@melvincarvalho
melvincarvalho merged commit dc21537 into gh-pages Jun 17, 2026
@melvincarvalho
melvincarvalho deleted the issue-11-relaylists-hose branch June 17, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Firehose phase 3: relay-lists hose (kind 10002) — retires the last legacy kind

1 participant