summaryrefslogtreecommitdiffstats
path: root/src/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/api')
-rw-r--r--src/api/dashboard/check.js9
-rw-r--r--src/api/dashboard/dashboard.html7
-rw-r--r--src/api/events.rs9
3 files changed, 20 insertions, 5 deletions
diff --git a/src/api/dashboard/check.js b/src/api/dashboard/check.js
index 125fc3b..ee37aa6 100644
--- a/src/api/dashboard/check.js
+++ b/src/api/dashboard/check.js
@@ -103,7 +103,9 @@ const check = (ok, what) => {
values: { "home/tv/motd": "hello", "home/tv/hosts/laptop": { ip6: "42::1" } },
members: [["continuum:a", "tv"]],
proposals: { "22": { proposals: ["cc"], votes: ["dd"], yes: ["tv"], no: [],
- passed: false, dead: false } } };
+ passed: false, dead: false, none: null },
+ "33": { proposals: ["ee"], votes: [], yes: [], no: [], passed: false, dead: false,
+ none: "no version: of federation 2, and this continuum knows 1 alone" } } };
federation.refused = { own: [], dropped: [], refused: [] };
federation.versions.set("22", next);
showFederation();
@@ -128,7 +130,10 @@ const check = (ok, what) => {
&& federated.text.includes('keys.lass: {"keys":["ssh-ed25519 AAAA2"],"since":0} -> '
+ '{"keys":["ssh-ed25519 AAAA3"],"since":1}'),
"a proposal: where it stands, and what its version changes, party by party");
- check(federated.votes === 2, "a proposal that can still pass has a vote of each kind");
+ check(federated.votes === 4, "a proposal that can still pass has a vote of each kind");
+ check(federated.text.includes("Backed by no client: no version: of federation 2")
+ && (federated.text.match(/Backed by no client/g) || []).length === 1,
+ "a proposal that is no version says why no client backs it");
check(!federated.text.includes("stopped at") && federated.stopped.includes("stopped at ee")
&& federated.stopped.includes("4 held back"),
"a store that stopped: the event it stopped at, why, and how many it holds back");
diff --git a/src/api/dashboard/dashboard.html b/src/api/dashboard/dashboard.html
index f5d258b..99434e0 100644
--- a/src/api/dashboard/dashboard.html
+++ b/src/api/dashboard/dashboard.html
@@ -4251,8 +4251,8 @@ function connect() {
// `/events/refused`; docs/guides/federation/) instead of the document, until `document`
// says otherwise: the current version, the event the store stopped at, if any, the
// parties, the rules, the values at places (each with who writes there), the proposals on
-// the version (where each stands, who voted what, and what its version changes) and what
-// the node refused. A vote goes through
+// the version (where each stands, who voted what, why no client backs it, where none
+// does, and what its version changes) and what the node refused. A vote goes through
// this node (`POST /admin/events/vote`), which casts it only where it votes for its party
// by itself (`votesByItself`). Read every 5 s while shown, what counts anew where the
// store's heads changed. Writing values takes a key of the party, which the page has
@@ -4509,6 +4509,9 @@ function federationProposals(counts, summary) {
const parts = [federationLeaf("proposed by " + count(proposal.proposals.length, "event")
+ " ยท " + count(proposal.votes.length, "vote"), null,
[...proposal.proposals, ...proposal.votes].join("\n"))];
+ if (proposal.none) {
+ parts.push(el("div", { class: "note error" }, "Backed by no client: " + proposal.none));
+ }
const proposed = federation.versions.get(hash);
if (proposed === undefined) {
parts.push(el("div", { class: "note" }, "Its version isn't read yet."));
diff --git a/src/api/events.rs b/src/api/events.rs
index bd6db70..496a077 100644
--- a/src/api/events.rs
+++ b/src/api/events.rs
@@ -17,6 +17,7 @@ use serde_json::{Value as JsonValue, json};
use super::auth::AuthenticatedUser;
use super::{ApiError, error_response, store_status};
+use crate::federation::client;
use crate::federation::fold::Federation;
use crate::federation::fork;
use crate::federation::jcs::Json as Jcs;
@@ -124,7 +125,9 @@ async fn event(State(state): State<AppState>, Path(id): Path<String>) -> Respons
/// `GET /events/counts`: what counts, as the store reads now: the current version, each
/// party's keys and nodes, the values at places, the members, and the proposals on the
/// current version, each with the events proposing it, the votes on it, the parties
-/// voting `true` and `false`, and whether it passed and whether it is dead.
+/// voting `true` and `false`, whether it passed and whether it is dead, and why a party's
+/// client backs it not, where it is no version that can be written on the current one
+/// (`client::backable`).
async fn counts(State(state): State<AppState>) -> Response {
with_store(&state, |store| {
let read = store.state();
@@ -152,6 +155,9 @@ async fn counts(State(state): State<AppState>) -> Response {
.into_iter()
.map(|(hash, ballot)| {
let tally = read.tally(current, &hash);
+ let none = read
+ .proposal(&hash)
+ .and_then(|proposed| client::backable(current, proposed).err());
(
hash.to_string(),
json!({
@@ -161,6 +167,7 @@ async fn counts(State(state): State<AppState>) -> Response {
"no": tally.no,
"passed": tally.passed,
"dead": tally.dead,
+ "none": none,
}),
)
})