docs(rest-api): give the remote session protocol one page and move dl --remote setup to a user guide

This commit is contained in:
imSp4rky
2026-12-04 18:25:15 -07:00
parent b96c2a725e
commit d1b2395313
11 changed files with 1235 additions and 1246 deletions
+18
View File
@@ -4,6 +4,7 @@ from __future__ import annotations
import ast
import functools
import re
from pathlib import Path
from typing import Any
@@ -26,6 +27,7 @@ CLIENT_METHODS = {
"ws_connect": "GET",
}
SERVED = {(method, path): handler for method, path, handler, _ in routes.ROUTES}
ROOT = Path(__file__).parents[3]
@functools.cache
@@ -103,6 +105,22 @@ def test_the_server_takes_its_remote_session_routes_from_the_protocol():
assert {path for path in served_paths if path.startswith("/api/session")} <= protocol_paths
def test_the_protocol_page_lists_each_remote_route():
"""The route table of the protocol page holds the routes that a remote-only server mounts, and no other.
Each route of the table that the page itself documents has a section of its own.
"""
page = (ROOT / "docs" / "dev" / "rest-api" / "remote-sessions.md").read_text(encoding="utf-8")
listed = set(re.findall(r"^\| `(GET|POST|DELETE)` \| `([^`]+)` \|", page, re.MULTILINE))
sections = set(re.findall(r"^### `(GET|POST|DELETE) ([^`]+)`$", page, re.MULTILINE))
assert listed == {(method, path) for method, path, _, remote in routes.ROUTES if remote}
assert sections == listed - {
("GET", protocol.HEALTH_ROUTE),
("GET", protocol.SERVICES_ROUTE),
("POST", protocol.SEARCH_ROUTE),
}
def test_the_wire_values_stay_what_older_peers_send():
"""Both halves read one record, so only this list catches a renamed value that an older peer still sends."""
assert {name: getattr(protocol, name) for name in ROUTE_NAMES} == {