Skip to content

Fix #2803, reduce complexity in cfe_sb_api.c - #2816

Open
Cameron-Sykes wants to merge 3 commits into
nasa:devfrom
Cameron-Sykes:fix-2803-cfe-sb-api-complexity
Open

Fix #2803, reduce complexity in cfe_sb_api.c#2816
Cameron-Sykes wants to merge 3 commits into
nasa:devfrom
Cameron-Sykes:fix-2803-cfe-sb-api-complexity

Conversation

@Cameron-Sykes

@Cameron-Sykes Cameron-Sykes commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

name: FSW Code Change
about: Flight Software code changes
labels: fsw

Description of Change

Functions CFE_SB_CreatePipe() and CFE_SB_SubscribeFull() have high complexity. The complexity was lowered by ...

Linked Issue

Closes #2803

Requirements Impact

  • Requirement ID(s): None
  • Requirements updated as necessary
  • Existing requirements are still satisfied by this change

Testing Evidence

  • Link to complexity analysis CI run

Unit Tests (UT Assert)

  • Link to CI run

COSMOS Test Suite

  • Link to CI run

Areas of Expertise Touched

  • ASTRO
  • CI/CD
  • COSMOS
  • Cybersecurity
  • Docker
  • EDS
  • Git
  • PSPs
  • SBN
  • SMP
  • Tables
  • TSN
  • Unit Tests
  • Other

Author Checklist

  • Linked GitHub issue is referenced above
  • Code has been formatted with .clang-format
  • Static analysis workflows ran and passed
  • Unit tests (UT Assert) updated/added to cover code changes
  • Unit test workflows ran and passed
  • COSMOS test suite was run; tests updated/added if relevant changes were made
  • Requirements have been reviewed; updated or confirmed still satisfied (see above)
  • Testing evidence is included above
  • Self-review of the diff completed

Reviewer Checklist

  • Code logic is correct and matches the stated intent
  • Code is readable, maintainable, and follows project conventions
  • .clang-format has been applied
  • Static analysis results reviewed and acceptable
  • Unit tests are meaningful and adequately cover the changes
  • The change has been exercised by the unit tests (not just that tests pass — the new/changed code paths are actually covered)
  • COSMOS test suite was executed against this change and results reviewed (or confirmed N/A with justification)
  • Reviewer has independently verified the change behaves as described (e.g., by running the tests locally, reviewing CI output in detail, or performing additional ad-hoc testing as warranted)
  • Memory safety reviewed (allocation, bounds, lifetime, stack usage)
  • Requirements impact reviewed and appropriate
  • Error handling is appropriate
  • Appropriate Expert areas have been reviewed

Reviewer Testing Notes

@Cameron-Sykes Cameron-Sykes self-assigned this Aug 27, 2026
@Cameron-Sykes
Cameron-Sykes force-pushed the fix-2803-cfe-sb-api-complexity branch 3 times, most recently from 8e2f364 to 32ff890 Compare September 2, 2026 18:39
@Cameron-Sykes
Cameron-Sykes force-pushed the fix-2803-cfe-sb-api-complexity branch 3 times, most recently from 4b416e8 to 9c3294e Compare September 2, 2026 19:32
@Cameron-Sykes
Cameron-Sykes force-pushed the fix-2803-cfe-sb-api-complexity branch from 9c3294e to b6502b8 Compare September 2, 2026 19:36

@sylvesterkaczmarek sylvesterkaczmarek left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CFE_SB_MAX_PIPES_MET_EID is now emitted while CFE_SB_LockSharedData is held. EVS event delivery goes through CFE_SB_TransmitMsg, which acquires SB shared data again; the old PendingEventId path deliberately deferred these events until after the final unlock. Preserve that deferred-event pattern (or unlock before sending) and add a max-pipes regression that exercises event delivery.

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.

Two functions in cfe_sb_api.c have complexity > 15

2 participants