Skip to content

feat: S14.08 make SolidSyslogFormatter library-private (#548)#558

Merged
DavidCozens merged 5 commits into
mainfrom
feat/s14-08-formatter-private
Jun 6, 2026
Merged

feat: S14.08 make SolidSyslogFormatter library-private (#548)#558
DavidCozens merged 5 commits into
mainfrom
feat/s14-08-formatter-private

Conversation

@DavidCozens

@DavidCozens DavidCozens commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Closes #548.

Makes SolidSyslogFormatter a library-internal detail. The issue's premise — "no remaining public consumer of the formatter" — was wrong: SolidSyslogEndpoint.Host was still a raw SolidSyslogFormatter* the endpoint callback wrote the destination host into. Resolved (David's call) with a new dedicated endpoint-host writer, mirroring the S14.07 HeaderField migration.

Slices

  1. SolidSyslogEndpointHost sink (TDD, 3 tests) — opaque, stack-transient, wraps the sender's stack host formatter. _String does a verbatim bounded copy (no PRINTUSASCII substitution, unlike HeaderField) so a DNS name / IP literal reaches the resolver intact. That charset difference is why it's its own type.
  2. CutoverEndpoint.HostSolidSyslogEndpointHost*. Every endpoint-host writer migrates together: both senders (byte-identical), StreamSender nil-endpoint, all five BDD configs (TCP/UDP/TLS/mTLS/Windows), the FreeRTOS pipeline, and the BDD service-thread test.
  3. SolidSyslogFormatter.hCore/Source/ (private). No CMake include-path change needed; the two sizing macros gain a NOLINTBEGIN/END(macro-usage) pair (matching SolidSyslogMacros.h).
  4. Docs — CLAUDE.md public-header table refreshed (drop Formatter + StringFunction; add EndpointHost / HeaderField(+Function) / SdElement / SdValue / SdValueFunction; fix Endpoint / StructuredData(Definition) / MetaSd / OriginSd); rfc-compliance.md OriginSd lines swept.

Verification

  • debug: 1474 tests green. BddTargetTests: 66/66 (these compile the BDD configs the junit target does not).
  • clang-format applied; cppcheck-MISRA exit 0 (suppressions migrated for the Formatter.h path move + sender line drift, verified against CI's exact --addon=misra command).

Deferred

docs/structured-data.md (the SD-authoring design note) moves to S14.09, where it lands beside the integrator guide. E14 then closes with S14.09.

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Added SolidSyslogEndpointHost API for endpoint host configuration with new SolidSyslogEndpointHost_String() function.
  • Documentation

    • Updated public API documentation and RFC 5424 compliance notes for endpoint host configuration.

DavidCozens and others added 5 commits June 6, 2026 11:39
Additive opaque destination-host sink mirroring SolidSyslogHeaderField,
wrapping a sender's stack formatter. Verbatim bounded copy (no PRINTUSASCII
substitution) so a DNS name / IP literal reaches the resolver intact. No
consumer yet; the endpoint cutover follows in slice 2.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Flip SolidSyslogEndpoint.Host from a raw SolidSyslogFormatter* to the opaque
SolidSyslogEndpointHost*. Every endpoint-host writer migrates together:
- both senders wrap their stack host formatter in the sink before invoking the
  endpoint callback and read the host back out unchanged;
- StreamSender's nil-endpoint, all five BDD target configs (TCP/UDP/TLS/mTLS/
  Windows), the FreeRTOS pipeline, and the BDD service-thread test write via the
  sink.
Byte-identical: the existing sender + BDD-target tests are the safety net.

SolidSyslogFormatter.h is now the only public header referencing the formatter,
unblocking the move to Core/Source in slice 3.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Move SolidSyslogFormatter.h from Core/Interface to Core/Source. With the
endpoint host now behind SolidSyslogEndpointHost, no public header or Tier-3
target reaches the formatter; it is a Core implementation detail. Platform
sources compile into the library target and keep their PRIVATE Core/Source
view, and tests/BDD-target tests already add Core/Source to their include
path, so the move needs no CMake include-path changes and the header drops out
of the installed public set.

The two worst-case sizing macros gain a NOLINTBEGIN/END(macro-usage) pair
(matching SolidSyslogMacros.h) since the Core/Interface tier-wide disable no
longer covers them; the stale Formatter.h example is dropped from that tier's
.clang-tidy comment.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop the now-private SolidSyslogFormatter.h row and the retired
SolidSyslogStringFunction.h row from the CLAUDE.md public-header table; add
SolidSyslogEndpointHost, SolidSyslogHeaderField(+Function), and the SD writers
SolidSyslogSdElement / SdValue / SdValueFunction; fix the Endpoint,
StructuredData(Definition), MetaSd, and OriginSd rows to match the post-E14
writer model. Sweep the stale OriginSd lines in rfc-compliance.md (escaping is
applied by SolidSyslogSdValue, not a raw formatter; no pre-formatted scratch
storage).

The SD-authoring design note (docs/structured-data.md) is deferred to S14.09,
where it lands beside the integrator guide.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Update misra_suppressions.txt for the SolidSyslogFormatter.h Core/Interface →
Core/Source path move (11.2/11.3 cast 28→35, 5.7 stays 14) and the
StreamSender/UdpSender line drift from the endpoint-host cutover (verified by
re-running CI's exact --addon=misra command: branch returns exit 0, fired set
matches the main baseline). clang-format reflow on the new sink files; DEVLOG
entry for the session.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR introduces SolidSyslogEndpointHost, a new public value sink abstraction that replaces direct SolidSyslogFormatter* usage in the SolidSyslogEndpoint.Host field. The change enables SolidSyslogFormatter to become library-private while maintaining backward-compatible host-string population semantics across all senders, BDD targets, and tests. Documentation and compiler configuration are updated accordingly.

Changes

Formatter Privatization via EndpointHost

Layer / File(s) Summary
EndpointHost abstraction definition and build integration
Core/Interface/SolidSyslogEndpointHost.h, Core/Source/SolidSyslogEndpointHost.c, Core/Source/SolidSyslogEndpointHostPrivate.h, Core/Source/CMakeLists.txt, Tests/CMakeLists.txt, Tests/SolidSyslogEndpointHostTest.cpp
Introduces the public SolidSyslogEndpointHost interface with _String function for bounded verbatim host-string appending, backed by a private struct wrapping a SolidSyslogFormatter pointer. Integrated into build system and accompanied by three unit tests covering verbatim write, empty string, and length-bounding behavior.
SolidSyslogEndpoint struct migration to EndpointHost
Core/Interface/SolidSyslogEndpoint.h
Changes the Host field type from struct SolidSyslogFormatter* to struct SolidSyslogEndpointHost* and adds the forward declaration.
Core sender adaption to EndpointHost
Core/Source/SolidSyslogStreamSender.c, Core/Source/SolidSyslogUdpSender.c
StreamSender and UdpSender now construct a SolidSyslogEndpointHost wrapper from their formatter before assigning to endpoint; nil-endpoint uses the new abstraction for host initialization.
BDD target configuration updates
Bdd/Targets/Common/BddTargetFreeRtosPipeline.c, Bdd/Targets/Common/BddTargetMtlsConfig.c, Bdd/Targets/Common/BddTargetTlsConfig.c, Bdd/Targets/Linux/BddTargetTcpConfig.c, Bdd/Targets/Linux/BddTargetUdpConfig.c, Bdd/Targets/Windows/BddTargetWindows.c
All endpoint configurations switch from SolidSyslogFormatter_BoundedString to SolidSyslogEndpointHost_String for host-field population; includes matching header updates.
SolidSyslogFormatter macro NOLINT wrapping
Core/Source/SolidSyslogFormatter.h
Adds comment and NOLINTBEGIN/NOLINTEND blocks around macro definitions to suppress cppcoreguidelines-macro-usage lint warnings for the now-private formatter header.
EndpointHost unit tests and test infrastructure updates
Tests/SolidSyslogEndpointHostTest.cpp, Tests/SolidSyslogStreamSenderTest.cpp, Tests/SolidSyslogUdpSenderTest.cpp, Tests/Bdd/Targets/BddTargetServiceThreadTest.cpp
New dedicated test file validates SolidSyslogEndpointHost_String; existing sender and BDD tests updated to include the new header and use the EndpointHost API.
Public API documentation and compliance notes
CLAUDE.md, docs/rfc-compliance.md, Core/Interface/.clang-tidy, DEVLOG.md
CLAUDE.md public-header table updated to reference SolidSyslogEndpointHost, SolidSyslogSdElement, and SolidSyslogSdValue (removing SolidSyslogFormatter rows); RFC compliance matrix updated for SD-PARAM escaping and origin SD implementation; DEVLOG S14.08 entry documents the blocker-resolution step; .clang-tidy comment clarifies macro-idiom rationale.
MISRA suppressions and build configuration updates
misra_suppressions.txt
Updates MISRA C:2012 suppression targets to reflect SolidSyslogFormatter.h path move from Core/Interface/ to Core/Source/; adjusts suppressed line numbers for SolidSyslogStreamSender.c and SolidSyslogUdpSender.c.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • DavidCozens/solid-syslog#521: Modifies BddTargetFreeRtosPipeline_GetEndpoint() endpoint host population logic in the same file with formatter-based bounded string handling.
  • DavidCozens/solid-syslog#230: Updates RFC 5424 §6.3.3 SD-PARAM escaping compliance notes in docs/rfc-compliance.md.

