Skip to content

feat: S11.08 FreeRTOS adapters onto PoolAllocator#411

Merged
DavidCozens merged 6 commits into
mainfrom
refactor/s11-08-freertos-sweep
May 20, 2026
Merged

feat: S11.08 FreeRTOS adapters onto PoolAllocator#411
DavidCozens merged 6 commits into
mainfrom
refactor/s11-08-freertos-sweep

Conversation

@DavidCozens

@DavidCozens DavidCozens commented May 20, 2026

Copy link
Copy Markdown
Owner

Closes #410.

Summary

Third platform-adapter sweep in E11 (#29) — applies the canonical 3-TU
split (<Class>.c + <Class>Private.h + <Class>Static.c) +
SolidSyslogPoolAllocator to all four stateful FreeRTOS adapter
classes. Every FreeRTOS adapter is storage-cast today, so the
public-header surgery is uniform: drop <Class>Storage typedef + size
enum, drop storage parameter from _Create. FreeRtosStaticResolver
keeps its ipv4Octets[4] parameter — that is its runtime state, not
storage.

No new public GoF nulls: all four needed (NullMutex _Get,
NullDatagram, NullStream, NullResolver) landed in S11.06 (#407).

Commit Class Today's shape Pool default
61514e4 FreeRtosMutex Storage-cast 1U
0bcdb70 FreeRtosDatagram Storage-cast 1U
bbd6321 FreeRtosStaticResolver Storage-cast 1U
cda8e2e FreeRtosTcpStream Storage-cast 2U (matches POSIX/Windows for S08.07 mbedTLS pair)
3c8aaba DEVLOG entry

FreeRtosTcpStream is refactor-only — bounded-200 ms
SO_SNDTIMEO/SO_RCVTIMEO connect dance, post-connect timeout clear,
ARP-priming yield-once on cache miss, and FreeRTOS_recv RCVTIMEO=0
"would-block-as-zero" contract all preserved verbatim. FreeRtosMutex
adds a xSemaphoreCreateMutexStatic NULL-guard mirroring
PosixMutex's defence against pthread_mutex_init failure.

Notable BDD-target fix surfaced by the migration

The BDD target creates two FreeRtosMutex instances (bufferMutex

  • lifecycleMutex). The library default
    SOLIDSYSLOG_FREE_RTOS_MUTEX_POOL_SIZE = 1U was silently falling the
    second _Create back to NullMutex — Lock/Unlock would no-op and the
    set store file rebuild path could race the Service task. Surfaced
    as a severity=4 …UNKNOWN_DESTROY warning on quit during the
    QEMU smoke. Fixed by adding the override in
    Bdd/Targets/FreeRtos/solidsyslog_user_tunables.h (folded into the
    Mutex commit). The library default stays at 1U — the BDD target is
    the unusual case.

This is exactly the E11 correctness motivation: pre-migration both
mutexes "worked" because each had its own storage blob; the pool
semantics made the multi-instance need explicit.

Per-class test additions

  • FreeRtosMutex: 13 tests (4 existing + 9 Pool).
  • FreeRtosDatagram: 30 tests (21 existing + 9 Pool).
  • FreeRtosStaticResolver: 18 tests (9 existing − 1 superseded
    DestroyIsIdempotent + 10 Pool).
  • FreeRtosTcpStream: 46 tests (37 existing + 9 Pool).

Local gates

Validated across three devcontainers:

  • freertos-host — debug + 9/9 ctest exes + 1131 unit tests pass;
    sanitize pass; coverage 99.5% (pre-existing FreeRTOS gap in the lcov
    capture, same as POSIX/Windows); analyze-cppcheck clean;
    analyze-tidy clean on every file touched; analyze-format clean.
  • freertos-targetfreertos-cross ARM build clean (all four new
    *Static.c files compile under arm-none-eabi-gcc and link into the
    SolidSyslogBddTarget.elf); QEMU mps2-an385 boot smoke clean
    (SolidSyslog> prompt, send 1 succeeds, quit exits clean, no
    emissions).
  • WSL/Windows — MSVC msvc-debug clean; analyze-iwyu clean
    (confirmed by the user before push).

CI will run the full BDD-FreeRTOS-QEMU scenarios.

Test plan

  • All host unit tests pass on freertos-host devcontainer
  • Sanitize (ASan + UBSan) clean
  • Coverage 99.5% (above 90% gate)
  • clang-tidy clean on every new/migrated file
  • cppcheck clean
  • clang-format clean
  • freertos-cross ARM cross-build links
  • QEMU boot smoke clean after pool-size-2 fix
  • MSVC msvc-debug clean (user-validated)
  • analyze-iwyu clean (user-validated)
  • CI: bdd-freertos-qemu (full scenarios — including set store file)
  • CI: bdd-linux-syslog-ng / bdd-windows-otel (regression net)
  • CI: all other status checks

Summary by CodeRabbit

  • New Features

    • FreeRTOS adapter components now use simplified creation APIs without requiring explicit storage parameters.
    • Internal pool-based resource management for datagram, mutex, resolver, and TCP stream components.
    • Configurable pool size tunables for FreeRTOS adapters.
    • Enhanced error handling when resource pools are exhausted.
  • Documentation

    • Updated API reference documentation for FreeRTOS component creation/destruction.

Review Change Stack

3-TU split (vtable+Initialise/Cleanup, Private.h struct, Static.c pool)
behind unchanged `_Create(void)` / `_Destroy(base)` shape. Public
`SolidSyslogFreeRtosMutexStorage` typedef and `SOLIDSYSLOG_FREE_RTOS_MUTEX_SIZE`
enum deleted. Pool-exhaustion fallback resolves to the shared
`SolidSyslogNullMutex`. `Initialise` guards `xSemaphoreCreateMutexStatic`
returning NULL by installing the NullMutex vtable, mirroring PosixMutex.

Caller updates: `Bdd/Targets/FreeRtos/main.c` drops `mutexStorage` and
`lifecycleMutexStorage`; BDD target CMakeLists + Tests/FreeRtos
CMakeLists add the new `*Static.c`; the Mutex test exe gains
`ConfigLockFake` and `ErrorHandlerFake` links for the new Pool TEST_GROUP.

Tunable `SOLIDSYSLOG_FREE_RTOS_MUTEX_POOL_SIZE` default 1U. Error
constants `SOLIDSYSLOG_ERROR_MSG_FREERTOSMUTEX_POOL_EXHAUSTED` /
`_UNKNOWN_DESTROY` follow the established naming.

Refs #410.
3-TU split (vtable+Initialise/Cleanup, Private.h struct, Static.c pool)
behind unchanged `_Create(void)` / `_Destroy(base)` shape. Public
`SolidSyslogFreeRtosDatagramStorage` typedef and
`SOLIDSYSLOG_FREE_RTOS_DATAGRAM_SIZE` enum deleted. Pool-exhaustion
fallback resolves to the shared `SolidSyslogNullDatagram`. Cleanup
calls Close (idempotent socket cleanup) before overwriting the vtable
with NullDatagram for use-after-destroy safety. ARP-priming /
single-yield pattern preserved verbatim — refactor-only.

Caller updates: `Bdd/Targets/FreeRtos/main.c` drops `datagramStorage`;
BDD target CMakeLists + Tests/FreeRtos CMakeLists add the new
`*Static.c`; the Datagram test exe gains `ConfigLockFake` and
`ErrorHandlerFake` links for the new Pool TEST_GROUP.

Tunable `SOLIDSYSLOG_FREE_RTOS_DATAGRAM_POOL_SIZE` default 1U. Error
constants `SOLIDSYSLOG_ERROR_MSG_FREERTOSDATAGRAM_POOL_EXHAUSTED` /
`_UNKNOWN_DESTROY` follow the established naming.

Refs #410.
3-TU split (vtable+Initialise/Cleanup, Private.h struct, Static.c pool).
Public `_Create` keeps its `ipv4Octets[4]` argument — that is the
runtime state the resolver pins per slot — but loses the
`SolidSyslogFreeRtosStaticResolverStorage*` parameter; storage moves
into the library-internal pool. `SolidSyslogFreeRtosStaticResolverStorage`
typedef and `SOLIDSYSLOG_FREE_RTOS_STATIC_RESOLVER_SIZE` enum deleted.
Pool-exhaustion fallback resolves to the shared `SolidSyslogNullResolver`
(Resolve returns false so the caller's unresolved-host error path runs
naturally).

Caller updates: `Bdd/Targets/FreeRtos/main.c` drops `resolverStorage`;
BDD target CMakeLists + Tests/FreeRtos CMakeLists add the new
`*Static.c`; the StaticResolver test exe gains `ConfigLockFake` and
`ErrorHandlerFake` links for the new Pool TEST_GROUP. The test's
`RecreateResolverWith` helper now Destroy/Create-cycles a slot rather
than re-stomping caller storage. The previous `DestroyIsIdempotent`
test is superseded by `DestroyOfStaleHandleReportsWarning` in the Pool
group — double-Destroy now emits a WARNING per the bad-setup contract.

Tunable `SOLIDSYSLOG_FREE_RTOS_STATIC_RESOLVER_POOL_SIZE` default 1U.

Refs #410.
3-TU split (vtable+Initialise/Cleanup, Private.h struct, Static.c pool)
behind unchanged `_Create(void)` / `_Destroy(base)` shape. Public
`SolidSyslogFreeRtosTcpStreamStorage` typedef and
`SOLIDSYSLOG_FREE_RTOS_TCP_STREAM_SIZE` enum deleted. Pool-exhaustion
fallback resolves to the shared `SolidSyslogNullStream`. Cleanup
closes any open socket before overwriting the vtable with NullStream
for use-after-destroy safety.

Refactor-only — the bounded-200 ms SO_SNDTIMEO/SO_RCVTIMEO connect
dance, the post-connect timeout clear, the ARP-priming yield-once on
cache miss, and the FreeRTOS_recv RCVTIMEO=0 "would-block as zero"
contract are all preserved verbatim. Static helper functions stay
where they were.

Caller updates: `Bdd/Targets/FreeRtos/main.c` drops `tcpStreamStorage`;
BDD target CMakeLists + Tests/FreeRtos CMakeLists add the new
`*Static.c`; the TcpStream test exe gains `ConfigLockFake` and
`ErrorHandlerFake` links for the new Pool TEST_GROUP.

Pool size default 2U — matches the POSIX/Windows TcpStream pool sizes
so a future TLS-via-mbedTLS path (S08.07) wrapping an underlying
FreeRtosTcpStream does not silently fall back to NullStream on the
second Create. Tunable
`SOLIDSYSLOG_FREE_RTOS_TCP_STREAM_POOL_SIZE`. Error constants
`SOLIDSYSLOG_ERROR_MSG_FREERTOSTCPSTREAM_POOL_EXHAUSTED` /
`_UNKNOWN_DESTROY` follow the established naming.

Refs #410.
@coderabbitai

coderabbitai Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@DavidCozens has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 22 minutes and 32 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, 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 have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 113748cd-2d08-4a2a-bce0-e741cccc9130

📥 Commits

Reviewing files that changed from the base of the PR and between 3c8aaba and 8dfcc01.

📒 Files selected for processing (8)
  • DEVLOG.md
  • Platform/FreeRtos/Source/SolidSyslogFreeRtosDatagram.c
  • Platform/FreeRtos/Source/SolidSyslogFreeRtosMutex.c
  • Platform/FreeRtos/Source/SolidSyslogFreeRtosStaticResolver.c
  • Platform/FreeRtos/Source/SolidSyslogFreeRtosTcpStream.c
  • Tests/FreeRtos/SolidSyslogFreeRtosDatagramTest.cpp
  • Tests/FreeRtos/SolidSyslogFreeRtosMutexTest.cpp
  • Tests/FreeRtos/SolidSyslogFreeRtosTcpStreamTest.cpp
📝 Walkthrough

Walkthrough

Four FreeRTOS stateful adapter classes migrate from caller-provided storage to library-managed pool allocation. Each class gains a *Static.c file implementing pool acquire/release and falls back to a shared SolidSyslogNull* implementation when the pool is exhausted. Public APIs drop storage typedef and size parameters; the static resolver preserves its IPv4-octets parameter. Tests validate pool behavior, fallback idempotency, and error reporting.

Changes

FreeRTOS Adapters onto PoolAllocator

Layer / File(s) Summary
Pool tunable defaults and error messages
Core/Interface/SolidSyslogTunablesDefaults.h, Core/Source/SolidSyslogErrorMessages.h
Four new pool-size tunables with 1U defaults (Mutex, Datagram, StaticResolver) and 2U for TcpStream; compile-time floor checks; error macros for pool exhaustion and unknown-destroy cases.
FreeRtosMutex pool migration
Platform/FreeRtos/Interface/SolidSyslogFreeRtosMutex.h, Platform/FreeRtos/Source/SolidSyslogFreeRtosMutex.c, Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexPrivate.h, Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexStatic.c
Mutex lifecycle refactored from storage-based Create/Destroy to pool-backed Create/Destroy; Initialise/Cleanup functions manage FreeRTOS vtable and semaphore; fallback to NullMutex on initialization failure.
FreeRtosDatagram pool migration
Platform/FreeRtos/Interface/SolidSyslogFreeRtosDatagram.h, Platform/FreeRtos/Source/SolidSyslogFreeRtosDatagram.c, Platform/FreeRtos/Source/SolidSyslogFreeRtosDatagramPrivate.h, Platform/FreeRtos/Source/SolidSyslogFreeRtosDatagramStatic.c
Datagram lifecycle refactored to pool-backed Create/Destroy; socket initialized and closed within private Initialise/Cleanup functions; vtable overwritten with NullDatagram on cleanup for safe post-destroy.
FreeRtosStaticResolver pool migration
Platform/FreeRtos/Interface/SolidSyslogFreeRtosStaticResolver.h, Platform/FreeRtos/Source/SolidSyslogFreeRtosStaticResolver.c, Platform/FreeRtos/Source/SolidSyslogFreeRtosStaticResolverPrivate.h, Platform/FreeRtos/Source/SolidSyslogFreeRtosStaticResolverStatic.c
Resolver Create preserves IPv4-octets parameter; storage-to-pool migration; Initialise/Cleanup manage vtable and IPv4 octet buffer; fallback to NullResolver on exhaustion.
FreeRtosTcpStream pool migration
Platform/FreeRtos/Interface/SolidSyslogFreeRtosTcpStream.h, Platform/FreeRtos/Source/SolidSyslogFreeRtosTcpStream.c, Platform/FreeRtos/Source/SolidSyslogFreeRtosTcpStreamPrivate.h, Platform/FreeRtos/Source/SolidSyslogFreeRtosTcpStreamStatic.c
Stream lifecycle refactored to pool-backed Create/Destroy; bounded-timeout connect dance and ARP-priming semantics preserved; vtable overwritten with NullStream on cleanup.
Build wiring
Bdd/Targets/FreeRtos/CMakeLists.txt, Tests/FreeRtos/CMakeLists.txt, Bdd/Targets/FreeRtos/main.c, Bdd/Targets/FreeRtos/solidsyslog_user_tunables.h
Four new *Static.c files added to BDD target and test executables; main.c removes storage-variable declarations and switches to pool-backed Create() calls; BDD target defines mutex pool size override (2U) to prevent null-mutex fallback during testing.
Pool exhaustion and fallback test coverage
Tests/FreeRtos/SolidSyslogFreeRtosMutexTest.cpp, Tests/FreeRtos/SolidSyslogFreeRtosDatagramTest.cpp, Tests/FreeRtos/SolidSyslogFreeRtosStaticResolverTest.cpp, Tests/FreeRtos/SolidSyslogFreeRtosTcpStreamTest.cpp
Four per-adapter TEST_GROUP(Pool) suites with 9+ tests each validating pool filling, distinct fallback handles, error reporting on exhaustion, fallback vtable no-op safety, ConfigLock semantics, and destroy behavior for pooled/unknown/stale handles.
Documentation
CLAUDE.md, DEVLOG.md
CLAUDE.md audience table updated to reflect new parameterless Create() APIs and base-handle Destroy() signatures; DEVLOG.md entry documents PoolAllocator migration decisions, per-class implementation details, tunable defaults, pool-exhaustion fallback semantics, discovered mutex pool-size regression, and validation checkpoints.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related issues

  • #410: S11.08 parent issue — defines the PoolAllocator sweep scope, acceptance criteria, per-class storage-to-pool migration contract, and tunable defaults that this PR fully implements.

Poem

🐰 Four adapters hop from storage to pools,
No stacks to manage, no caller-provided tools,
NullMutex waits when exhaustion is near,
Fallback paths safe, the migration is clear!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.29% 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 summarizes the main change: migrating FreeRTOS adapters to use PoolAllocator. It directly relates to the vast majority of file changes in this PR.
Description check ✅ Passed The PR description is comprehensive, covering Purpose (closes #410), Change Description (3-TU split, API changes, pool defaults), Test Evidence (extensive local validation across three devcontainers), and Areas Affected (four FreeRTOS classes).
Linked Issues check ✅ Passed All code changes align with issue #410 requirements: four FreeRTOS classes migrated to PoolAllocator with 3-TU split, public storage typedefs removed, pool sizes set correctly, tests added, interface library shape preserved.
Out of Scope Changes check ✅ Passed All changes are in scope for #410: FreeRtosMutex, FreeRtosDatagram, FreeRtosStaticResolver, FreeRtosTcpStream migrations, DEVLOG, tunables, error messages, CMake updates, and BDD-target fix. No unrelated changes detected.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/s11-08-freertos-sweep

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 (✔️ 1263 passed, 🙈 2 skipped)
   🚦   build-freertos-host-tdd: 100% successful (✔️ 1417 passed, 🙈 2 skipped)
   🚦   build-linux-clang: 100% successful (✔️ 1215 passed, 🙈 2 skipped)
   🚦   sanitize-linux-gcc: 100% successful (✔️ 1215 passed, 🙈 2 skipped)
   🚦   integration-linux-openssl: 100% successful (✔️ 9 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: 73% successful (✔️ 36 passed, 🙈 13 skipped)
   🚦   build-windows-msvc: 100% successful (✔️ 1104 passed, 🙈 1 skipped)
   🚦   build-linux-tunable-override: 100% successful (✔️ 1215 passed, 🙈 2 skipped)
   ⚠️   Clang-Tidy: 3 warnings (normal: 3)
   ⚠️   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: 6

🤖 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 `@DEVLOG.md`:
- Around line 92-95: Fix the inconsistent test-count numbers in the DEVLOG
section by reconciling the "Per-class Pool TEST_GROUPs add 36 tests overall (9 ×
4 classes)" statement with the later "total addition ~37" and the referenced "8
tests added to existing Mutex group / 0 to Datagram"; update the Pool, Mutex,
Datagram and overall totals so they sum correctly and match the per-class
breakdown (adjust the "9 × 4", the "8 tests" in Mutex, and the "~37" total as
needed) and ensure the three places ("Per-class Pool TEST_GROUPs..." line, the
Mutex/Datagram line, and the overall total) all show the same consistent
numbers.

In `@Platform/FreeRtos/Source/SolidSyslogFreeRtosDatagramStatic.c`:
- Around line 42-50: The destroy path flags the shared null sentinel as
"unknown" because SolidSyslogFreeRtosDatagram_Destroy only tries to free from
FreeRtosDatagram_Allocator; update Destroy to first detect the shared null
datagram returned by SolidSyslogNullDatagram_Get() (which
SolidSyslogFreeRtosDatagram_Create can return) and treat it as a valid no-op
destroy (return or mark released true) so the code does not call
SolidSyslog_Error with SOLIDSYSLOG_ERROR_MSG_FREERTOSDATAGRAM_UNKNOWN_DESTROY;
keep the existing pool-free logic using SolidSyslogPoolAllocator_IndexIsValid
and SolidSyslogPoolAllocator_FreeIfInUse/FreeRtosDatagram_CleanupAtIndex for
non-sentinel instances.

In `@Platform/FreeRtos/Source/SolidSyslogFreeRtosStaticResolver.c`:
- Around line 8-10: The translation unit uses the bool type directly (declared
around line 12) but does not include <stdbool.h>; add a direct `#include`
<stdbool.h> at the top of SolidSyslogFreeRtosStaticResolver.c (near the existing
includes of "SolidSyslogFreeRtosStaticResolverPrivate.h",
"SolidSyslogNullResolver.h", and "SolidSyslogResolverDefinition.h") so the
symbol bool is provided by the translation unit itself and satisfies the IWYU CI
requirement.

In `@Platform/FreeRtos/Source/SolidSyslogFreeRtosStaticResolverStatic.c`:
- Around line 28-35: SolidSyslogFreeRtosStaticResolver_Create must validate the
ipv4Octets pointer before passing it into FreeRtosStaticResolver_Initialise; if
ipv4Octets is NULL, do not touch the pool or call Initialise—immediately return
the fallback from SolidSyslogNullResolver_Get(). Update the function to check
ipv4Octets at the top (alongside the existing allocator/index checks), and only
call FreeRtosStaticResolver_Initialise(&FreeRtosStaticResolver_Pool[index].Base,
ipv4Octets) when ipv4Octets is non-NULL and the acquired index is valid.

In `@Platform/FreeRtos/Source/SolidSyslogFreeRtosTcpStream.c`:
- Around line 13-15: This file uses bool, size_t, uint16_t and uint32_t without
including their standard headers; add explicit includes for <stdbool.h>,
<stddef.h> and <stdint.h> near the top of SolidSyslogFreeRtosTcpStreamPrivate.h
consumer (i.e., in this translation unit) — place these three includes after the
copyright/license header and before any FreeRTOS includes so symbols used by
functions in this file (e.g., any functions in SolidSyslogFreeRtosTcpStream.c
that reference bool/size_t/uint16_t/uint32_t or types used by
SolidSyslogFreeRtosTcpStreamPrivate.h) have explicit, non-transitive
declarations.

In `@Tests/FreeRtos/SolidSyslogFreeRtosMutexTest.cpp`:
- Around line 145-152: The test
SolidSyslogFreeRtosMutexPool::FallbackLockUnlockAreNoOps currently has no
assertions; add NEVER checks to ensure fallback mutex does not call semaphore
APIs. After calling FillPool() and creating overflow via
SolidSyslogFreeRtosMutex_Create(), add NEVER(FreeRtosSemaphore_Take) and
NEVER(FreeRtosSemaphore_Give) (or the project’s equivalent NEVER macros for
those functions) before/around calling SolidSyslogMutex_Lock(overflow) and
SolidSyslogMutex_Unlock(overflow) so the test fails if the fallback
implementation calls FreeRtosSemaphore_Take or FreeRtosSemaphore_Give.
🪄 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: 316171c0-2ac8-4c7c-8978-9528b14c1d28

📥 Commits

Reviewing files that changed from the base of the PR and between 78c059e and 3c8aaba.

📒 Files selected for processing (28)
  • Bdd/Targets/FreeRtos/CMakeLists.txt
  • Bdd/Targets/FreeRtos/main.c
  • Bdd/Targets/FreeRtos/solidsyslog_user_tunables.h
  • CLAUDE.md
  • Core/Interface/SolidSyslogTunablesDefaults.h
  • Core/Source/SolidSyslogErrorMessages.h
  • DEVLOG.md
  • Platform/FreeRtos/Interface/SolidSyslogFreeRtosDatagram.h
  • Platform/FreeRtos/Interface/SolidSyslogFreeRtosMutex.h
  • Platform/FreeRtos/Interface/SolidSyslogFreeRtosStaticResolver.h
  • Platform/FreeRtos/Interface/SolidSyslogFreeRtosTcpStream.h
  • Platform/FreeRtos/Source/SolidSyslogFreeRtosDatagram.c
  • Platform/FreeRtos/Source/SolidSyslogFreeRtosDatagramPrivate.h
  • Platform/FreeRtos/Source/SolidSyslogFreeRtosDatagramStatic.c
  • Platform/FreeRtos/Source/SolidSyslogFreeRtosMutex.c
  • Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexPrivate.h
  • Platform/FreeRtos/Source/SolidSyslogFreeRtosMutexStatic.c
  • Platform/FreeRtos/Source/SolidSyslogFreeRtosStaticResolver.c
  • Platform/FreeRtos/Source/SolidSyslogFreeRtosStaticResolverPrivate.h
  • Platform/FreeRtos/Source/SolidSyslogFreeRtosStaticResolverStatic.c
  • Platform/FreeRtos/Source/SolidSyslogFreeRtosTcpStream.c
  • Platform/FreeRtos/Source/SolidSyslogFreeRtosTcpStreamPrivate.h
  • Platform/FreeRtos/Source/SolidSyslogFreeRtosTcpStreamStatic.c
  • Tests/FreeRtos/CMakeLists.txt
  • Tests/FreeRtos/SolidSyslogFreeRtosDatagramTest.cpp
  • Tests/FreeRtos/SolidSyslogFreeRtosMutexTest.cpp
  • Tests/FreeRtos/SolidSyslogFreeRtosStaticResolverTest.cpp
  • Tests/FreeRtos/SolidSyslogFreeRtosTcpStreamTest.cpp

Comment thread DEVLOG.md Outdated
Comment thread Platform/FreeRtos/Source/SolidSyslogFreeRtosDatagramStatic.c
Comment thread Platform/FreeRtos/Source/SolidSyslogFreeRtosStaticResolver.c
Comment thread Platform/FreeRtos/Source/SolidSyslogFreeRtosStaticResolverStatic.c
Comment thread Platform/FreeRtos/Source/SolidSyslogFreeRtosTcpStream.c
Comment thread Tests/FreeRtos/SolidSyslogFreeRtosMutexTest.cpp
Three classes of polish in response to PR #411 review:

1. **Direct stdlib includes** on the four migrated FreeRTOS `.c` files
   (`FreeRtosMutex.c`, `FreeRtosDatagram.c`, `FreeRtosStaticResolver.c`,
   `FreeRtosTcpStream.c`). Each TU now `#include`s `<stdbool.h>`,
   `<stddef.h>`, and/or `<stdint.h>` directly for the standard types it
   uses, rather than relying on transitive includes via FreeRTOS
   headers. CI's `analyze-iwyu` job runs in the cpputest container
   without `FREERTOS_KERNEL_PATH`, so the FreeRTOS adapter sources are
   not covered by the IWYU gate — adding explicit includes anyway as
   the project pattern (matches the `*Static.c` siblings).

2. **Tighter fallback-no-op test assertions** on all four classes'
   pool tests. The `FallbackLockUnlockAreNoOps` /
   `FallbackVtableMethodsAreNoOps` tests now reset the relevant fake
   between FillPool and the fallback exercise and assert `NEVER` on
   every platform-API call the fallback path could touch
   (`SemaphoreTake/Give` for Mutex; `Sendto`/`Closesocket` for
   Datagram; `Connect`/`Closesocket` for TcpStream). The Mutex test
   previously had no assertions at all — passing even if the fallback
   secretly hit the kernel.

3. **DEVLOG test-count fix** — the test-counts paragraph claimed
   "36 overall (9 × 4)" and "~37" and "8 tests added to Mutex / 0 to
   Datagram" inconsistently. The actual numbers are: 37 Pool-group
   tests total (9 each for Mutex / Datagram / TcpStream; 10 for
   StaticResolver — 9 canonical + 1 class-specific), net +36 once
   the superseded `DestroyIsIdempotent` is netted out.

Skipped CodeRabbit findings:

- **`SolidSyslogFreeRtosDatagram_Destroy` treating
  `NullDatagram_Get()` as a no-op destroy target** — declined. The
  WARNING-on-fallback-Destroy is the established E11 pattern across
  every migrated class (Posix, Windows, Core); diverging only on
  FreeRTOS would break the contract uniformity. If the cross-cutting
  shape should change, that's an epic-wide story, not a S11.08
  deviation.

- **NULL-validation on `ipv4Octets` in
  `SolidSyslogFreeRtosStaticResolver_Create`** — declined per the
  project rule that validation only belongs at true system boundaries
  (user input, external APIs); `_Create` is integrator setup wiring.
  Pre-migration the function also crashed on NULL — no regression.
  CodeRabbit itself quoted this rule in its comment.

Refs #410, PR #411.
@github-actions

Copy link
Copy Markdown
Contributor

☀️   Quality Summary

   🚦   build-linux-gcc: 100% successful (✔️ 1263 passed, 🙈 2 skipped)
   🚦   build-freertos-host-tdd: 100% successful (✔️ 1417 passed, 🙈 2 skipped)
   🚦   build-linux-clang: 100% successful (✔️ 1215 passed, 🙈 2 skipped)
   🚦   sanitize-linux-gcc: 100% successful (✔️ 1215 passed, 🙈 2 skipped)
   🚦   integration-linux-openssl: 100% successful (✔️ 9 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: 73% successful (✔️ 36 passed, 🙈 13 skipped)
   🚦   build-windows-msvc: 100% successful (✔️ 1104 passed, 🙈 1 skipped)
   🚦   build-linux-tunable-override: 100% successful (✔️ 1215 passed, 🙈 2 skipped)
   ⚠️   Clang-Tidy: 3 warnings (normal: 3)
   ⚠️   CPPCheck: No warnings


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

@DavidCozens DavidCozens merged commit 986f325 into main May 20, 2026
20 checks passed
@DavidCozens DavidCozens deleted the refactor/s11-08-freertos-sweep branch May 20, 2026 12:27
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.

S11.08: Sweep — FreeRTOS adapters onto PoolAllocator

1 participant