feat(chord,durable): failures are watch calls; one vocabulary for watches, observers and reports

Chord's shared watch: listeners take a tagged call, { kind: "value", value, ops, retired } or
{ kind: "failed", error }; a recoverable failure keeps the watch open and the next value arrives as
[["r", value]]; WatchEnd is tagged by kind, and an aborted context ends a watch "aborted".

Durable: observers take the watch's shapes (advance(call, ctx), end(end)); onReport(report) with
report.kind and report.error, session_failed is storage_failed; subscribeCommits is observeCommits;
SessionEnd and ReportFrom are tagged by kind; FileChange is tagged and file watchers stop with
stop(ctx); CompactionFailure and CompactionStatus name their trigger (pi.live version 2 with a
migrate); the task_outdated report uses the scheduler's reasons; TaskInspection's ready is pending;
DocumentCommitChange is tagged. Stored formats are unchanged.
This commit is contained in:
Mario Zechner 2026-10-27 20:38:08 +00:00
parent d3398f826a
commit 5f312dac4c
84 changed files with 2196 additions and 1156 deletions

View file

@ -64,7 +64,9 @@ const window = { min: 10, max: 20 };
let watch = await root.watch(context, window);
let view = transcript.merge(watch.value);
render("attach", view);
watch.start(async ({ value }) => {
watch.start(async (call) => {
if (call.kind !== "value") return;
const { value } = call;
view = transcript.merge(value);
});
@ -84,7 +86,9 @@ await chat(40);
watch = await root.watch(context, { ...window, ...transcript.resume });
view = transcript.merge(watch.value);
render("resume after 40 missed", view);
watch.start(async ({ value }) => {
watch.start(async (call) => {
if (call.kind !== "value") return;
const { value } = call;
view = transcript.merge(value);
});