Skip to content

feat: S08.03 slice 6 cmdline -> set translation in target_driver (untag prival, message_fields, udp_mtu Full delivery)#307

Merged
DavidCozens merged 5 commits into
mainfrom
feat/freertos-cmdline-set-translation
May 10, 2026
Merged

feat: S08.03 slice 6 cmdline -> set translation in target_driver (untag prival, message_fields, udp_mtu Full delivery)#307
DavidCozens merged 5 commits into
mainfrom
feat/freertos-cmdline-set-translation

Conversation

@DavidCozens

@DavidCozens DavidCozens commented May 9, 2026

Copy link
Copy Markdown
Owner

Closes #306. Refs #268.

Summary

  • New apply_extra_args helper in the BDD target driver: on FreeRTOS, translates --flag value cmdline pairs into set NAME VALUE UART writes after the prompt is up; Linux/Windows is a no-op (flags already in argv from spawn). Translation table covers exactly the four flags @udp features pass to run_example (--facility, --severity, --msgid, --message); unknown flags raise loudly with a Python traceback.
  • FreeRTOS example: OnSet loosens facility/severity input validation (drops parsed > 23U / parsed > 7U rejections) so out-of-range values reach the library and encode as the internal-error PRIVAL 43, mirroring Linux's atoi-and-cast.
  • FreeRTOS example: MAX_LINE_LENGTH and g_msg grow from 256 to SOLIDSYSLOG_MAX_MESSAGE_SIZE (2048) so a single set msg <body> line can carry a full path-MTU-class UTF-8 body. INTERACTIVE_TASK_STACK_DEPTH *32 → *40 to absorb the larger line + name frames.
  • Tag movement: drop feature-level @freertoswip from prival.feature, message_fields.feature, udp_mtu.feature; keep scenario-level @freertoswip on message_fields::Complete RFC 5424 (system identity / current time) and udp_mtu::Oversize (UDP-stack EMSGSIZE semantics).
  • After this slice the FreeRTOS BDD sweep is 4 features / 10 scenarios passing (up from the slice-5 walking-skeleton baseline of 1 scenario).

