Skip to content

Add scoped semantic logging for WebSocket, MQTT, and Express#190

Open
VolkerChristian wants to merge 1 commit into
masterfrom
codex/add-scoped-semantic-logging-for-audited-call-sites
Open

Add scoped semantic logging for WebSocket, MQTT, and Express#190
VolkerChristian wants to merge 1 commit into
masterfrom
codex/add-scoped-semantic-logging-for-audited-call-sites

Conversation

@VolkerChristian

Copy link
Copy Markdown
Member

Motivation

  • Resolve the remaining 26 FOLLOW_UP_SCOPED_HELPER_DESIGN audit rows (CSI-P075–CSI-P084, CSI-P135–CSI-P142, CSI-P143–CSI-P150) by adding the smallest safe connection-scoped semantic-logging helpers and migrating only the audited call sites.
  • Ensure structured identity (inst= and conn=) is copied from the active SocketConnection before removing duplicated connection-name prefixes from free-text messages.
  • Preserve existing zero-argument helpers and the existing semantic logging abstractions (LogScopeOwner, BoundaryLogger) while avoiding global/thread-local identity or exposing spdlog types.

Description

  • Added narrow connection-scoped overloads that copy identity from core::socket::stream::SocketConnection and produce a BoundaryLogger via LogScopeOwner for each surface: webSocketSubProtocolLog(const SocketConnection&), mqttWebSocketLog(const SocketConnection&), and expressLog(const SocketConnection&), reusing existing logging primitives and owning only copied strings.
  • Migrated the 26 audited call sites to the new scoped helpers (WebSocket SubProtocol and SocketContextUpgrade, MQTT SubProtocol, Express StaticMiddleware / VerboseRequest and Router/Application/Middleware dispatchers) and removed the duplicated connection-name prefix from free-text messages while preserving substantive content (and adding short non-empty messages where the old text was identity-only).
  • Added a focused runtime test ScopedSemanticLoggingMigrationTest that emits scoped and unscoped records and verifies origin/boundary/component preservation, instance/connection population, message-text changes, multiline MQTT frame-data preservation, and zero-argument helper compatibility.
  • Updated the audit document docs/logging/semantic-identity-callsite-audit.md with a concise Resolution status table documenting CSI-P075–CSI-P084, CSI-P135–CSI-P142, and CSI-P143–CSI-P150 as resolved by this branch; no unrelated KEEP/REMOVE_LATER rows were changed.

Testing

  • Configured and generated the build with tests enabled using cmake -S . -B build -DSNODEC_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug; summary: Configuring done; Generating done; Build files have been written to: /workspace/snode.c/build.
  • Built focused targets including the semantic logging tests and subsystem targets with cmake --build build --target websocket websocket-server websocket-client mqtt mqtt-client-websocket mqtt-server-websocket http-server-express ScopedSemanticLoggingMigrationTest WebSocketMigration07cTest MqttMigration08Test -j2; build completed and produced the expected targets (for example [100%] Built target MqttMigration08Test).
  • Ran the focused scoped test: ctest --test-dir build -R ScopedSemanticLoggingMigrationTest --output-on-failure which passed: 100% tests passed, 0 tests failed out of 1.
  • Ran a representative combined test selection: ctest --test-dir build -R "ScopedSemanticLoggingMigrationTest|WebSocketMigration07cTest|MqttMigration08Test|Semantic(LoggerRound2|CompatibilityRound9|BackendRound6|FilterRound7)|InetExpress(...)|WebSocketReceiverValidationTest|InetWebSocketServerClient(...)|Mqtt311PacketValidationTest" --output-on-failure and observed 100% tests passed, 0 tests failed out of 22 with several component tests reported as skipped by CTest in this container; the focused semantic tests and related migration tests passed.

(Changed files and the focused test are included in the branch; build and test outputs above are the exact final summary lines produced during verification.)


Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant