feat: S14.05 migrate OriginSd onto the SD writer#555
Conversation
Rewrite OriginSd_Format to emit software / swVersion / enterpriseId via SolidSyslogSdElement + SolidSyslogSdValue_BoundedString (escaped, decoded- length-capped as before) and ip via _Param -> the SdValue handed to GetIpAt (byte-identical to the old raw SolidSyslogFormatter framing; existing OriginSd tests are the safety net), matching the S14.03/S14.04 migrations. Convert SolidSyslogOriginIpAtFunction to void(SolidSyslogSdValue*, void* context, size_t index), with a paired OriginSdConfig.IpContext. Routing the ip value through the SdElement param sink makes the library own the escaping unconditionally, closing the ip SD-injection vector. With the language vector closed in S14.04, S12.32 (#533) is now fully done. Take the #346 eliminate-the-scratch path: the static fields are emitted straight into the element at Format time instead of being pre-formatted into a shared scratch blob at Create. The OriginSd struct now borrows the three config strings directly; FormattedStorage and the ORIGIN_{LITERAL_BYTES,CONTENT_MAX, FORMATTED_MAX} sizing enums are gone. No shared SD scratch buffer remains, so concurrent-Log reentrancy holds by construction. The shared BddTargetIps_At moves to SolidSyslogSdValue_BoundedString. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 37 minutes and 15 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
☀️ Quality Summary 🚦 build-linux-gcc: 100% successful (✔️ 1496 passed) Created by Quality Monitor v1.14.0 (#f3859fd). More details are shown in the GitHub Checks Result. |
☀️ Quality Summary 🚦 build-linux-gcc: 100% successful (✔️ 1496 passed) Created by Quality Monitor v1.14.0 (#f3859fd). More details are shown in the GitHub Checks Result. |
Closes #545. Closes #533. Parent epic: #64.
What changes
Migrates
OriginSd_Formatonto the E14 SD writer (SolidSyslogSdElement+SolidSyslogSdValue), mirroring S14.03/S14.04. Output is byte-for-byte identicalto the old raw
SolidSyslogFormatterframing — the existing OriginSd tests(software / swVersion / enterpriseId max-length + escape, multi-IP) are the safety net.
_Param+SolidSyslogSdValue_BoundedString(sameORIGIN_*_MAXdecoded caps as the old_EscapedString).ipflows via_Param→ theSdValuehanded to the new-signatureGetIpAt.SolidSyslogOriginIpAtFunction→void(struct SolidSyslogSdValue*, void* context, size_t index), with a pairedOriginSdConfig.IpContextthreaded throughInitialiseand passed unchanged. Routing
ipthrough the param sink makes the library own theescaping unconditionally → closes the
ipSD-injection vector. Withlanguageclosed in S14.04, S12.32 (S12.32: Escape integrator-supplied SD param values (scoped formatter escape toggle) #533) is fully done.
#346 — eliminate the scratch path
The static fields are now emitted straight into the element at
Formattime instead ofbeing pre-formatted into a shared scratch blob at
Create. TheOriginSdstruct borrowsthe three config strings directly;
FormattedStorageand theORIGIN_{LITERAL_BYTES,CONTENT_MAX,FORMATTED_MAX}sizing enums are removed. No sharedSD scratch buffer remains, so concurrent-
Logreentrancy holds by construction — the#346 concern is dissolved, not papered over.
The shared
BddTargetIps_Atmoves toSolidSyslogSdValue_BoundedString.Acceptance criteria
ipcallback emitting",\, or]is escaped — no break-outNULLGetIpCount/GetIpAt→ noipparamsvoid* contextand theindex(new
FormatPassesIpContextThrough, RED-first)Format(base, formatter))Behaviour note for reviewers
The
software/swVersion/enterpriseIdconfig strings are now borrowed for theSD's lifetime (previously copied into the blob at
Create). This is the deliberate#346 trade-off; integrators pass string literals / long-lived config in practice.
Out of scope
SD vtable flip (S14.06); header fields (S14.07). The CLAUDE.md OriginSd header-table row
(still mentions the pre-formatted storage) is left for the deferred S14.08 wholesale
table revision.
Checks
Debug green (1459 tests); OriginSd 38/38; BddTargetIps 2/2; BddTargetTests 66/66.
clang-format applied; cppcheck-MISRA exit 0 (suppression anchors moved:
SolidSyslogOriginSd.c11.3 73→61,SolidSyslogOriginSdPrivate.h5.7 14→13).🤖 Generated with Claude Code