Repository navigation
feat(logging): extract access log middleware with injectable sinks - #190
Conversation
Independent shipping verification for PR #190Verdict PASS+NOTES. No code defects found in the pinned patch. The compiled head artifact and focused tests passed. The requested worktree switch and leave-at-head step are blocked by read-only Git metadata. This limitation remains open.
FindingsNo actionable correctness or compatibility findings. Read AGENTS.md, issue #151, PR metadata, the complete pinned diff, and all six changed files. Also traced the unchanged router, limiter, configuration, manager, and relevant FileStore operations. Existing two and three argument callers retain The dispatch order remains logging, rate limiting, authentication, then routing. The focused tests exercise real Request objects, including 401 before exhaustion, 429 after exhaustion, and public health handling. Default logging retains method, full URL, status, a space, two decimal places, and The new regression tests observe executed behavior. The custom sink test calls the real createHandler and checks concrete statuses and emitted records. The silent sink test launches a real Deno child process, calls createHandler, validates the health response body, and checks both captured streams. The default sink test executes production withLogging and captures real stdout and stderr for returned 500 and thrown errors. These assertions would fail if the subject returned undefined or logging reverted to unconditional process output. The response and error identity tests execute the middleware directly. Recording and silent sinks implement the new public interface without replacing globals or mocking the router or manager. The independent edge check also verifies delayed completion, response identity and body preservation, and propagation of object, string, and undefined failures for synchronous and asynchronous handlers. A real FileStore configured with a file where a directory is required produces a real filesystem failure through createHandler. It emits one error record and leaves the queue empty. Lifecycle output uses DEFAULT_CONSOLE_SINK. Persistent startup and shutdown checks verify the existing loading and flushing messages, their extra blank lines, successful restart, and a persisted payload round trip. The Mutasaurus test list includes logging_test.ts. I did not run mutation engines or use CI status as evidence. Sink write failures retain the existing policy of propagating logging failures. This patch does not promise to preserve an earlier handler error when the sink itself throws. Commands and measured outcomesEvery command and its actual output is captured under Base commands ran in export PATH=/home/ubuntu/Code/pstack/.audit/queue-151/tools:$PATH
export DENO_DIR=/home/ubuntu/Code/pstack/.audit/queue-151/deno-cache
deno --version
deno run --frozen --allow-run scripts/compile.ts
python3 /home/ubuntu/Code/pstack/.audit/queue-151/http-smoke.py "$PWD" ./queue
python3 /home/ubuntu/Code/pstack/.audit/queue-151/review/persistent-smoke.py "$PWD"All exited 0. Evidence in The attempted switch used exactly this command. git switch --detach 7d56f71c919bbdebb4439d49dc2b5c41fc00cd59It exited 128. Git could not create To continue without changing protected metadata or another checkout, I created Head commands ran in deno run --frozen --allow-run scripts/compile.ts
deno test --frozen --allow-read --allow-write --allow-net --allow-env --allow-run tests/logging_test.ts tests/handler_test.ts
python3 /home/ubuntu/Code/pstack/.audit/queue-151/http-smoke.py "$PWD" ./queue
python3 /home/ubuntu/Code/pstack/.audit/queue-151/review/persistent-smoke.py "$PWD"All exited 0. The focused run passed 149 tests, including all five logging tests and 144 handler tests. Evidence in The independent check imported head snapshot modules. deno run --check --frozen --allow-read --allow-write /home/ubuntu/Code/pstack/.audit/queue-151/review/edge-check.tsIt exited 0. Evidence in Remaining operational note and artifactsThe requested worktree still reports the exact base SHA No tracked production or test file was edited. No commit, push, merge, or label change was made. The only artifact created inside the requested worktree is the ignored compiled base executable Prove It Works led to actual compiled CLI checks on both revisions. Test Behavior, Not Implementation led to inspection of executed responses and real process streams. Build the Lever led to the rerunnable review driver, edge check, and persistent smoke script. Sequence Work into Verifiable Units led to capturing the base before attempting the head transition. These principle leaf skills were read in this session. The user's no-agent and no-edit constraints took precedence over skill delegation and edit suggestions. |
|
Merged as The independent review's operational note is resolved: the parent successfully switched the detached review worktree to the pinned head after verification. The independently tested archive matched all 274 tracked head files, and the merge tree matches that reviewed head. Both session worktrees and build outputs are now removed; the original checkout is clean and synchronized with |
Summary
Callers can record or silence access logs without replacing process streams. Closes #151.
The default format, stream destinations, and middleware order stay unchanged. This does not add log levels or change logging-failure policy.
Evidence
deno test --no-check tests/logging_test.tsfailed. The custom sink received[]instead of the four expected health, authentication, and rate-limit records.After:
deno test --allow-read --allow-write --allow-net --allow-env --allow-runpassed all 395 tests. New checks cover custom and silent sinks, UTF-8 stream output, sync and async failures, and unchanged responses.After: The compiled
queuebinary preserved health, authentication, enqueue, dequeue, missing-route logs, and graceful shutdown in a live HTTP smoke run.deno run --frozen --allow-run scripts/compile.tsandnpm run quality:productionpassed. The new tests also join the Mutasaurus test list.Merge Danger
Door: two-way
A revert restores the original logging wrapper. No storage or configuration migration.
Blast Radius: logging
The shared HTTP middleware and lifecycle output change. Existing three-argument callers retain default logging and promise responses.