feat(open): the open narrates itself, on a channel production cannot clamp
Some checks failed
CI / Node 22 (push) Has been cancelled
CI / Node 24 (push) Has been cancelled
CI / Integration + conformance (Node 22) (push) Has been cancelled
CI / Bun (latest) (push) Has been cancelled
Some checks failed
CI / Node 22 (push) Has been cancelled
CI / Node 24 (push) Has been cancelled
CI / Integration + conformance (Node 22) (push) Has been cancelled
CI / Bun (latest) (push) Has been cancelled
An operator watched a production service open a 16 GB store and print nothing for three minutes before its first line of work. Two defects, both fixed here. The narration was written to `prodLog.warn`, and every environment that looks like production clamps the logger to ERROR — so the phase breakdown that would have named the slow phase was composed and thrown away. `prodLog.narrate` is always visible, like `error`: it carries the two things an operator is entitled to hear from a database regardless of a cost setting — why it is slow and what it is doing about it. `silent: true` still silences it; that is a request, not a default. And nothing spoke DURING a phase, only after the whole open. init() now runs an unref'd heartbeat that every 5s names the phase currently running, its elapsed wall and what it is paying for, plus one line per phase as it ends for any phase over 2s. The generation-log fold's own progress and completion lines move to the same channel and now carry their wall — they were invisible in production, which is how an operator came to restart a converging fold three times. Pins: tests/integration/open-narration.test.ts — narrate() survives the clamp that silences warn(); a 6.5s storage-init produces a heartbeat naming the phase and a completion line naming its wall, with the logger clamped to ERROR.
This commit is contained in:
parent
e652162c1f
commit
afe08a1ff9
4 changed files with 202 additions and 15 deletions
|
|
@ -266,6 +266,26 @@ export const prodLog = {
|
|||
console.error(message, ...args)
|
||||
},
|
||||
|
||||
/**
|
||||
* THE NARRATION CHANNEL — always visible, exactly like `error`.
|
||||
*
|
||||
* `warn`/`info`/`log` below are clamped to ERROR in any environment that
|
||||
* looks like production (see isProductionEnvironment), which is the right
|
||||
* default for chatter and the wrong one for the two things an operator is
|
||||
* entitled to hear from a database no matter what: WHY IT IS SLOW and WHAT
|
||||
* IT IS DOING ABOUT IT. A production service opening a 16 GB store spent
|
||||
* three minutes emitting nothing at all — the phase timings that would have
|
||||
* named the slow phase were written to `warn` and thrown away by the log
|
||||
* level. Progress and cost narration goes here; it is never a per-record
|
||||
* line, always a phase, a wall, or a bounded-cadence heartbeat.
|
||||
*
|
||||
* `silent: true` still silences it — that is the consumer's explicit
|
||||
* request, not a cost default.
|
||||
*/
|
||||
narrate: (message?: any, ...args: any[]) => {
|
||||
console.warn(message, ...args)
|
||||
},
|
||||
|
||||
// These are suppressed in production unless BRAINY_LOG_LEVEL is set
|
||||
warn: (message?: any, ...args: any[]) => smartConsole.warn(message, ...args),
|
||||
info: (message?: any, ...args: any[]) => smartConsole.info(message, ...args),
|
||||
|
|
|
|||
Reference in a new issue