Skip to content

fix: S12.23 PassthroughBuffer error path completeness#445

Merged
DavidCozens merged 2 commits into
mainfrom
fix/s12-23-passthrough-buffer-error-paths
May 25, 2026
Merged

fix: S12.23 PassthroughBuffer error path completeness#445
DavidCozens merged 2 commits into
mainfrom
fix/s12-23-passthrough-buffer-error-paths

Conversation

@DavidCozens

@DavidCozens DavidCozens commented May 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • Guards SolidSyslogPassthroughBuffer_Create against a NULL sender at entry, returning the shared SolidSyslogNullBuffer fallback and emitting a new PASSTHROUGHBUFFER_ERROR_NULL_SENDER code instead of crashing on the first subsequent Write.
  • Adds three pinning tests for the NULL-sender contract (ERROR reporting, fallback distinct from any pool slot, no pool-slot consumption) and one for the already-safe Destroy(NULL) fallthrough.
  • Removes the IGNORE_TEST(SolidSyslogPassthroughBuffer, HappyPathOnly) placeholder — every referent is now pinned or out of scope per the story spec. This was the last IGNORE_TEST in the codebase.

Closes #444. Sibling of S12.07 / #443.

Test plan

  • Local: cmake --build --preset debug && ctest --preset debug — green
  • Local: cmake --build --preset clang-debug && ctest --preset clang-debug — green
  • Local: cmake --build --preset sanitize && ctest --preset sanitize — green
  • Local: cmake --build --preset tidy — green
  • Local: cmake --build --preset coverage --target coverageCore/Source/SolidSyslogPassthroughBuffer*.c at 100%
  • Local: cmake --build --preset iwyu --target iwyu — green
  • Local: clang-format --dry-run --Werror over changed files — green
  • CI: analyze-cppcheck (both plain and --addon=misra) — runs in container with cppcheck available

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved robustness of buffer creation to gracefully handle null input parameters. The system now returns a fallback buffer and reports a descriptive error instead of failing.

Review Change Stack

Currently SolidSyslogPassthroughBuffer_Create stores the sender pointer
unchecked, so the first subsequent Write dispatches
SolidSyslogSender_Send(NULL, ...) and crashes. Guard at _Create entry,
emit PASSTHROUGHBUFFER_ERROR_NULL_SENDER, and return the shared
SolidSyslogNullBuffer fallback. Pin three contract properties:
ERROR reporting, fallback distinct from any pool slot, and no slot
consumption.

S12.23 #444
Destroy(NULL) is already safe by fallthrough (IndexFromHandle returns
POOL_SIZE, IndexIsValid returns false, UNKNOWN_DESTROY warning fires).
Pin that contract with a characterization test, and drop the
IGNORE_TEST(HappyPathOnly) placeholder now that every referent is
either pinned or out of scope per the story spec (Write(NULL buffer)
remains on E12's NULL-guards-on-public-entry-points list).

This was the last IGNORE_TEST in the codebase.

S12.23 #444
@coderabbitai

coderabbitai Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b3b6e697-a9ac-4a65-8d48-df61a4239814

📥 Commits

Reviewing files that changed from the base of the PR and between a0edced and f18cd20.

📒 Files selected for processing (4)
  • Core/Interface/SolidSyslogPassthroughBufferErrors.h
  • Core/Source/SolidSyslogPassthroughBufferMessages.c
  • Core/Source/SolidSyslogPassthroughBufferStatic.c
  • Tests/SolidSyslogPassthroughBufferTest.cpp

📝 Walkthrough

Walkthrough

This PR adds NULL sender validation to the passthrough buffer creation function. When SolidSyslogPassthroughBuffer_Create is called with a NULL sender, it now emits PASSTHROUGHBUFFER_ERROR_NULL_SENDER and returns a fallback null buffer instead of proceeding with pool allocation.

Changes

NULL Sender Validation

Layer / File(s) Summary
Error contract definition
Core/Interface/SolidSyslogPassthroughBufferErrors.h, Core/Source/SolidSyslogPassthroughBufferMessages.c
New PASSTHROUGHBUFFER_ERROR_NULL_SENDER enum value and its corresponding error message string mapping define the error code emitted when a NULL sender is passed to Create.
NULL sender guard implementation
Core/Source/SolidSyslogPassthroughBufferStatic.c
SolidSyslogPassthroughBuffer_Create initializes the handle from the null buffer, explicitly checks if sender is NULL, returns the fallback buffer and emits the error if true, otherwise preserves existing pool acquisition and initialization logic.
Test coverage for NULL sender handling
Tests/SolidSyslogPassthroughBufferTest.cpp
Test includes are updated to support error handler assertions; new destroy test validates null handle behavior; three pool-level tests verify NULL sender Create reports the error, returns a distinct fallback handle, and does not consume pool slots.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

Poem

🐰 A sender NULL arrives one day,
The buffer gracefully says "nay!"
With fallback grace it bows and bends,
And logs the error to all its friends.
No pool slots wasted, all is well—
The rabbit hops and rings the bell! 🔔

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 clearly and concisely describes the main change: adding error path completeness to PassthroughBuffer, specifically the NULL sender guard.
Description check ✅ Passed The description is comprehensive and well-structured, covering Purpose (issue #444), Change Description (NULL-sender guard, new error code, test additions), Test Evidence (multiple test plans executed), and Areas Affected (PassthroughBuffer module).
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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 fix/s12-23-passthrough-buffer-error-paths

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

Copy link
Copy Markdown
Contributor

☀️   Quality Summary

   🚦   build-linux-gcc: 100% successful (✔️ 1330 passed)
   🚦   build-freertos-host-tdd: 100% successful (✔️ 1558 passed)
   🚦   build-linux-clang: 100% successful (✔️ 1282 passed)
   🚦   sanitize-linux-gcc: 100% successful (✔️ 1282 passed)
   🚦   integration-linux-openssl: 100% successful (✔️ 9 passed)
   🚦   integration-linux-mbedtls: 100% successful (✔️ 7 passed)
   🚦   integration-windows-openssl: 100% successful (✔️ 9 passed)
   🚦   bdd-linux-syslog-ng: 94% successful (✔️ 46 passed, 🙈 3 skipped)
   🚦   bdd-windows-otel: 90% successful (✔️ 44 passed, 🙈 5 skipped)
   🚦   bdd-freertos-qemu: 86% successful (✔️ 42 passed, 🙈 7 skipped)
   🚦   build-windows-msvc: 100% successful (✔️ 1141 passed)
   🚦   build-linux-tunable-override: 100% successful (✔️ 1282 passed)
   ⚠️   Clang-Tidy: No warnings
   ⚠️   CPPCheck: 1 warning (low: 1)


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

@DavidCozens DavidCozens merged commit b1b556b into main May 25, 2026
21 checks passed
@DavidCozens DavidCozens deleted the fix/s12-23-passthrough-buffer-error-paths branch May 25, 2026 09:30
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.

S12.23: PassthroughBuffer error path completeness

1 participant