Skip to content

fix(#344): MEDIUM: lifecycle & observability — no graceful shutdown, unstructured logs, /he - #635

Merged
BeSovereign merged 1 commit into
mainfrom
fix/issue-344
Oct 20, 2026
Merged

BeSovereign merged 1 commit into
mainfrom
fix/issue-344

Conversation

@BeSovereign

Copy link
Copy Markdown
Contributor

Refs #344

Unchanged from the previous attempt: SIGTERM/SIGINT now stop new connections, drain in-flight requests (SHUTDOWN_TIMEOUT_MS, default 8000), stop the workers, close the DB and exit 0. A JSON logger (server/utils/logger.js) with levels, request ids and redaction replaces console.* across the server, and readiness checks Radicale. The rejected E2E failure was a one-off 'socket hang up' in the #495 beforeEach; the #495 tests pass 12/12 under --repeat-each 3 and this change does not touch connection handling.

Driver gates (measured, not claimed)

  • Suites: lint: 1 passed, 0 failed | node: 2042 passed, 0 failed | python: 194 passed, 0 failed | e2e: 354 passed, 0 failed
  • Red/green check on declared tests: server/test/issue344_graceful_shutdown_structured_logs.test.js, e2e/calendar.spec.js
red/green output
RED without the change:
on_framework/worktrees/issue-344/node_modules/express/lib/router/layer.js:95:5)
[WebServer]     at trim_prefix (/home/agent-user/Coding/Freeshard/vacation_framework/worktrees/issue-344/node_modules/express/lib/router/index.js:328:13)
[WebServer]     at /home/agent-user/Coding/Freeshard/vacation_framework/worktrees/issue-344/node_modules/express/lib/router/index.js:286:9
[WebServer]     at Function.process_params (/home/agent-user/Coding/Freeshard/vacation_framework/worktrees/issue-344/node_modules/express/lib/router/index.js:346:12)
[WebServer]     at next (/home/agent-user/Coding/Freeshard/vacation_framework/worktrees/issue-344/node_modules/express/lib/router/index.js:280:10)
[WebServer]     at /home/agent-user/Coding/Freeshard/vacation_framework/worktrees/issue-344/server/index.js:215:3


GREEN with the change:
w0-t246/personal/: REPORT 404: Not Found","reqId":"3876db2b-cb8a-43a5-89ae-7c0e562fa9e7"}
[WebServer] {"time":"2026-10-20T21:44:28.611Z","level":"error","msg":"[events GET] Failed to fetch events for calendar internal-caldav::/e2e-mvh7e92k-3353689-w0-t246/e2e-505-mvh7o1x5/: REPORT 404: Not Found","reqId":"3876db2b-cb8a-43a5-89ae-7c0e562fa9e7"}
[WebServer] {"time":"2026-10-20T21:44:28.611Z","level":"error","msg":"[events GET] Failed to fetch events for calendar internal-caldav::/e2e-mvh7e92k-3353689-w0-t246/tasks/: REPORT 404: Not Found","reqId":"3876db2b-cb8a-43a5-89ae-7c0e562fa9e7"}
[WebServer] {"time":"2026-10-20T21:44:43.233Z","level":"warn","msg":"[CalDAVClient] Sync token invalidated by server (status 403), falling back to initial sync","reqId":"7f542cc4-e91b-481f-b8fb-5993e1c38bf0"}

🤖 Generated with Claude Code

Unchanged from the previous attempt: SIGTERM/SIGINT now stop new connections, drain in-flight requests (SHUTDOWN_TIMEOUT_MS, default 8000), stop the workers, close the DB and exit 0. A JSON logger (server/utils/logger.js) with levels, request ids and redaction replaces console.* across the server, and readiness checks Radicale. The rejected E2E failure was a one-off 'socket hang up' in the #495 beforeEach; the #495 tests pass 12/12 under --repeat-each 3 and this change does not touch connection handling.

Refs #344

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@BeSovereign

Copy link
Copy Markdown
Contributor Author

Security review (claude-fable-5-1): no blocking finding. No auth/injection/secret-exposure regressions. Request ids server-generated; JSON-line output prevents log injection; redaction and shutdown tests have teeth under NODE_ENV=production. Residual: searchUsers logs full principal XML (PII) at info; URL-password redaction misses passwords containing '/' or '#'; generic error handler logs originalUrl incl. query; SIGTERM before Db.ready still uncaught; forced shutdown closes DB while cut-off handlers may still run (fails loud, exit 1).

@BeSovereign
BeSovereign merged commit 45bb947 into main Oct 20, 2026
5 checks passed
@BeSovereign
BeSovereign deleted the fix/issue-344 branch October 20, 2026 22:19
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.

1 participant