Write the backend's logs as the estate's log line (AHT-204) #1011
No reviewers
Labels
No labels
bug
campaign-editor-ui
dependencies
design
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
javascript
question
queue
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
romaine-life/chess-tactics!1011
Loading…
Reference in a new issue
No description provided.
Delete branch "aht-204-logline"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of AHT-204, one log line across the estate.
Before: the backend wrote free text with no time, such as
console.error('OIDC callback failed:', error)orslow request: GET /api/x 200 2310ms. The solve and train Jobs wrote their own JSON lines ({"t":"...Z","event":"done",...}). Error objects went out unmasked.After: every line is a romaine-life/logline line on stdout, through
backend/log.js:server.js, plussupervisor.js,oidcAuth.jsandself-check.js. Each message is fixed text and what varies goes in fields.outside/errorText, which apply logline'sredactand cap the text at 4 KiB. The session store holds OAuth tokens, so an error from it can carry one.solve-worker.mjsandtrain-worker.mjslog throughworkerEvent. The event becomes the message, the other keys become snake_case fields, and objects are written as JSON. Anerror,*_erroror*_failedevent is logged at error level, and itserrorfield is masked.netplay-smoke-test.js(listening),smoke-test.js(postgres ready, both modes) andsolve-worker-smoke-test.js(done) now read lines back with logline'sparsethroughentries()instead of matching substrings.self-check.jsloadslog.js, so the image check proves the image's Node 22 loads the ES module withrequire().@romaine-life/logline0.1.4 comes from Forgejo's npm registry through a newbackend/.npmrc, pinned exactly. The Dockerfile copies it and mountsFORGEJO_PACKAGES_TOKENfor the backend'snpm ci.Unchanged: the slow-request threshold (ADR-0258 logs only requests over
SLOW_REQUEST_LOG_MS, path without query). No full access log is added.Test:
backend/log.test.js(newtest:log, first intest:backend) captures stdout, parses every line, and covers fields, masking, the cap, worker events,entries(), and a fresh process loading the module with no warning. I ran these locally and they pass:test:log,test:oidc,readiness.test.js,netplay-smoke-test.js,solve-worker-smoke-test.jsandnpm run lint.ci-checkpassed. The DB-backedsmoke-test.jsruns on the PR.🤖 Generated with Claude Code
merge-queue stopped this at
1ee551a: CI failed: Suite web-app / check-test (backend) (pull_request). Push a fix, or once it is fixed outside this pull request, remove and re-add thequeuelabel.predrawnArchiveUpgradePath.test.js reads server.js and smoke-test.js as text: the migration target now prints as log.info('postgres schema migration target', ...) before runMigrations(), and the check-mode proof starts at the parsed secondaryReadyEntry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>