feat: v0.16.0 rate limiting — token-bucket admission control - #21
Merged
Conversation
Ports cpp-RCP's ratelimit.hpp: a token-bucket admission-control decorator
(same generic-wrapper vtable pattern used since v0.9.0). rcp_ratelimit_config_t
carries rate (tokens/second refill), burst (max accumulation), and
exempt_critical (bypass the bucket for RCP_PRIORITY_CRITICAL, default true,
so watchdog kicks and emergency actuation are never throttled). Tokens
refill lazily on each send() based on elapsed wall time (via
rcp_monotonic_ms()), matching cpp-RCP's own steady_clock-based lazy refill
-- no background thread needed for this milestone.
tests/test_ratelimit.c ports all 7 of cpp-RCP's test_ratelimit.cpp cases.
Verification performed:
- Full test suite: 17/17 passing (added rcp_ratelimit).
- cfusa trace --req-coverage 100: Metric 2 100% (163/163, hard gate).
- cfusa check/lint: only known/ticketed CFUSA-L004 false positives
(SoundMatt/c-FuSa#59, DISP-0001), unchanged count (3).
- cfusa analyze/cyber/qualify/vuln: clean (0 errors).
- ASan/UBSan build+test pass: clean, no leaks/UB detected.
Signed-off-by: Matt <matt@jellybaby.com>
Signed-off-by: Matt Jones <47545907+SoundMatt@users.noreply.github.com>
This was referenced Aug 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ratelimit.hpp: a token-bucket admission-control decorator (same generic-wrapper vtable pattern used since v0.9.0).rcp_ratelimit_config_tcarriesrate(tokens/second refill),burst(max accumulation), andexempt_critical(bypass the bucket forRCP_PRIORITY_CRITICAL, default true).send()based on elapsed wall time (viarcp_monotonic_ms()) — no background thread needed for this milestone.tests/test_ratelimit.cports all 7 of cpp-RCP'stest_ratelimit.cppcases.Test plan
ctest --test-dir build— 17/17 passing (addedrcp_ratelimit)cfusa trace --req-coverage 100— Metric 2 100% (hard gate)cfusa check/lint— only known/ticketed CFUSA-L004 false positives (CFUSA-L004 recursion-check fires on virtually every function (false positive) c-FuSa#59, DISP-0001), unchanged countcfusa analyze/cyber/qualify/vuln— clean (0 errors)Signed-off-by: Matt matt@jellybaby.com