Skip to content

feat: S14.05 migrate OriginSd onto the SD writer#555

Merged
DavidCozens merged 2 commits into
mainfrom
feat/s14-05-originsd-sd-writer
Jun 6, 2026
Merged

feat: S14.05 migrate OriginSd onto the SD writer#555
DavidCozens merged 2 commits into
mainfrom
feat/s14-05-originsd-sd-writer

Conversation

@DavidCozens

Copy link
Copy Markdown
Owner

Closes #545. Closes #533. Parent epic: #64.

What changes

Migrates OriginSd_Format onto the E14 SD writer (SolidSyslogSdElement +
SolidSyslogSdValue), mirroring S14.03/S14.04. Output is byte-for-byte identical
to the old raw SolidSyslogFormatter framing — the existing OriginSd tests
(software / swVersion / enterpriseId max-length + escape, multi-IP) are the safety net.

  • Static fields emit via _Param + SolidSyslogSdValue_BoundedString (same
    ORIGIN_*_MAX decoded caps as the old _EscapedString).
  • ip flows via _Param → the SdValue handed to the new-signature GetIpAt.
  • SolidSyslogOriginIpAtFunctionvoid(struct SolidSyslogSdValue*, void* context, size_t index), with a paired OriginSdConfig.IpContext threaded through Initialise
    and passed unchanged. Routing ip through the param sink makes the library own the
    escaping unconditionally → closes the ip SD-injection vector. With language
    closed 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 Format time instead of
being pre-formatted into a shared scratch blob at Create. The OriginSd struct borrows
the three config strings directly; FormattedStorage and the
ORIGIN_{LITERAL_BYTES,CONTENT_MAX,FORMATTED_MAX} sizing enums are removed. No shared
SD scratch buffer remains
, so concurrent-Log reentrancy holds by construction — the
#346 concern is dissolved, not papered over.

The shared BddTargetIps_At moves to SolidSyslogSdValue_BoundedString.

Acceptance criteria

  • An ip callback emitting ", \, or ] is escaped — no break-out
  • Static fields remain escaped; output unchanged byte-for-byte
  • Preformat scratch blob gone; no shared SD scratch buffer; reentrancy by construction
  • NULL GetIpCount / GetIpAt → no ip params
  • The callback carries void* context and the index
    (new FormatPassesIpContextThrough, RED-first)
  • Vtable signature unchanged (Format(base, formatter))

Behaviour note for reviewers

The software / swVersion / enterpriseId config strings are now borrowed for the
SD'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.c 11.3 73→61, SolidSyslogOriginSdPrivate.h 5.7 14→13).

🤖 Generated with Claude Code

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>
@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@DavidCozens, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7fcd8f51-f801-4b18-a918-b8e34a3ec0ea

📥 Commits

Reviewing files that changed from the base of the PR and between 3fd27ec and cce316d.

📒 Files selected for processing (9)
  • Bdd/Targets/Common/BddTargetIps.c
  • Bdd/Targets/Common/BddTargetIps.h
  • Core/Interface/SolidSyslogOriginSd.h
  • Core/Source/SolidSyslogOriginSd.c
  • Core/Source/SolidSyslogOriginSdPrivate.h
  • DEVLOG.md
  • Tests/Bdd/Targets/BddTargetIpsTest.cpp
  • Tests/SolidSyslogOriginSdTest.cpp
  • misra_suppressions.txt
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/s14-05-originsd-sd-writer

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.

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

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

☀️   Quality Summary

   🚦   build-linux-gcc: 100% successful (✔️ 1496 passed)
   🚦   build-freertos-host-tdd-plustcp: 100% successful (✔️ 1847 passed)
   🚦   build-linux-clang: 100% successful (✔️ 1430 passed)
   🚦   sanitize-linux-gcc: 100% successful (✔️ 1430 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 (✔️ 1275 passed)
   🚦   build-linux-tunable-override: 100% successful (✔️ 1430 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.

@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

☀️   Quality Summary

   🚦   build-linux-gcc: 100% successful (✔️ 1496 passed)
   🚦   build-freertos-host-tdd-plustcp: 100% successful (✔️ 1847 passed)
   🚦   build-linux-clang: 100% successful (✔️ 1430 passed)
   🚦   sanitize-linux-gcc: 100% successful (✔️ 1430 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 (✔️ 1275 passed)
   🚦   build-linux-tunable-override: 100% successful (✔️ 1430 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.

@DavidCozens DavidCozens merged commit 7f90002 into main Jun 6, 2026
27 checks passed
@DavidCozens DavidCozens deleted the feat/s14-05-originsd-sd-writer branch June 6, 2026 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant