@zerotal/monitor 1.4.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,10 +4,57 @@ All notable changes to this package are documented here. The format is
4
4
  based on [Keep a Changelog](https://keepachangelog.com/); this package
5
5
  follows the Zerotal monorepo's unified versioning.
6
6
 
7
- **Maturity: `experimental`**
7
+ **Maturity: `stable`**
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [1.5.1] — 2026-08-15
12
+
13
+ ### Fixed
14
+
15
+ - **Open-by-default access in development never applied.** The predicate read `APP_ENV`,
16
+ which holds the runtime mode once the app has booted, so the panel demanded an explicit
17
+ `auth` predicate even on a developer's machine. It asks `devSurfacesEnabled()` now — and
18
+ still requires one anywhere that is not explicitly a development environment.
19
+
20
+ ## [1.5.0] — 2026-08-15
21
+
22
+ ### Added
23
+
24
+ - **Tests for the three riskiest untested modules**, chosen by consequence rather
25
+ than by coverage percentage:
26
+
27
+ - **`MonitorAuthMiddleware`** — the only thing between the public internet and a
28
+ page showing recent requests, their users, their IPs and the SQL the app ran.
29
+ Pinned against the two ways a gate fails open without anyone noticing: a
30
+ forgotten `await` on an async predicate (a promise is always truthy, so a
31
+ denying predicate would admit everyone) and a predicate that throws. Also pins
32
+ that the _default_ predicate survives config merging as a callable — `deepMerge`
33
+ cannot carry a function through, and the reattach only fires when the caller
34
+ supplied one.
35
+ - **`RingBuffer` / `TimeWindow` / `percentile`** — the bounded structures that
36
+ keep monitoring memory from growing without limit. A buffer that quietly stops
37
+ evicting is a memory leak in the observability layer, and an off-by-one
38
+ percentile misreports latency in the direction nobody checks.
39
+ - **`renderPrometheus`** — the one output a machine parses rather than a person
40
+ reads, where a scraper rejects a malformed response without telling the
41
+ application. Covers label escaping for route paths carrying a quote, a
42
+ backslash or a newline, and metric-name sanitisation for display-string gauge
43
+ labels — all of which come from application data, so none are hypothetical.
44
+
45
+ Monitor's suite goes from 49 tests to 81.
46
+
47
+ ### Changed
48
+
49
+ - **Maturity is now `stable`** — the public API follows SemVer strictly for the rest
50
+ of the 1.x line. Both gates are closed: `@zerotal/flow` and `@zerotal/flow-ui` (which
51
+ the panel renders through) are themselves stable now, and the coverage gap is closed
52
+ where it mattered.
53
+
54
+ Worth stating plainly, since the surface looks larger than it is: of 685 lines of
55
+ public API, 65 entries are type definitions describing the snapshot shape and only
56
+ 11 are callable entry points — every one of which is documented.
57
+
11
58
  ## [1.1.0] — 2026-08-08
12
59
 
13
60
  ### Fixed
package/README.md CHANGED
@@ -170,5 +170,7 @@ src/
170
170
 
171
171
  ## Status
172
172
 
173
- `maturity: experimental`. The live adapters degrade gracefully when an optional
174
- peer (`queue`, `scheduler`, `telemetry`) isn't installed.
173
+ `maturity: stable` the public API follows SemVer strictly for the rest of the 1.x
174
+ line, and its shape is snapshotted in `api-surface.md`, which CI diffs on every change.
175
+ The live adapters degrade gracefully when an optional peer (`queue`, `scheduler`,
176
+ `telemetry`) isn't installed.
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@zerotal/monitor",
3
- "version": "1.4.0",
3
+ "version": "1.5.1",
4
4
  "license": "MIT",
5
- "maturity": "experimental",
5
+ "maturity": "stable",
6
6
  "private": false,
7
7
  "type": "module",
8
8
  "main": "./src/index.ts",
@@ -29,14 +29,14 @@
29
29
  "typecheck": "tsc --noEmit"
30
30
  },
31
31
  "dependencies": {
32
- "@zerotal/core": "1.4.0",
33
- "@zerotal/flow-ui": "1.4.0",
34
- "@zerotal/flow": "1.4.0"
32
+ "@zerotal/core": "1.5.1",
33
+ "@zerotal/flow-ui": "1.5.1",
34
+ "@zerotal/flow": "1.5.1"
35
35
  },
36
36
  "devDependencies": {
37
- "@zerotal/queue": "1.4.0",
38
- "@zerotal/scheduler": "1.4.0",
39
- "@zerotal/telemetry": "1.4.0"
37
+ "@zerotal/queue": "1.5.1",
38
+ "@zerotal/scheduler": "1.5.1",
39
+ "@zerotal/telemetry": "1.5.1"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@zerotal/queue": "^1.0.0",
package/src/config.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * auth: (user) => user?.role === "admin",
8
8
  * });
9
9
  */
10
- import { deepMerge, isDevSurfaceAllowed } from "@zerotal/core";
10
+ import { deepMerge, devSurfacesEnabled } from "@zerotal/core";
11
11
  import type { RetentionMode } from "./store/MonitorDb.ts";
12
12
  import type { AlertThresholds } from "./alerting.ts";
13
13
 
@@ -129,7 +129,7 @@ export interface ResolvedMonitorConfig extends MonitorConfigShape {
129
129
  // documented `APP_ENV=production` deploy would otherwise expose the panel.
130
130
  // Only explicitly non-prod envs get open-by-default access; everything else
131
131
  // (unset, staging, production) must supply an explicit `auth` predicate.
132
- const defaultAuthOpen = (): boolean => isDevSurfaceAllowed(Bun.env["APP_ENV"] ?? "");
132
+ const defaultAuthOpen = (): boolean => devSurfacesEnabled();
133
133
 
134
134
  const defaults: ResolvedMonitorConfig = {
135
135
  path: "/monitor",
@@ -18,7 +18,7 @@ import type {
18
18
  CommandRan,
19
19
  } from "@zerotal/core";
20
20
  import type { MonitorStore } from "../MonitorStore.ts";
21
- import { collectRequestState, markRecorded } from "./ctxBuffers.ts";
21
+ import { markRecorded } from "./ctxBuffers.ts";
22
22
 
23
23
  // Framework/asset noise the panel shouldn't chart as application traffic.
24
24
  const IGNORE_PREFIXES = [