NA-0652: GET /v1/server-info capability document (D588, D-0012) - #62
Merged
Conversation
…xed two-key probe, live-config document (D588, D-0012)
DOC-PROG-004 step 2 per locked decision L4 (additive-only, auth-gated,
features-never-security). On a bearer relay an unauthorized request
(missing OR wrong token, identical both ways — never a token oracle)
gets 401 with EXACTLY {"server":"qsl-server","auth":{"mode":"bearer"}};
an authorized request (or any request on an open relay) gets the full
document from LIVE config: server, version, name (RELAY_NAME, ""-safe),
api [push_v1, pull_v1, pull_ack_lease_v1], auth.mode per RELAY_TOKEN
presence, limits, retention.ttl_secs, directory none, attachments
service_url (RELAY_ATTACHMENTS_SERVICE_URL, null-safe), kt none,
min_client_version (RELAY_MIN_CLIENT_VERSION, null-safe, advisory).
DOC-SRV-006 carries the contract rules; the three new env vars follow
the RELAY_TOKEN env-only precedent and never fail startup; auth_ok is
reused AS-IS (the ENG-0039 compare stays filed debt, untouched).
push/pull/ack handlers, storage schema, auth mechanism, Cargo.toml and
Cargo.lock byte-untouched; src/lib.rs diff is purely additive.
Tests: tests/na0652_server_info.rs — probe-vs-full both auth modes,
wrong-token byte-identity, exact-field-set guards (probe both nesting
levels + full-doc top level), injected-config value tracking, real-binary
env plumbing end-to-end. Full suite 108/0 across 26 sets (the NA-0642
100/25 baseline + this file); fmt + clippy -D warnings clean.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goals: G4, G5
NA-0652 (qsl-protocol governance; directive QSL-DIR-2026-07-17-588/D588, approved 2026-07-17; qsl-server decision D-0012): the capability document
GET /v1/server-info— DOC-PROG-004 step 2 per locked decision L4 (additive-only, auth-gated, features-never-security).What it serves
RELAY_TOKENunset)200full document,auth.mode:"open"401+ exactly{"server":"qsl-server","auth":{"mode":"bearer"}}401+ byte-identical probe (no token oracle)200full document,auth.mode:"bearer"Full document (live config, never constants):
server,version(CARGO_PKG_VERSION),name(RELAY_NAME,""-safe),api["push_v1","pull_v1","pull_ack_lease_v1"],auth.mode,limits.{max_body_bytes,max_queue_depth},retention.ttl_secs,directory.mode:"none",attachments.service_url(RELAY_ATTACHMENTS_SERVICE_URL, null-safe),kt.mode:"none",min_client_version(RELAY_MIN_CLIENT_VERSION, null-safe, advisory — not enforced). Contract rules encoded in the newdocs/server/DOC-SRV-006(additive-only evolution; features-never-security; same bearer gate; probe registry fixed at two keys).Impact
Purely additive:
src/lib.rs+96/−0 (ServerInfoCfg, two AppState fields, one widened constructor, the handler, one router line); new test file; DOC-SRV-006;relay.env.example+ runbook lines for the three optional env vars (RELAY_TOKEN env-only precedent — absent/empty never fails startup); DECISIONS D-0012.src/main.rs,src/store.rs,Cargo.toml,Cargo.lock, and every existing test file untouched.No-regression
/v1/push,/v1/pull,/v1/pull/ackhandlers byte-untouched (their 401 stays plainERR_UNAUTHORIZED); storage schema unchanged; auth mechanism unchanged —auth_okreused AS-IS (the known non-constant-time compare remains ENG-0039 filed debt, deliberately not touched); zero dependency change. Full suite green locally: 108 passed / 0 failed across 26 result sets = the NA-0642 baseline (100/25) plus this PR's 8 tests;cargo fmt --checkandcargo clippy --all-targets -- -D warningsclean.Tests-Vectors
tests/na0652_server_info.rs(8): open-relay unauth full doc; bearer missing-token exact probe (exact-field-set guard at both nesting levels); wrong-token byte-identical probe; valid-token full doc; injected-config value tracking (limits/TTL/all three info fields); unset fields""/null-safe; full-doc top-level exact-field-set guard (pins the additive baseline); real-binary end-to-end env plumbing (RELAY_*vars through main.rs, probe + full doc +RETENTION_TTL_SECS=7200reflected).🤖 Generated with Claude Code