Skip to content

S24.09: StreamSender bad-setup contract — reject NULL Resolver / Stream / Address #424

Closed

Description

@DavidCozens

Parent epic: #254

Motivation

SolidSyslogUdpSender_Create validates its config and rejects NULL
Resolver / Datagram / Address / Endpoint with the bad-setup
contract from S12.06 — SolidSyslog_Error(ERR, ...) + nil-object
fallback (SolidSyslogNullSender).

SolidSyslogStreamSender_Create has no equivalent. It happily accepts
a config with NULL Resolver, NULL Stream, or NULL Address, then crashes
on the first SolidSyslogSender_Send when it dereferences the missing
collaborator. CodeRabbit flagged the new config->Address NULL path
on PR #422; deferred from S24.07 because adding only Address
validation without the other three would be inconsistent — fixing the
whole bad-setup contract together is its own atom.

This story brings StreamSender to the same bad-setup posture as
UdpSender.

Current state (audit 2026-05-25, main @ 4b3a361)

  • Core/Source/SolidSyslogStreamSenderStatic.c::SolidSyslogStreamSender_Create
    has no IsValidConfig helper and no NULL-checks on config, Resolver,
    Stream, or Address. The only failure path it emits is
    STREAMSENDER_ERROR_POOL_EXHAUSTED.
  • Core/Interface/SolidSyslogStreamSenderErrors.h enum lists only
    POOL_EXHAUSTED, UNKNOWN_DESTROY, MAX.
  • Core/Source/SolidSyslogStreamSenderMessages.c carries only those two
    message strings.
  • Tests/SolidSyslogStreamSenderTest.cpp has no SolidSyslogStreamSenderBadSetup
    TEST_GROUP — grep for BadSetup / NULL_RESOLVER returns nothing.

No prior work landed on this story; all four acceptance criteria are
outstanding.

Acceptance criteria

  • SolidSyslogStreamSender_Create rejects config == NULL,
    config->Resolver == NULL, config->Stream == NULL, and
    config->Address == NULL with distinct
    STREAMSENDER_ERROR_NULL_{CONFIG,RESOLVER,STREAM,ADDRESS} codes
    (naming matches the UDPSENDER_ERROR_NULL_* convention).
  • On bad config, _Create returns SolidSyslogNullSender_Get() —
    pool slot is not consumed. Matches SolidSyslogUdpSender_Create's
    IsValidConfig/early-return shape
    (Core/Source/SolidSyslogUdpSenderStatic.c:48-76).
  • Existing tests pass; new TDD-driven tests cover each of the four
    NULL paths (mirroring the SolidSyslogUdpSenderBadSetup tests at
    Tests/SolidSyslogUdpSenderTest.cpp:763-823).
  • CLAUDE.md SolidSyslogStreamSender.h row updated to note the
    bad-setup contract (currently says "Pool exhaustion resolves to
    the shared SolidSyslogNullSender"; extend with the bad-config
    fallback as the SolidSyslogUdpSender.h row already does).
  • No behaviour change for existing valid wirings — only adds the
    NULL-rejection paths.

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    storyStory issue

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions