Skip to main content

Module observatory

Module observatory 

Source
Expand description

The observatory module: what the Observatory (/ui/observatory) may carry to a place where no mesh runs, and the recording the repository carries there (ADR 0158, I2678).

The reader of a published snapshot is a process that runs no mesh, so the three scenes of the mesh have nothing live to draw on the public site. They may draw a recording: the scenes of a process that did run one, captured at a moment, made fit for publication, and committed. A recording is drawn only where no mesh runs, and it is labelled a replay with the time it was recorded; it is never drawn as live.

  • observatory.capture answers the recording this process would make now: the mesh scenes it has live, pseudonymized. It writes nothing; whoever publishes it commits it.
  • observatory.replay answers the recording the repository carries at RECORDING.

Fit for publication means that a recording names no machine, runtime, session or event by its identity: machines are machine 1, machine 2 in the order the mesh listed them, runtimes and sessions are ordinals, and an event keeps only its kind, its logical clock and its time. What remains is the shape of the cooperation, which is what the scene draws.

The lifecycle, from capture to replay: a process that runs the mesh projects its scenes, the projection is redacted with a manifest, the recording is committed, and a process that runs none reads it back.

use majordomus_cli::capability::builtin::observatory::{redact, replay_at, RECORDING, RECORDING_SCHEMA};
use serde_json::json;
let live = [("mesh".to_string(), json!({
    "machines": [{ "id": "641bdb94dae9f622", "label": "641bdb94", "local": true, "runtimes": [] }],
    "known": 1, "refused": 0,
}))].into_iter().collect();
let scenes = redact(&live);
let dir = tempfile::tempdir().unwrap();
assert!(!replay_at(dir.path()).unwrap().present, "nothing recorded yet");
let recording = json!({
    "schema": RECORDING_SCHEMA, "recorded_at": "2026-10-14T05:00:00Z", "scenes": scenes,
    "manifest": { "sources": ["mesh.peers"], "removed": ["identities"] },
});
let path = dir.path().join(RECORDING);
std::fs::create_dir_all(path.parent().unwrap()).unwrap();
std::fs::write(&path, recording.to_string()).unwrap();
let replayed = replay_at(dir.path()).unwrap().recording.unwrap();
assert_eq!(replayed.scenes["mesh"]["machines"][0]["label"], "machine 1");

Structs§

ObservatoryEvents
The Observatory’s events above a cursor, as the activity scene draws them.
ObservatoryEventsInput
The input of observatory.events: a cursor and a page size.
ObservatoryRecording
The mesh scenes of one process at one moment, fit for publication.
ObservatoryReplay
The recording the repository carries, or that it carries none.
RecordingManifest
What a recording is a record of: the capabilities read, the window of events it holds, and what was removed from what they answered, with the reason.
RecordingWindow
The events a recording holds, from first to last.

Constants§

RECORDED
The scenes a recording may carry: the ones that need a mesh.
RECORDING
Where the repository carries its recording, relative to the repository root.
RECORDING_SCHEMA
The schema word of a recording.
REMOVED
What every recording removes, and why: the manifest states it rather than leaving a reader to infer it from what is missing.

Functions§

module
The observatory module: three read-only capabilities, none cached, because each is read to learn what is true now: the capture of this process’s mesh, the recording the repository carries, and the journal’s events above a cursor.
redact
The scenes of a projection made fit for publication: identities replaced by ordinals, event bodies and names never carried. A scene this does not know is dropped.
replay_at
The recording at RECORDING under root. Absent is present: false; a file that is there and cannot be read or is not a recording is an error, never an empty answer.