Skip to content

test(concurrency): harden limiter accounting - #56

Merged
thomhurst merged 5 commits into
mainfrom
issue-23-concurrency-races
Aug 21, 2026
Merged

test(concurrency): harden limiter accounting#56
thomhurst merged 5 commits into
mainfrom
issue-23-concurrency-races

Conversation

@thomhurst

Copy link
Copy Markdown
Owner

Summary

  • deterministically saturate every running and queued slot, then verify exact overflow rejection
  • cover both queued-cancellation-before-grant and grant-before-cancellation orders
  • mix synchronous and asynchronous success, failure, and cancellation across 32 reuse rounds
  • prove shared accounting across named/composed copies and accepted capacity arithmetic near int.MaxValue
  • document cancellation/grant accounting behavior

Closes #23

Validation

  • dotnet build Kevlar.slnx -c Release --no-incremental
  • dotnet run --project tests/Kevlar.Tests -c Release --no-build -- --timeout 5m (379 passed; 51 consecutive runs)
  • dotnet run --project tests/Kevlar.IntegrationTests -c Release --no-build -- --timeout 5m (16 passed)
  • dotnet run --project tests/Kevlar.Analyzers.Tests -c Release --no-build -- --timeout 5m (19 passed)
  • dotnet run --project tests/Kevlar.NetStandard.Tests -c Release --no-build -- --timeout 5m (1 passed)
  • npm --prefix docs run build

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@thomhurst, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 7 seconds

Limit details: You’ve used all 10 included reviews currently available.

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

Wait for the limit to reset, then comment @coderabbitai review or push new commits to the PR.

An organization admin can change what happens after included review limits in Billing.

How do review limits work?

CodeRabbit enforces per-developer PR review limits within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5a7bc70c-1ddf-4eb9-9843-cb7da0c4a50d

📥 Commits

Reviewing files that changed from the base of the PR and between 60aa482 and 72a21f3.

📒 Files selected for processing (2)
  • docs/docs/strategies/concurrency-limit.md
  • tests/Kevlar.Tests/ConcurrencyLimitRaceTests.cs

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8851f46114

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/Kevlar.Tests/ConcurrencyLimitRaceTests.cs
@greptile-apps

greptile-apps Bot commented Aug 21, 2026

Copy link
Copy Markdown

Greptile Summary

This PR documents concurrency-limit cancellation accounting and adds deterministic tests for saturation, cancellation ordering, repeated reuse, shared limiter state, and near-maximum capacity arithmetic.

  • Adds exact capacity and overflow assertions.
  • Exercises success, failure, cancellation, composition, and repeated limiter reuse.
  • Documents how queued cancellation and slot grants affect accounting.

Confidence Score: 4/5

The PR appears safe to merge, with non-blocking gaps in how the new tests exercise the grant race and observe mixed queued executions.

Production behavior is unchanged, but the new tests can miss cancellation during the actual semaphore handoff and can miss early or over-capacity execution by mixed queued delegates.

Files Needing Attention: tests/Kevlar.Tests/ConcurrencyLimitRaceTests.cs

Important Files Changed

Filename Overview
tests/Kevlar.Tests/ConcurrencyLimitRaceTests.cs Adds broad limiter-accounting coverage, but the grant test does not overlap cancellation with handoff and mixed queued delegates are absent from concurrency instrumentation.
docs/docs/strategies/concurrency-limit.md Documents queue-place release and exactly-once accounting across cancellation and slot-grant outcomes.

Reviews (1): Last reviewed commit: "test(concurrency): harden limiter races" | Re-trigger Greptile

Comment thread tests/Kevlar.Tests/ConcurrencyLimitRaceTests.cs
Comment thread tests/Kevlar.Tests/ConcurrencyLimitRaceTests.cs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4728d426d9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/Kevlar.Tests/ConcurrencyLimitRaceTests.cs

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 55462e8161

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/Kevlar.Tests/ConcurrencyLimitRaceTests.cs

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 43b70e850f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/docs/strategies/concurrency-limit.md Outdated
@thomhurst
thomhurst force-pushed the issue-23-concurrency-races branch from 30d029d to 72a21f3 Compare August 21, 2026 13:12
@thomhurst
thomhurst merged commit c7ddbb2 into main Aug 21, 2026
7 checks passed
@thomhurst
thomhurst deleted the issue-23-concurrency-races branch August 21, 2026 13:20
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.

test(concurrency-limit): stress accounting and grant-cancellation races

1 participant