feat: harden BDD target stderr error handler to exit on ERROR severity#404
Conversation
ERROR-class severities (EMERGENCY/ALERT/CRITICAL/ERROR) write
'BDD-TARGET: FATAL: <message>\n', flush stderr, and _Exit(3).
WARNING stays as the existing print-only line.
Turns silent NULL-fallback-on-pool-exhaustion into a loud,
debuggable BDD failure ('BDD target died' vs. 'oracle received
0 of 1').
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR hardens the BDD target stderr error handler to treat ChangesBDD stderr handler fatal exit hardening
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
☀️ Quality Summary 🚦 build-linux-gcc: 100% successful (✔️ 1192 passed, 🙈 2 skipped) Created by Quality Monitor v1.14.0 (#f3859fd). More details are shown in the GitHub Checks Result. |
Purpose
S11.05 part B (#403) finished green but spent 23 minutes in CI vs the usual 4–5. Per-step timing showed both
build-linux-tunable-overrideandbuild-freertos-targetspent ~16 minutes in the "Initialize containers" step (ghcr.io image pull) — runner cold-cache, not a project regression. Other jobs on the same run using the same image pulled in seconds.The real concern surfaced by that diagnosis is that pool exhaustion in a BDD wiring scenario would currently fail silently:
_Createreturns the shared null object, the BDD target keeps running on it, the oracle receives nothing, the scenario times out, and the captured failure is "oracle received 0 of 1" rather than "BDD target died onPOOL_EXHAUSTED". Same failure class as part A'sSTREAM_SENDERdefault-1 bust (#402).This PR hardens the BDD-target stderr handler so the silent-drop class becomes a loud, locally-debuggable failure.
Change Description
Bdd/Targets/Common/BddTargetStderrErrorHandler.cnow branches on severity:severity <= SOLIDSYSLOG_SEVERITY_ERROR(EMERGENCY / ALERT / CRITICAL / ERROR) ⇒fprintf(stderr, "BDD-TARGET: FATAL: %s\n", message),fflush(stderr),_Exit(3).Design notes:
_Exit(C99<stdlib.h>) not_exit(POSIX<unistd.h>). The Common/ file is shared by the Windows BDD target as well, so the portable C99 form is required. Same no-atexit / no-stdio-flush semantics —fflush(stderr)is called first so the FATAL marker reaches the wire before the process disappears.<=rather than==so EMERGENCY / ALERT / CRITICAL also exit. Library code only emits ERROR/WARNING today, so the forms are equivalent in practice, but<=is the defensible semantics._Exitseam (function-pointer indirection + paired interceptor test) is more abstraction than the change justifies. The honest validation is end-to-end via a BDD scenario that deliberately starves a pool — which doesn't yet exist; raised as a Deferred item in DEVLOG. Compile-time gates carry the rest.Test Evidence
All local gates green on the branch in the project's dev containers:
debug— 1188 tests passsanitize(ASan + UBSan) — 1188 tests passclang-debug— 1188 tests passtidy— clean (warnings-as-errors)cppcheck— cleancoverage— cleaniwyu— clean (invoked ascmake --build --preset iwyu --target iwyu)clang-format --dry-run --WerroroverCore/Interface Core/Source Tests Bdd/Targets— cleanCI will cover Windows MSVC, FreeRTOS cross/QEMU, and the BDD jobs.
Areas Affected
Bdd/Targets/Common/BddTargetStderrErrorHandler.c— Tier 3 (BDD targets, best-effort). No production-library impact.DEVLOG.md— session entry.No public-header or Core/ changes.
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Documentation