Skip to content

feat(daemon,cli): daemon log records every request and background failure; daemon logs --follow - #187

Merged
V3RON merged 5 commits into
mainfrom
feature/169
Oct 1, 2026
Merged

V3RON merged 5 commits into
mainfrom
feature/169

Conversation

@V3RON

@V3RON V3RON commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Closes #169

daemon.log now records what the daemon was asked to do and what went wrong (ADR 0006).

  • Every dispatched call leaves one operation line, built only in runDispatch, for socket, MCP, HTTP and gateway dispatch. Its level comes from the new contract effect: write at info, read at debug, failure at info, INTERNAL at error.
  • Core modules log the background failures they handle, with device, step, error, and lease or requester where known.
  • At debug, LoggingProcessRunner logs each device command with its exit code. It never logs env, input or output.
  • A failing event subscriber is one JSON line through the logger.
  • simlock daemon logs --follow polls through Filesystem/Clock, detects rotation from daemon.log.1 changing identity, and waits for a missing file.

Deviations from the spec:

  • doctor --purge-orphans counts as a write, because it destroys devices.
  • A call refused before input validation logs its code but no message, because that message quotes raw wire input.

Completion conditions

  • Lease and release over the socket each leave one line with requester and duration. e2e/daemon-log.test.ts
  • Unknown model: the line carries UNKNOWN_MODEL. e2e
  • status adds no line at the default level and one at debug. e2e
  • Boot failure: a line with the device, step: boot and the driver's error text. e2e and unit
  • At debug, each device command leaves a line with its exit code. e2e (device.exec) and unit
  • A throwing subscriber gives one JSON line and nothing on console.error. main.test.ts through startDaemon
  • --follow prints a later lease's line, and keeps printing after rotation with a small log.rotateBytes. e2e and unit
  • CLI.md describes the log and --follow.
  • ADR 0006 and the ADR index say Accepted: Keep business events on disk so the history survives a restart #168 landed first (feat(bus,cli,config): keep business events on disk so the history survives a restart #184), so this PR closes the second.
  • pnpm check green. Each new test was seen failing with its code removed.

Review

Spec review: 16 findings over two rounds, 6 fixed. Code review: 10 findings over two rounds, 9 fixed.

Rejected:

  • doctor.run with purgeOrphans is a write — it destroys devices, and the Outcome says every state change leaves a line. Spec needs: purgeOrphans in the effect list.
  • Failure message missing before input validation — safety rule 10: the message quotes raw wire input. Spec needs: message only after validation.
  • log.rotateBytes row added to CONFIGURATION.md — neither log.* key was documented, and the log paragraph names this one.
  • checkAccess/authorizeContext split out of runDispatch — required by the pre-commit complexity gate. Behaviour unchanged.
  • Two fallow-ignore comment edits — the pre-commit audit flags them in files this diff touches.
  • Tests beyond the spec's list — they cover paths the code review found untested (testing rule 3).
  • Worker dispatcher gets classifyError in server.ts, not main.ts — server.ts builds that dispatcher and already imports it. Same effect.
  • A cleanup.run that joins a failing scheduled run gets both lines — the background run failed and the request is a separate record.

Written by an agent.

V3RON added 5 commits October 1, 2026 13:49
…e log live

- runDispatch writes one operation line per call on every frontend, levelled by
  the operation's new contract effect (write: info, read: debug)
- core modules log the background failures they handle, with device, step and error
- LoggingProcessRunner logs each device command at debug
- event subscriber failures go to daemon.log as JSON
- simlock daemon logs --follow polls through the Filesystem/Clock ports and
  survives rotation
…one log line per failed cleanup run, untested paths covered
…s, authorize fails closed, --follow only on logs, wiring covered by tests
# Conflicts:
#	CHANGELOG.md
#	docs/CONFIGURATION.md
#	docs/internal/ARCHITECTURE.md
#	src/cli/index.ts
#	src/core/lease-acquisition-coordinator.ts
#	src/core/lease-engine.test.ts
#	src/daemon/main.test.ts
#	src/daemon/main.ts
#	src/daemon/server.ts
#	src/gateway/dispatcher.test.ts
#	src/ports/logger.ts
@V3RON
V3RON merged commit 3e1fa08 into main Oct 1, 2026
23 checks passed
@V3RON
V3RON deleted the feature/169 branch November 6, 2026 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Daemon log records every request and background failure, and can be followed live

1 participant