home-hosted 0.9.11 → 0.10.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/AGENTS.md CHANGED
@@ -111,10 +111,61 @@ workspace config guard, so a busy default port turns config tests red for the wr
111
111
  - **A bounded read stays bounded.** `logs --lines 1e3` falls back to the default and `0x10` is not the
112
112
  "whole log" sentinel (`src/cli/logs.ts`); `--lines N` reads a tail, never the whole file
113
113
  (`test/cli/logs.test.ts`).
114
+ - **A reader that hangs up is a finished conversation, not a crash.** `treatClosedReaderAsDone()`
115
+ (`src/cli/io.ts`) is installed **once** at the entry; only `EPIPE` is the reader leaving
116
+ (`test/cli/epipe.test.ts`). Why not `SIGPIPE`: [`.agentDocs/GOTCHAS.md`](.agentDocs/GOTCHAS.md).
117
+ - **One refusal is one message on one stream.** A refusal's whole text goes to stderr, including any
118
+ list it exists to explain; stdout carries only an answer (`test/cli/backup-args.test.ts`).
119
+ - **A browser API that needs a secure context is absent on the origin the docs promise.** Guard the
120
+ feature, not the call: `copyText` (`uis/stock/src/lib/clipboard.ts`) falls back to `execCommand` and
121
+ returns a verdict, or a button is dead on a LAN page; `uis/stock/test/clipboard-source.test.ts`
122
+ fails any other file that names `navigator.clipboard`.
123
+ - **A row of chrome is measured at 320 px with the tap floor counted.** No mount can measure a
124
+ layout, so `uis/stock/test/topbar-width.test.ts` pins the declarations that keep the title from
125
+ collapsing to 0 px.
126
+ - **A retention knob bounds the directory, not a loop.** Derive the set from the directory once
127
+ (`ownedFiles`/`retained`, `src/services/log-files.ts`) so the list, the size and the tail agree with
128
+ `readdir`, and prune inside `rotate` (`test/services/log-files.test.ts`).
129
+ - **A file a route hands back is streamed, and the bound decides how much it matters.** `logs.maxBytes`
130
+ allows 100 MB per rotation, so `createReadStream` + `stat` for `Content-Length`, in both routes. A
131
+ schema ceiling is not a reason to buffer: it is the size a person downloads at.
132
+ - **A page the panel serves must not be blank without a CDN.** Render real content from
133
+ `spec.json` first (`src/openapi-reference.ts`), then load any richer browser as optional
134
+ enhancement, **pinned** — an unpinned `import` from a CDN is a third party that can break the
135
+ panel's page. Before blaming a library for being online-only, drive its self-hosted build offline:
136
+ the claim is usually about the integration, not the library.
137
+ - **An entry's server is not always the process the panel spawned.** A compose entry's containers
138
+ outlive their wrapper, so resolve what the entry *declares it runs* (`composeTarget`), stop that,
139
+ and decide from a **fresh listing** — never the signal or `docker stop`'s exit code, which is 0 for
140
+ a container it could not end. A survivor is a `conflict` naming it (`src/providers/docker.ts`).
141
+ - **A per-frame path may not call a syscall per server.** The frame is built once a second and once
142
+ per request, so anything reading the host, the filesystem or the process table from a view builder
143
+ is cached on its own clock, not merely memoised per call (`lanAddress`, `src/helpers/bind.ts`).
144
+ - **A generated config says what it means for every branch, not just the one it names.** A name no
145
+ policy names gets the engine's **default** (the public CA), not "no automation" — so every local
146
+ name must be named in the internal policy too. A state describing something that has not happened
147
+ is a promise: decide `local` from the leaf in the store, not the hostname's shape.
114
148
  - **A metric with no reading is absent, never zero.** A scrape has no page to qualify a number, so an
115
149
  alerted-on gauge published as `0` from an unsampled view is indistinguishable from a healthy one
116
150
  and silences the rule that exists to catch it. Omit the series (`src/api/metrics.ts`), and never
117
- suffix `_total` a value that a user action resets.
151
+ suffix `_total` a value that a user action resets — no series here is a counter, and
152
+ `test/api/panel.test.ts` enumerates the scrape and fails on a `_total` name or a `counter` type.
153
+ - **A reading is labelled with what it measured, and a fallback must measure the same thing.** The
154
+ "CPU temp" tile took `Math.max` over every hwmon chip, so a box with an NVMe reported the **disk's**
155
+ temperature as the CPU's — and fired the temperature alert on it. Pick the sensor *by name*
156
+ (`coretemp`/`k10temp`/`x86_pkg_temp`/`cpu-thermal`, then `acpitz`), and take the max only inside that
157
+ tier, because a CPU package honestly has several dies. `pickCpuTemperature` (`src/providers/host.ts`)
158
+ is the one place that decides, so it is testable without a sensor. **A platform with no sensor
159
+ reports `null` and the UI says `n/a`** — WSL2 exposes no thermal zone at all, and the Windows host's
160
+ `MSAcpi_ThermalZoneTemperature` returns a constant 20 °C whatever the load, so reaching for it
161
+ would publish a fabricated number in the tile that exists to warn about heat.
162
+ - **A throttle window belongs to a message that arrived.** A send that failed must give its window
163
+ back (`releaseCooldown`), or the alert that would have reached a recovering receiver is the one the
164
+ outage took. Undo only the deadline *this* send armed; `notify()` is fire-and-forget.
165
+ - **A header is a byte string, and a stub does not make it one.** HTTP headers are Latin-1, so
166
+ validate at the door (`headerProblem`/`parseHeaders`) rather than let a `ByteString` engine message
167
+ land on a person's row, and treat a header name as case-insensitive
168
+ (`test/services/notifications.test.ts`).
118
169
  - **Name the cause the fix follows, not the one the code path suggests.** Node reports a missing
