1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// Copyright 2024-2026 Jonathan Shook
// SPDX-License-Identifier: Apache-2.0
//! Cycle-time data-source audit log.
//!
//! Emits one structured line per significant data-source event so
//! the operator can spot mismatches between what
//! [`crate::nodes::vectors::do_dataset_prebuffer`] *covered* and
//! what cycle-time accessors *opened*. The typical failure mode
//! this catches: prebuffer reports success but readers still hit
//! HTTP per cycle, because the facets the workload reads aren't
//! in the active profile's manifest.
//!
//! Output is routed through [`set_log_fn`] when the caller (the
//! activity runner, the test harness, …) installs a sink. With no
//! sink installed, lines go to stderr — preserves visibility from
//! contexts that don't carry an `observer::log` plumbing path
//! (unit tests, the `dryrun=` paths).
use OnceLock;
/// Severity for audit-channel events. Mirrors the activity-layer
/// observer levels so the runner's installed sink can map 1:1 to
/// `nbrs_activity::observer::LogLevel` without reformatting.
type LogFn = ;
static LOG_FN: = new;
/// Install the audit sink. Called once by the activity runner so
/// audit lines flow through `nbrs_activity::observer::log` and
/// land in `session.log` alongside the rest of the run output.
/// Subsequent calls are no-ops.
/// Emit a leveled message through the configured sink, falling
/// back to stderr when no sink is installed (unit tests, dryrun
/// paths, pre-init).
/// Convenience helpers for callsite ergonomics.
/// Record that `dataset_prebuffer(...)` was invoked. Emitted at
/// the top of `do_dataset_prebuffer` *unconditionally* — fires
/// even if the function bails on a resolve / profile-missing
/// error, so the absence of this line in `session.log` is
/// definitive evidence that `init prebuffer = ...` never
/// evaluated. Pairs with `record_prebuffered` (per-facet) and
/// `log_prebuffer_summary` (tail).
/// Record that the prebuffer pass covered a facet. Emitted from
/// inside the `view.prebuffer_all_with_progress` callback, once
/// per facet the manifest declared.
/// Record that a reader was opened for a facet. Emitted from
/// every `vectors::*` reader-open path *before* the actual
/// `view.<facet>()` / `open_facet_typed` call so the line lands
/// even if the open errors. `kind` distinguishes the open shape
/// (`uniform`, `ivvec32`, `generic-typed`, …) for at-a-glance
/// debugging.
/// One-line summary at the end of `dataset_prebuffer`. Pairs
/// with the per-facet `prebuffer: covered …` lines above and
/// the `vectordata: opened …` lines below to make the
/// covered-vs-opened delta easy to read.