Skip to main content

Module doctor

Module doctor 

Source
Expand description

The mesh self-check: every prerequisite proved on this machine alone, no second node required. Deterministic checks in a fixed order, each with its own verdict, so “why is the mesh not working” has an answer that names the broken link instead of a shrug — and, when a check fails or limits cooperation, what that means and what to do. Read-only toward the repository; the sockets it probes are ephemeral and closed before it answers.

One check judges a decision rather than the machine. runtime reads what the mesh runtime of the process it runs in decided: in a shared server, whether an enabled declaration actually activated, and why not when it did not — the failure a declaration that says on and a server that is off would otherwise be, silently (ADR 0059). In any other process nothing activates the mesh, and the check reports that absence instead of judging it; majordomus mesh doctor therefore asks the running server for the report when one serves the checkout, so that the verdict is the server’s.

What this cannot see is whether the server’s cooperation thread beats and whether its peers answer. That is mesh verify, which asks the server for a live round.

use majordomus_cli::mesh::doctor::doctor;

// No declaration is the default posture, and the self-check says so and runs on.
let report = doctor(None);
let declaration = report.checks.iter().find(|c| c.check == "declaration").unwrap();
assert!(declaration.ok);
assert!(declaration.detail.contains("default posture"));

Structs§

DoctorCheck
One check’s verdict.
MeshDoctorReport
The whole self-check.

Functions§

declaration_source
The trust-root check: which copy of the declaration is obeyed, and every line of the working tree’s copy this runtime ignores because the trunk’s copy does not say it (super::root). None when there is no declaration to judge.
doctor
Run the self-check against the declaration as parsed (or its absence, or its error), in a process no shared server runs in. Deterministic order, no second node required, no repository writes.
doctor_at
doctor for the repository at root, in the process whose mesh runtime decided runtime: adds whether the repository has a mesh identity cooperation can match on, and judges what the runtime decided about the declaration.
journal_check
The journal check: whether the cooperation journal’s file holds what the journal holds. A failed append keeps the event in memory and in replication, loses it from this machine’s disk and is not acknowledged as durable; an unreadable line is one the last reload could not use; unread bytes lie beyond the reload bound.
runtime_verdict
The runtime verdict. None is a runtime nobody decided on — the command line’s, a test’s — whose inactivity is an absence and never a failure. A decided runtime is active (a degraded one names its failed providers, and fails only when no provider runs at all), off as declared, off because there is nothing to activate, or — the one failure — off under an enabled declaration, carrying the server’s reason. The runtime verdict alone: what a server decided about the declaration, judged as mesh doctor judges it. Health reads this one check rather than running the doctor’s probes, which open sockets.