Write the backend's logs as the estate's log line (AHT-204) #27

Merged
merge-queue merged 1 commit from aht-204-logline into main 2026-11-26 14:36:09 -08:00
Owner

Work package: AHT-204, one logging standard across at-home.

The backend's logs become the estate's one log line, the same way auth and chess-tactics moved.

  • backend/log.js (new): @romaine-life/logline 0.1.4, pinned exactly, writing to stdout through its stream logger. It also provides outside and errorText, which mask credentials with redact and cap the text at 4 KiB.
  • Each of the 14 console calls in server.js, supervisor.js and self-check.js becomes a level, a fixed message and fields. Error stacks and upstream error text go through errorText. No token, code, cookie or Authorization value is logged.
  • supervisor.js sets BAKED_BACKEND_DIR so that the hot copy of server.js loads the baked log.js, which is chess-tactics' arrangement.
  • backend/.npmrc points to Forgejo's npm registry. The Dockerfile copies it and mounts the FORGEJO_PACKAGES_TOKEN BuildKit secret on npm install.
  • backend/log.test.js (new) reads the lines back with logline's parse. It covers absent fields, masking, the cap, stacks kept on one line, and a real server start with no database, where every stdout line must parse and stderr must be empty. The self-check now loads log.js, which shows the image's Node can require() the ES module.

Not changed: there is still no per-request line. The backend never had request logging (no morgan, no Hono logger), and chess-tactics, which this backend comes from, kept none either.

🤖 Generated with Claude Code

Work package: [AHT-204](https://openproject.home.romaine.life/wp/AHT-204), one logging standard across at-home. The backend's logs become the estate's one log line, the same way auth and chess-tactics moved. - `backend/log.js` (new): `@romaine-life/logline` 0.1.4, pinned exactly, writing to stdout through its stream logger. It also provides `outside` and `errorText`, which mask credentials with `redact` and cap the text at 4 KiB. - Each of the 14 console calls in `server.js`, `supervisor.js` and `self-check.js` becomes a level, a fixed message and fields. Error stacks and upstream error text go through `errorText`. No token, code, cookie or Authorization value is logged. - `supervisor.js` sets `BAKED_BACKEND_DIR` so that the hot copy of `server.js` loads the baked `log.js`, which is chess-tactics' arrangement. - `backend/.npmrc` points to Forgejo's npm registry. The Dockerfile copies it and mounts the `FORGEJO_PACKAGES_TOKEN` BuildKit secret on `npm install`. - `backend/log.test.js` (new) reads the lines back with logline's `parse`. It covers absent fields, masking, the cap, stacks kept on one line, and a real server start with no database, where every stdout line must parse and stderr must be empty. The self-check now loads `log.js`, which shows the image's Node can `require()` the ES module. Not changed: there is still no per-request line. The backend never had request logging (no morgan, no Hono logger), and chess-tactics, which this backend comes from, kept none either. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Write the backend's logs as the estate's log line (AHT-204)
All checks were successful
Suite tofu / apply (pull_request) Has been skipped
Suite web-app / scope (pull_request) Successful in 56s
Suite cluster-service / check-image (pull_request) Has been skipped
Suite default / check-rules (pull_request) Has been skipped
Suite tofu / check-plan (pull_request) Has been skipped
Suite cluster-service / reused-checks (push) Has been skipped
Suite tofu / scope (push) Has been skipped
Suite tofu / check-plan (push) Has been skipped
Suite tofu / apply (push) Has been skipped
Suite tofu / reused-checks (push) Has been skipped
Suite web-app / scope (push) Has been skipped
Suite web-app / check-image (push) Has been skipped
Suite web-app / publish (push) Has been skipped
Suite web-app / publish-static (push) Has been skipped
Suite web-app / reused-checks (push) Has been skipped
Suite cluster-service / scope (pull_request) Successful in 45s
Suite default / scope (pull_request) Successful in 46s
Suite cluster-service / reused-checks (pull_request) Successful in 20s
Suite cluster-service / check-manifests (pull_request) Has been skipped
Suite cluster-service / publish (pull_request) Has been skipped
Suite web-app / publish (pull_request) Has been skipped
Suite web-app / publish-static (pull_request) Has been skipped
Suite tofu / scope (pull_request) Successful in 44s
merge-queue landed on main
Suite default / check-fetches (pull_request) Successful in 24s
Suite tofu / reused-checks (pull_request) Successful in 24s
Suite web-app / check-test (backend) (pull_request) Successful in 1m59s
Suite default / reused-checks (pull_request) Successful in 23s
Suite web-app / reused-checks (pull_request) Successful in 24s
Suite web-app / check-image (pull_request) Successful in 3m4s
e7cc964d52
Every console call in the backend (server, supervisor, self-check) now writes the
estate's standard line through backend/log.js (@romaine-life/logline 0.1.4 from
Forgejo's npm registry): a fixed message with key=value fields, error text masked
with redact and capped at 4 KiB. The hot copy of server.js finds log.js through
BAKED_BACKEND_DIR, which the supervisor sets. log.test.js reads the lines back with
logline's parse, including a real server start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
merge-queue deleted branch aht-204-logline 2026-11-26 14:36:10 -08:00
Commenting is not possible because the repository is archived.
No description provided.