• Replace the per-node error counter with a system-wide count of new err

    From Rob Swindell@1:103/705 to GitLab issue in main/sbbs on Sat Nov 21 14:55:30 2026
    open https://gitlab.synchro.net/main/sbbs/-/work_items/1387

    The per-node error counter in `node.dab` dates from v2, when each node often ran on its own computer. With all nodes normally running in one sbbs instance, a separate counter per node no longer maps to anything a sysop thinks about, and it disagrees with every other error count in the system.

    ## Current behavior

    Four unrelated error counts exist:

    | Counter | Scope | Incremented by | Lifetime |
    |---|---|---|---|
    | `node.errors` in `node.dab` | per node, `uchar` capped at 255 | `sbbs_t::errormsg()` only, non-repeats only (`logfile.cpp`) | until cleared |
    | sbbsctrl `Errors: N` status bar | per sbbsctrl process | every `LOG_ERR` from any server | until restart or Clear Errors |
    | sbbscon `error_count` | per sbbscon process | same | until restart |
    | MQTT `server/<name>/error_count` | per server | `errorlog()` -> `mqtt_errormsg()` | until server restart |

    Problems with the node counter:

    - `errormsg()` only counts when `cfg.node_num > 0`. The events thread is constructed as node 0, so event errors are written to `error.log` but counted nowhere in `node.dab`.
    - The logon notice (`text[CriticalErrors]`, `logon.cpp`) reports `criterrs`, which is the count for the one node the sysop logged into.
    - It counts `errormsg()` calls, while `error.log` receives every `LOG_ERR`-or-worse line from every server. The number never matches what the sysop finds in the log.
    - The count saturates at 255.

    ## Proposal

    Make `error.log` the single source of truth, with one system-wide "new errors since last acknowledged" count derived from it.

    1. **Acknowledge marker instead of a counter.** Store the acknowledged byte offset of `error.log` (plus a timestamp) in a small file beside it in `logs_dir`. "New errors" are the entries past that offset, counted at display time by scanning the tail. A file shorter than the offset (deleted or truncated) is all new.
    - No extra write per error, so an error storm costs nothing beyond the append already done.
    - Every server, the events thread, and any other process writing `error.log` is covered with no per-server code.
    - The count survives restarts, unlike the sbbsctrl, sbbscon, and MQTT counts.
    2. **One shared C helper**, usable from sbbs.dll and the monitors, returning the new-entry count, the newest timestamp, and optionally a per-server breakdown. Entries already carry the `term`/`evnt`/`web`/`mail` prefix and the host name, so "3 new errors (2 term, 1 evnt)" needs no log format change.
    3. **One acknowledge action** that sets the marker to the current file size. `;ERR` (`CS_ERROR_LOG`), sbbsctrl Clear Errors, umonitor, gtkmonitor, and `node` call it instead of zeroing every node record.
    4. **Consumers switch to the system-wide number:**
    - The logon notice shows the system-wide count.
    - The sbbsctrl status bar and sbbscon prompt show the same persistent count.
    - A read-only JS property (e.g. `system.new_errors`) and a retained BBS-level MQTT topic expose it.
    5. **Retire `node.errors` without changing the record layout.** Keep the byte in `node_t` and the `errors=` key so `node.dab` and older monitors still parse. Stop incrementing it and drop the "N errors" suffix from node status lines (`getnode.cpp`, `userdat.c`, `node.c`, `presence_lib.js`). `bbs.node_errors` and `system.node_list[n].errors` remain as deprecated zeros.

    The push notification side is unchanged: `errorlog()` already notifies `cfg->erruser` at `cfg->errlevel`.

    ## Open question

    Should the logon notice count all servers' `LOG_ERR` lines, or only `term` and `evnt` entries? Counting everything keeps the number equal to what is in the log; a noisy web or mail server would inflate it. One option is for the logon notice to count `term`+`evnt` only while the monitors show the total.

    — *Authored by Claude (Claude Code), on behalf of @rswindell*
    --- SBBSecho 3.38-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)