Test plan

  • cmake --build --preset freertos-cross --target SolidSyslogFreeRtosSingleTask clean.
  • behave --tags='not @wip and not @freertoswip and @udp' Bdd/features/ against syslog-ng-freertos — 4 features pass, 10 scenarios pass, 36 skipped, 0 failed.
  • clang-format --dry-run --Werror on every changed C file — clean.
  • CI: bdd-linux-syslog-ng regression — Linux suite must remain green (this PR's only Linux-visible touch is apply_extra_args, a no-op when target != "freertos").
  • CI: bdd-freertos-qemu — should report 10 passing scenarios.
  • CI: analyze-tidy, analyze-cppcheck, analyze-iwyu, analyze-format, build-linux-gcc/clang, sanitize-linux-gcc, coverage-linux-gcc — Linux-side static analysis, not runnable from the freertos-target devcontainer.
  • CI: build-windows-msvc, bdd-windows-otel — Windows-side regression.

What stays tagged @freertoswip

Feature / scenario Reason Future slice
syslog.feature (single scenario) Asserts system hostname / current timestamp / process PID Set hostname/procid from BDD step + clock callback; or loosen the assertions on FreeRTOS
header_fields::Hostname, ::Process ID Same as above Same
message_fields::Complete RFC 5424 Same as above Same
timestamp.feature Hardcoded RFC 5424 publication date Real RTC-backed clock callback
structured_data.feature No meta SD wired in the FreeRTOS example Wire meta SD (sequenceId, sysUpTime, language)
origin.feature No origin SD wired Wire origin SD
time_quality.feature No timeQuality SD wired Wire timeQuality SD
udp_mtu::Oversize UDP path-MTU EMSGSIZE on FreeRTOS-Plus-TCP unverified Investigate FreeRTOS_sendto error semantics
buffered.feature No FreeRTOS Threaded example FreeRTOS Threaded example

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • FreeRTOS target can accept equivalent command-line parameters via post-startup UART commands.
  • Improvements

    • Larger interactive message buffer to avoid truncation.
    • Increased interactive task stack depth for stability.
    • Facility/severity parsing relaxed to match Linux behavior.
  • Tests / Chores

    • BDD tagging refined per-scenario; test runner behavior tightened.
    • DEVLOG updated with FreeRTOS-driver and verification notes.

Review Change Stack

DavidCozens and others added 4 commits May 9, 2026 21:00
…nslation

Land the cmdline -> `set` bridge in the BDD target driver and untag
prival.feature on the FreeRTOS-on-QEMU runner.

- target_driver: spawn no longer raises on FreeRTOS extra_args. New
  apply_extra_args helper walks --flag/value pairs after the prompt
  is up and writes `set NAME VALUE` lines to the UART. Unknown flags
  / odd-length args lists raise ValueError so a misconfigured
  scenario fails loudly rather than silently no-op'ing.
- _run_with_prompt_protocol: invokes apply_extra_args after
  wait_for_prompt; Linux/Windows is a no-op there.
- main.c::OnSet: drop the parsed > 23U / parsed > 7U upper-bound
  rejections on facility/severity. Mirrors the Linux example's
  atoi-and-cast so the library is the single authority on what's
  valid (out-of-range encodes as the internal-error PRIVAL 43).
- prival.feature: drop the feature-level @freertoswip; all six
  scenarios pass against syslog-ng-freertos.

Refs #306, #268.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…dp_mtu Full delivery

Extend the cmdline -> `set` translation table so msgid/message flags
reach the FreeRTOS example, and grow the UART line buffer + g_msg
storage so a single `set msg <body>` line can carry a full
path-MTU-class message body.

- target_driver: --msgid -> set msgid, --message -> set msg.
- ExampleInteractive: MAX_LINE_LENGTH 256 -> SOLIDSYSLOG_MAX_MESSAGE_SIZE
  so fgets doesn't split a `set msg <372-byte UTF-8 body>` line across
  reads. The HandleSet name[] inherits the same size; future work may
  decouple the name buffer (always short) from the line buffer.
- main.c: g_msg 256 -> SOLIDSYSLOG_MAX_MESSAGE_SIZE so the storage
  matches the library's bound and the BDD UTF-8 path-MTU test fits.
  INTERACTIVE_TASK_STACK_DEPTH *32 -> *40 to absorb the ~4 KB peak
  added by the larger line + name frames.
- message_fields.feature: drop the feature-level @freertoswip; tag
  the Complete RFC 5424 scenario individually (still asserts system
  hostname / current timestamp / process PID).
- udp_mtu.feature: drop the feature-level @freertoswip; tag the
  Oversize scenario individually (UDP path-MTU clipping depends on
  EMSGSIZE semantics that FreeRTOS-Plus-TCP doesn't currently
  surface).

After this slice the FreeRTOS BDD sweep is 4 features / 10 scenarios
passing, up from the 1-scenario walking-skeleton baseline.

Refs #306, #268.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The longer SOLIDSYSLOG_MAX_MESSAGE_SIZE bracket pushes clang-format's
alignment column for the g_* statics; the surrounding g_host / g_port /
g_endpointVersion lines need the same extra padding to stay
column-consistent.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 9, 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: 89bdee90-c6df-4467-b727-a075b3b91ce6

📥 Commits

Reviewing files that changed from the base of the PR and between 2ff4f69 and 5a6d9e5.

📒 Files selected for processing (1)
  • DEVLOG.md
✅ Files skipped from review due to trivial changes (1)
  • DEVLOG.md

📝 Walkthrough

Walkthrough

Adds a post-prompt helper to translate BDD --flag value pairs into FreeRTOS set NAME VALUE UART commands, invokes it from the prompt-based runner, relaxes FreeRTOS facility/severity OnSet checks, increases FreeRTOS interactive buffer/stack sizing, and moves @freertoswip tags from feature-level to scenario-level.

Changes

FreeRTOS BDD cmdline → set translation feature

Layer / File(s) Summary
Command translation specification
Bdd/features/steps/target_driver.py, Example/Common/ExampleInteractive.c
Add _FREERTOS_SET_TRANSLATION mapping --facility,--severity,--msgid,--message → FreeRTOS set keys. Replace fixed MAX_LINE_LENGTH with SOLIDSYSLOG_MAX_MESSAGE_SIZE.
Target driver apply_extra_args implementation
Bdd/features/steps/target_driver.py
New apply_extra_args(context, process, extra_args) validates flag/value pairs, translates known flags to set NAME VALUE, writes to FreeRTOS stdin, and remove prior NotImplementedError for FreeRTOS extra_args.
BDD step integration
Bdd/features/steps/syslog_steps.py
Import apply_extra_args and call it in _run_with_prompt_protocol immediately after the prompt is ready and before sending test commands.
FreeRTOS example field validation and sizing
Example/FreeRtos/SingleTask/main.c
Drop upper-bound checks for facility and severity in OnSet(), increase INTERACTIVE_TASK_STACK_DEPTH, and resize g_msg to SOLIDSYSLOG_MAX_MESSAGE_SIZE.
BDD feature tag reorganization
Bdd/features/message_fields.feature, Bdd/features/prival.feature, Bdd/features/udp_mtu.feature
Remove feature-level @freertoswip where applicable and add @freertoswip only to scenarios that still require it; change prival.feature tag to @udp.
Documentation
DEVLOG.md
Append S08.03 slice 6 entry documenting translation approach, validation/sizing changes, tagging strategy, verifications, and follow-ups.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

  • DavidCozens/solid-syslog#268: Implements the cmdline→set translation and FreeRTOS tagging/validation work described in the UDP/FreeRTOS epic.

Possibly related PRs

Poem

🐰 I hop to the UART, flags in my paw,
I whisper "set msg" after prompt I saw,
Facility and severity dance without bounds,
Tests untagged now — rejoice in the rounds,
Tiny rabbit cheers: tests pass, ears aglow.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly summarizes the main change: cmdline-to-set translation in target_driver with tag movement for three unblocked features.
Description check ✅ Passed The PR description includes all required sections: Purpose (closes #306, refs #268), Change Description (detailed summary of helper, FreeRTOS changes, tag movement), Test Evidence (local verification steps and CI checks with pass/pending statuses), and Areas Affected (BDD driver, FreeRTOS example, multiple feature files).
Linked Issues check ✅ Passed All primary coding objectives from #306 are met: apply_extra_args helper implemented with exact four-flag translation table, FreeRTOS OnSet validation loosened, buffers increased, and unblocked scenarios untagged while preserving scope boundaries.
Out of Scope Changes check ✅ Passed All changes are directly aligned with #306 scope: target_driver translation, FreeRTOS example input validation and buffer sizing, feature-tag reorganization, and DEVLOG entry. No unrelated modifications detected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ 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 feat/freertos-cmdline-set-translation

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.

@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: 1

🧹 Nitpick comments (1)
Bdd/features/steps/target_driver.py (1)

100-134: 💤 Low value

Consider adding strict=True to the zip call for defensive programming.

While the odd-length check at line 118 already prevents mismatched flag/value pairs, adding strict=True to the zip at line 123 would make the code more robust against future refactoring and would be consistent with modern Python best practices (PEP 618).

🔧 Proposed enhancement
-    for flag, value in zip(extra_args[0::2], extra_args[1::2]):
+    for flag, value in zip(extra_args[0::2], extra_args[1::2], strict=True):

Note: This requires Python 3.10+. If the BDD environment uses an earlier version, skip this change.

🤖 Prompt for 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.

In `@Bdd/features/steps/target_driver.py` around lines 100 - 134, The
apply_extra_args function currently zips flags and values with
zip(extra_args[0::2], extra_args[1::2]) which silently truncates if lengths ever
mismatch; update that call to use zip(..., strict=True) so Python will raise a
ValueError on any length mismatch and make the check defensive, keeping the
existing odd-length pre-check; reference the symbols apply_extra_args and
_FREERTOS_SET_TRANSLATION when locating the change and ensure your environment
runs Python >=3.10 before applying strict=True.
🤖 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 59-63: The MD037 issue is caused by the plain `*32`/`*40` being
parsed as emphasis; update the DEVLOG entry mentioning
INTERACTIVE_TASK_STACK_DEPTH and HandleSet (and the `name[]` reference) to treat
those numeric values as literal text by wrapping them in code spans (e.g.,
`*32`, `*40`) or escaping the asterisks, so the markdown linter no longer
interprets them as emphasis while preserving the original wording about stack
size and headroom.

---

Nitpick comments:
In `@Bdd/features/steps/target_driver.py`:
- Around line 100-134: The apply_extra_args function currently zips flags and
values with zip(extra_args[0::2], extra_args[1::2]) which silently truncates if
lengths ever mismatch; update that call to use zip(..., strict=True) so Python
will raise a ValueError on any length mismatch and make the check defensive,
keeping the existing odd-length pre-check; reference the symbols
apply_extra_args and _FREERTOS_SET_TRANSLATION when locating the change and
ensure your environment runs Python >=3.10 before applying strict=True.
🪄 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: b6a2da9f-e4dc-4882-9140-db4197353036

📥 Commits

Reviewing files that changed from the base of the PR and between 1f2833e and 2ff4f69.

📒 Files selected for processing (8)
  • Bdd/features/message_fields.feature
  • Bdd/features/prival.feature
  • Bdd/features/steps/syslog_steps.py
  • Bdd/features/steps/target_driver.py
  • Bdd/features/udp_mtu.feature
  • DEVLOG.md
  • Example/Common/ExampleInteractive.c
  • Example/FreeRtos/SingleTask/main.c
💤 Files with no reviewable changes (1)
  • Bdd/features/prival.feature

Comment thread DEVLOG.md Outdated
@github-actions

github-actions Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

☀️   Quality Summary

   🚦   build-linux-gcc: 100% successful (✔️ 1105 passed, 🙈 3 skipped)
   🚦   build-linux-clang: 100% successful (✔️ 1042 passed, 🙈 3 skipped)
   🚦   sanitize-linux-gcc: 100% successful (✔️ 1042 passed, 🙈 3 skipped)
   🚦   integration-linux-openssl: 100% successful (✔️ 9 passed)
   🚦   integration-windows-openssl: 100% successful (✔️ 9 passed)
   🚦   bdd-linux-syslog-ng: 100% successful (✔️ 46 passed)
   🚦   bdd-windows-otel: 96% successful (✔️ 44 passed, 🙈 2 skipped)
   🚦   bdd-freertos-qemu: 22% successful (✔️ 10 passed, 🙈 36 skipped)
   🚦   build-windows-msvc: 100% successful (✔️ 954 passed, 🙈 1 skipped)
   ⚠️   Clang-Tidy: No warnings
   ⚠️   CPPCheck: No warnings


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

correct escaping of literal * in emphasis section

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

☀️   Quality Summary

   🚦   build-linux-gcc: 100% successful (✔️ 1105 passed, 🙈 3 skipped)
   🚦   build-linux-clang: 100% successful (✔️ 1042 passed, 🙈 3 skipped)
   🚦   sanitize-linux-gcc: 100% successful (✔️ 1042 passed, 🙈 3 skipped)
   🚦   integration-linux-openssl: 100% successful (✔️ 9 passed)
   🚦   integration-windows-openssl: 100% successful (✔️ 9 passed)
   🚦   bdd-linux-syslog-ng: 100% successful (✔️ 46 passed)
   🚦   bdd-windows-otel: 96% successful (✔️ 44 passed, 🙈 2 skipped)
   🚦   bdd-freertos-qemu: 22% successful (✔️ 10 passed, 🙈 36 skipped)
   🚦   build-windows-msvc: 100% successful (✔️ 954 passed, 🙈 1 skipped)
   ⚠️   Clang-Tidy: No warnings
   ⚠️   CPPCheck: No warnings


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

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.

S08.03 slice 6: cmdline -> set translation in target_driver (untag prival, message_fields, udp_mtu)

1 participant