119
170
  working directory and a missing program with the same `ENOENT`, so `describeSpawnError` checks the
120
171
  resolved `cwd` **and** whether the field holds a whole command line before it blames the command —
@@ -176,6 +227,11 @@ workspace config guard, so a busy default port turns config tests red for the wr
176
227
  when an apply leaves pieces behind (`src/cli/backup.ts`). The same shape is why a scoped id is
177
228
  checked against the plan in **both** directions: `--exclude` with a typo excludes nothing, and an
178
229
  archive restored that way carries exactly the credentials the person meant to drop.
230
+ - **An archive outlives the release that wrote it.** Read a snapshot through the migrations `migrate`
231
+ would run (`liftArchived`, `src/services/backups.ts`), write the **lifted** file, and stamp it with
232
+ the release that wrote it; the newer direction stays a refusal from the manifest.
233
+ - **A summary line that disagrees with the lines above it is a bug.** Count every outcome a command
234
+ can have.
179
235
  - **Conventional commits** — changelogen derives the changelog and `scripts/check-release-version.mjs`
180
236
  the version bump. Below 1.0 the **minor is the breaking channel**: a fix is a patch, a minor means
181
237
  someone has to read the release notes and act — ask what the user has to do, not whether the commit
@@ -232,6 +288,16 @@ These prevent defects if broken. The *why* for the non-obvious ones is in
232
288
  per-workspace service through `PanelService.requireWorkspace(id)`, never a module global.
233
289
  - **A restore writes only where a config says** — archive allowlist, `origin` matching first, symlinks
234
290
  never recreated.
291
+ - **A declared path is the capture boundary, and its bytes keep their modes.** *Both* directions of a
292
+ backup obey the declared path: the restore may not write through a link that leaves it, and the
293
+ capture may not read through one — a `media -> /mnt/nas` link inside a declared `data/` put the whole
294
+ share in every archive, and `du` on the declared path still said empty. The allowlist is a *move*
295
+ rule, not a character rule: `My Photos/` and `ünïcode/日本語.txt` are what a real data tree holds, so
296
+ a `\w` allowlist refused the archive the panel had just written. And a mode is part of the data —
297
+ `0600`/`0700`/`0755` travel, a setuid bit does not — because a restore that widens a secret to `0644`
298
+ changes who can read what the backup existed to protect.
299
+ `src/providers/archive.ts` (`walk`, `permissionBits`), `src/services/backups.ts`
300
+ (`isSafeArchiveEntry`), `test/providers/archive.test.ts`.
235
301
  - **A port is only ever freed from a fresh lookup, never a quoted pid.** `free-port` re-lists the
236
302
  listeners and refuses any in `supervisedPids()` instead of killing it; a docker-published port has
237
303
  no pid this user may see, so the container docker reports publishing *that* port is stopped instead.
@@ -250,6 +316,19 @@ These prevent defects if broken. The *why* for the non-obvious ones is in
250
316
  - **The reverse proxy's engine is a process the panel owns, not a server entry.** Its config is applied
251
317
  through the engine's admin API (atomic, never hand-edited), it runs under the same nanny a
252
318
  `persistent: true` entry uses, and its admin endpoint stays panel-side.
319
+ - **A claim that a dependency touches nothing else has to be checked against the dependency.** The
320
+ proxy docs said "nothing else on the machine is touched", and the engine's own log said otherwise on
321
+ the very first start: `pki.ca.local | installing root certificate (you might be prompted for
322
+ password)` then `certificate installed properly in linux trusts` — the local CA's root goes into
323
+ `/etc/ssl/certs`, which is why a `.lan` name is trusted at all, and why that first start needs
324
+ `sudo`. Measured: one new `Caddy_Local_Authority_-_2026_ECC_Root*.pem` per engine data directory, so
325
+ two homes on one box leave two roots, and a root outlives the `.hh` it came from. The knob exists
326
+ (`apps.pki.certificate_authorities.local.install_trust`, verified by `POST /load`: `install_trust`
327
+ under `ca`, under `apps.tls`, and on the issuer are all `unknown field`) and the panel does not set
328
+ it, which is the right default — but the doc has to say what happens. Any run of the engine against
329
+ a scratch home therefore **writes the host's trust store**; say so and clean up the root and its
330
+ `/etc/ssl/certs` hash symlinks, or the next round inherits a machine with a dozen dead CAs.
331
+
253
332
  - **Cross-platform is a hard requirement.** Linux/macOS/Windows: `/proc` vs `ps` vs Win32_Process,
254
333
  process groups vs `taskkill /T`, graceful fallbacks, no shell utilities assumed. Three Windows
255
334
  behaviours no other runner here can exercise, so each is decided in **one shared helper** rather