Skip to content

BE-1256: Add the hash-graph relay subcommand and its compose service - #10704

Draft
TimDiekmann wants to merge 2 commits into
t/be-1234-publish-the-entity-outbox-from-a-relayfrom
t/be-1256-add-the-hash-graph-relay-subcommand-and-its-compose-service
Draft

TimDiekmann wants to merge 2 commits into
t/be-1234-publish-the-entity-outbox-from-a-relayfrom
t/be-1256-add-the-hash-graph-relay-subcommand-and-its-compose-service

Conversation

@TimDiekmann

Copy link
Copy Markdown
Member

🌟 Purpose

The relay loop in hash-graph-relay has no entry point, so nothing runs it. This PR adds the hash-graph relay subcommand and a compose service for it.

🔍 Changes

  • hash-graph relay holds one database connection, runs the loop on it and stops on Ctrl-C. --name, --page-size and --poll-interval-ms are also read from HASH_GRAPH_RELAY_*.
  • The relay sets TCP keepalives on its connection, so the database releases the relay's lock about 25 seconds after its host disappears.
  • graph-relay in the compose stack runs the subcommand from the graph image, after the migrations.

⚠️ Known issues

  • The relay only logs the events it reads, under the relay name log. A queue publisher follows and gets a name, and with it a cursor, of its own.
  • The regenerated task-dependencies.json files also pick up hash-queue, which BE-1233: Add the hash-queue crate for RabbitMQ jobs and an entity embedding worker #10700 below has not regenerated.
  • The relay stops cleanly on SIGINT only, like the other subcommands. On SIGTERM the lock is released as well, and at worst one page is published twice.

@TimDiekmann TimDiekmann self-assigned this Dec 3, 2026
@vercel

vercel Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hash Ready Ready Preview Dec 3, 2026 1:02pm UTC
petrinaut Ready Ready Preview Dec 3, 2026 1:02pm UTC
2 Skipped Deployments
Project Deployment Actions Updated
hashdotdesign-tokens Ignored Ignored Preview Dec 3, 2026 1:02pm UTC
petrinaut-docs Ignored Ignored Preview Dec 3, 2026 1:02pm UTC

Request Review

@github-actions github-actions Bot added area/deps Relates to third-party dependencies (area) area/apps > hash* Affects HASH (a `hash-*` app) area/infra Relates to version control, CI, CD or IaC (area) area/apps > hash-api Affects the HASH API (app) area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team area/tests New or updated tests area/tests > integration New or updated integration tests area/apps area/apps > hash-graph labels Dec 3, 2026
@TimDiekmann
TimDiekmann added this pull request to stack #10688 December 3, 2026 12:55
@codecov

codecov Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 45 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.33%. Comparing base (28f8fc0) to head (e1d3fd2).

Files with missing lines Patch % Lines
apps/hash-graph/src/subcommand/relay.rs 0.00% 40 Missing ⚠️
apps/hash-graph/src/subcommand/mod.rs 0.00% 5 Missing ⚠️
Additional details and impacted files
@@                                 Coverage Diff                                  @@
##           t/be-1234-publish-the-entity-outbox-from-a-relay   #10704      +/-   ##
====================================================================================
- Coverage                                             70.35%   70.33%   -0.02%     
====================================================================================
  Files                                                  2142     2143       +1     
  Lines                                                226527   226572      +45     
  Branches                                               9820     9821       +1     
====================================================================================
  Hits                                                 159367   159367              
- Misses                                                65109    65154      +45     
  Partials                                               2051     2051              
Flag Coverage Δ
hash-graph 20.48% <0.00%> (-0.66%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch was successfully deployed

3 active (1 outdated) deployments
Preview – hash — e1d3fd25 Deployed Dec 3, 2026 by vercel[bot]
Preview – petrinaut — e1d3fd25 Deployed Dec 3, 2026 by vercel[bot]
Preview – petrinaut-docs — c06467fd Deployed Dec 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps > hash* Affects HASH (a `hash-*` app) area/apps > hash-api Affects the HASH API (app) area/apps > hash-graph area/apps area/deps Relates to third-party dependencies (area) area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) area/tests > integration New or updated integration tests area/tests New or updated tests type/eng > backend Owned by the @backend team

Development

Successfully merging this pull request may close these issues.

1 participant