Repository navigation
feat(mcp): add the relay_status tool over a published status document - #1209
Conversation
…the NIP-11 builder
🦋 Changeset detectedLatest commit: db8ff8c The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
[Medium impact] The PR appears safe to merge; the latest change addresses the remaining numbered finding.
|
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
Coverage Report for CI Build 44931415495Coverage remained the same at 77.582%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
Slice 2 of #1183: one tool,
relay_status— uptime, worker health, version, connection count, and the NIP-11 document — plus the two pieces no other slice needs.What ships
--mcp-stdioprocess; the relay lives in the daemon's, and heartbeats are process memory. So the daemon writes<config>/relay-status.json(generatedAt,uptimeSeconds,activeConnections,relayPubkey,workers) every 5 s with an atomic temp-and-rename, and the stdio process reads it per call. A fact with no document fresher than 30 s isnullwith a reason naming the file — never a0that reads as "nothing is connected". A0only ever comes from a document that says0.ConnectionCap::live_total()— the total the cap could not answer before; it held per-address counts and a tracked-address count, so a total was not derivable.nostream_relay::nip11— the document builder, absent until now (nip-parity.mdD1 kept the surface shut). Eleven top-level keys and seventeenlimitationkeys, each from a source the ADR names; seven keys are dropped with reasons, including the two with no Rust source at all. This closesnip-parity.mditem 11, the deferred field-set decision.TOOL_RELAY_STATUS, itsTOOLSrow, a handler that takes no arguments, and its audit line (mcp.relay_status).The relay's identity is published, not re-derived.
nip11.selfcomes from the daemon's document — the key the relay actually signs with — and the MCP process reads no key material at all, so a door started with a different secret cannot name a key the relay never signs with.nostream-cli infokeeps its own assembly: its output is pinned byte-for-byte by the CLI's acceptance cases and carries no document, so sharing the builder would buy nothing and risk the pin. The reason is in the module doc and ADR 0016 D4.Decisions
ADR 0016 records seven, each with its cost: the document and its two sources; the seam being two concrete places rather than a trait (the tree's trait precedents invert a dependency, and nothing here needs inverting); the document's shape; the field set;
supported_nips's filters;restricted_writes' arms; and the payload's shapes. ADR 0014 is amended where its single-writer decision and its audit vocabulary meet this job.Verification
At
db8ff8c0, the approver's own runs:cargo test --workspace --all-featurescargo test -p nostream-mcprelay_status10,tools_list5,auth11,audit4,tool_payloads23, lib 5)nip117,status9,transport21,handlers66,admin_http3,mcp_stdio17git merge-treeagainst the baseFive payload states driven on the built binary in one
--mcp-stdioprocess: no document, corrupt, 40 s-stale → fivenulls with the reason and noself; fresh saying0→0with its key asself; fresh with values → the document's numbers. A 13 s daemon run on a config directory holding onlysettings.yamlproduced the five-key document with the modification time advancing 5 004 ms apart and no warnings.Two limits, stated rather than implied: the database-backed sets need a Postgres service and are
#[ignore]d here (ignored: 7, run by CI's parity step), and AC7 — the case that starts the real daemon and watches the file appear — is the only test that proves a writer runs, so it is the one to read first.Part of #1183. Slices 3–5 are not registered here and the issue stays open.