Poem

🐰 A formatter hides from sight,
EndpointHost shines bright and white,
Bounded strings flow without a fuss,
Private now—no more for us! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: S14.08 make SolidSyslogFormatter library-private (#548)' clearly and concisely summarizes the main objective of making the formatter a library-internal detail.
Description check ✅ Passed The PR description comprehensively covers purpose (closing #548, moving formatter private), change description (new SolidSyslogEndpointHost sink, migration scope), testing evidence (1474 tests green, 66/66 BDD), and affected areas.
Linked Issues check ✅ Passed All coding requirements from issue #548 are met: SolidSyslogFormatter.h moved to Core/Source; SolidSyslogEndpointHost sink implemented with TDD tests; Endpoint.Host migrated from SolidSyslogFormatter* to SolidSyslogEndpointHost*; all five BDD configs, senders, and tests updated; CLAUDE.md table refreshed; no public headers reference the formatter.
Out of Scope Changes check ✅ Passed All changes align with issue #548 scope: formatter privatization, EndpointHost sink introduction, migration of endpoint-host writers, header move, macro adjustments, and documentation updates; docs/structured-data.md deferral to S14.09 explicitly noted as intentional.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/s14-08-formatter-private

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

☀️   Quality Summary

   🚦   build-linux-gcc: 100% successful (✔️ 1511 passed)
   🚦   build-freertos-host-tdd-plustcp: 100% successful (✔️ 1862 passed)
   🚦   build-linux-clang: 100% successful (✔️ 1445 passed)
   🚦   sanitize-linux-gcc: 100% successful (✔️ 1445 passed)
   🚦   integration-linux-openssl: 100% successful (✔️ 16 passed)
   🚦   integration-linux-mbedtls: 100% successful (✔️ 14 passed)
   🚦   integration-windows-openssl: 100% successful (✔️ 16 passed)
   🚦   bdd-linux-syslog-ng: 94% successful (✔️ 48 passed, 🙈 3 skipped)
   🚦   bdd-windows-otel: 88% successful (✔️ 45 passed, 🙈 6 skipped)
   🚦   bdd-freertos-qemu-plustcp: 86% successful (✔️ 44 passed, 🙈 7 skipped)
   🚦   bdd-freertos-qemu-lwip: 86% successful (✔️ 44 passed, 🙈 7 skipped)
   🚦   build-windows-msvc: 100% successful (✔️ 1290 passed)
   🚦   build-linux-tunable-override: 100% successful (✔️ 1445 passed)
   ⚠️   Clang-Tidy: No warnings
   ⚠️   CPPCheck: No warnings


Created by Quality Monitor v1.14.0 (#f3859fd). More details are shown in the GitHub Checks Result.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
docs/rfc-compliance.md (2)

26-26: 💤 Low value

Consider streamlining the SD-NAME/SD-ID syntax validation parenthetical.

The parenthetical "(…the standard SDs (meta / timeQuality / origin) use compile-time-constant names)" is tangential to the escaping requirement in §6.3.3. While not incorrect, it adds editorial weight to an already dense compliance entry. Consider moving this detail to the E14 reference or removing it if the distinction is documented elsewhere.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/rfc-compliance.md` at line 26, The parenthetical about standard SD names
is tangential and should be removed from the §6.3.3 escaping row; edit the text
for SD-PARAM / SolidSyslogSdValue (and its mentions of OriginSd, MetaSd,
SolidSyslogSdValueFunction) to keep only the escaping behaviour and UTF‑8
substitution detail, and either move the removed parenthetical into the E14
discussion or convert it into a short cross-reference sentence like "See E14 for
SD-NAME / SD-ID validation and compile-time-constant standard SD names" so the
E14 issue remains the canonical place for that detail.

28-28: ⚡ Quick win

Clarify the IP count bounding statement.

The phrase "the IP value length is the integrator's to bound (ultimately by SOLIDSYSLOG_MAX_MESSAGE_SIZE), as is the IP count" creates ambiguity. The parallel structure suggests the IP count is also bounded "ultimately by SOLIDSYSLOG_MAX_MESSAGE_SIZE," but the preceding text states "the IP count [is unbounded by library logic]."

Consider: "...the IP value length is the integrator's to bound (ultimately by SOLIDSYSLOG_MAX_MESSAGE_SIZE); the IP count is likewise integrator-controlled (unbounded by library logic, but collectively limited by message capacity)."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/rfc-compliance.md` at line 28, The sentence about IP bounding is
ambiguous; clarify that the integrator controls both individual IP value length
and the IP count, and that while the library does not enforce an IP-count limit
(via SolidSyslogOriginIpCountFunction/SolidSyslogOriginIpAtFunction), both
per-IP length and the total number of IP params are effectively constrained by
overall message capacity (SOLIDSYSLOG_MAX_MESSAGE_SIZE). Change the wording to
state: IP value length is up to the integrator (ultimately bounded by
SOLIDSYSLOG_MAX_MESSAGE_SIZE); the IP count is also integrator-controlled (the
library will call SolidSyslogOriginIpCountFunction and loop 0..N-1) — the
library imposes no separate per-count limit, only the collective limit imposed
by message size.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Core/Source/CMakeLists.txt`:
- Line 38: The SOURCES list in CMakeLists.txt is out of alphabetical order: move
the entry SolidSyslogEndpointHost.c so it appears before
SolidSyslogHeaderField.c within the SOURCES list to restore alphabetical
ordering (adjust the CMakeLists.txt SOURCES block accordingly).

---

Nitpick comments:
In `@docs/rfc-compliance.md`:
- Line 26: The parenthetical about standard SD names is tangential and should be
removed from the §6.3.3 escaping row; edit the text for SD-PARAM /
SolidSyslogSdValue (and its mentions of OriginSd, MetaSd,
SolidSyslogSdValueFunction) to keep only the escaping behaviour and UTF‑8
substitution detail, and either move the removed parenthetical into the E14
discussion or convert it into a short cross-reference sentence like "See E14 for
SD-NAME / SD-ID validation and compile-time-constant standard SD names" so the
E14 issue remains the canonical place for that detail.
- Line 28: The sentence about IP bounding is ambiguous; clarify that the
integrator controls both individual IP value length and the IP count, and that
while the library does not enforce an IP-count limit (via
SolidSyslogOriginIpCountFunction/SolidSyslogOriginIpAtFunction), both per-IP
length and the total number of IP params are effectively constrained by overall
message capacity (SOLIDSYSLOG_MAX_MESSAGE_SIZE). Change the wording to state: IP
value length is up to the integrator (ultimately bounded by
SOLIDSYSLOG_MAX_MESSAGE_SIZE); the IP count is also integrator-controlled (the
library will call SolidSyslogOriginIpCountFunction and loop 0..N-1) — the
library imposes no separate per-count limit, only the collective limit imposed
by message size.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b02c4957-a4cd-439d-bfe3-c4285f196b91

📥 Commits

Reviewing files that changed from the base of the PR and between 678547f and 8dbe422.

📒 Files selected for processing (24)
  • Bdd/Targets/Common/BddTargetFreeRtosPipeline.c
  • Bdd/Targets/Common/BddTargetMtlsConfig.c
  • Bdd/Targets/Common/BddTargetTlsConfig.c
  • Bdd/Targets/Linux/BddTargetTcpConfig.c
  • Bdd/Targets/Linux/BddTargetUdpConfig.c
  • Bdd/Targets/Windows/BddTargetWindows.c
  • CLAUDE.md
  • Core/Interface/.clang-tidy
  • Core/Interface/SolidSyslogEndpoint.h
  • Core/Interface/SolidSyslogEndpointHost.h
  • Core/Source/CMakeLists.txt
  • Core/Source/SolidSyslogEndpointHost.c
  • Core/Source/SolidSyslogEndpointHostPrivate.h
  • Core/Source/SolidSyslogFormatter.h
  • Core/Source/SolidSyslogStreamSender.c
  • Core/Source/SolidSyslogUdpSender.c
  • DEVLOG.md
  • Tests/Bdd/Targets/BddTargetServiceThreadTest.cpp
  • Tests/CMakeLists.txt
  • Tests/SolidSyslogEndpointHostTest.cpp
  • Tests/SolidSyslogStreamSenderTest.cpp
  • Tests/SolidSyslogUdpSenderTest.cpp
  • docs/rfc-compliance.md
  • misra_suppressions.txt

SolidSyslogSdValue.c
SolidSyslogSdElement.c
SolidSyslogHeaderField.c
SolidSyslogEndpointHost.c

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

File inserted in incorrect alphabetical position.

SolidSyslogEndpointHost.c (line 38) appears after SolidSyslogHeaderField.c (line 37), but alphabetically "EndpointHost" should precede "HeaderField". The SOURCES list appears to maintain alphabetical order.

📋 Suggested fix

Move SolidSyslogEndpointHost.c to precede SolidSyslogHeaderField.c:

    SolidSyslogSdValue.c
    SolidSyslogSdElement.c
+   SolidSyslogEndpointHost.c
    SolidSyslogHeaderField.c
-   SolidSyslogEndpointHost.c
    SolidSyslogTimeQualitySd.c
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Core/Source/CMakeLists.txt` at line 38, The SOURCES list in CMakeLists.txt is
out of alphabetical order: move the entry SolidSyslogEndpointHost.c so it
appears before SolidSyslogHeaderField.c within the SOURCES list to restore
alphabetical ordering (adjust the CMakeLists.txt SOURCES block accordingly).

@DavidCozens DavidCozens merged commit 492ef56 into main Jun 6, 2026
27 checks passed
@DavidCozens DavidCozens deleted the feat/s14-08-formatter-private branch June 6, 2026 13:04
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.

S14.08: Make SolidSyslogFormatter private to the library

1 participant