Skip to content

Document pool rate limiting in Copilot instructions#4397

Draft
mdaigle wants to merge 3 commits into
dev/mdaigle/pool-channel-rate-limitingfrom
dev/mdaigle/pool-rate-limit-instructions
Draft

Document pool rate limiting in Copilot instructions#4397
mdaigle wants to merge 3 commits into
dev/mdaigle/pool-channel-rate-limitingfrom
dev/mdaigle/pool-rate-limit-instructions

Conversation

@mdaigle

@mdaigle mdaigle commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

This is Part 3 of 3 splitting #4376 ("Dev/mdaigle/pool rate limit") into stacked, reviewable PRs. It stacks on #4396 (Part 2) — review/merge that first.

This PR updates the repository's Copilot/agent instruction files to document the connection-pool rate-limiting feature and the associated testing guidance (e.g. TimeProvider/FakeTimeProvider usage and blocking-period / rate-limiter test patterns).

Changes

  • .github/copilot-instructions.md
  • .github/instructions/testing.instructions.md

Stacking

Checklist

  • Documentation only — no code changes
  • No public API changes
  • No breaking changes

mdaigle added 3 commits June 23, 2026 10:23
Move the connection pool's blocking-period (error backoff) logic out of WaitHandleDbConnectionPool into a reusable, testable BlockingPeriodErrorState class with exponential backoff (5s..60s), cached-exception fast-fail, and an injectable TimeProvider for deterministic tests. Add DbConnectionPoolGroup.IsBlockingPeriodEnabled() and the ADP.UnsafeCreateTimer(TimeProvider,...) overload it depends on. Includes BlockingPeriodErrorStateTest.
Introduce an optional System.Threading.RateLimiting policy that throttles new physical connection opens in the channel pool: when a permit is denied the caller waits for a returned connection instead of forcing a create, and leases are always released (including on failure) to avoid starvation. Adds NoOpAcquiredLease, wires the RateLimiting package into the product and test projects, and includes the 006-pool-rate-limiting spec. Also repairs two pre-existing build breaks in ChannelDbConnectionPoolTest (a dropped CountingSuccessfulConnectionFactory declaration and DbConnectionPoolGroupOptions calls missing the new idleTimeout argument).
Document the connection-pool rate-limiting feature and related testing guidance (TimeProvider/FakeTimeProvider usage, blocking-period and rate-limiter test patterns) in the repository Copilot instruction files.
Copilot AI review requested due to automatic review settings June 23, 2026 17:34
@github-project-automation github-project-automation Bot moved this to To triage in SqlClient Board Jun 23, 2026

Copilot AI 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.

Pull request overview

This PR updates the repository’s contributor/agent guidance documents under .github/, adding stricter conventions for writing tests and adding a required workflow for discovering applicable instruction files via applyTo patterns.

Changes:

  • Expanded the testing guide’s expectations for what test comments should explain and added “Implementation Guidance” emphasizing AAA.
  • Reworked the “Test Structure” section into an explicit Arrange–Act–Assert (AAA) pattern description with a canonical example.
  • Added a required “Instruction File Lookup” workflow to .github/copilot-instructions.md directing agents to consult .github/instructions/ before making changes.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
.github/instructions/testing.instructions.md Adds/strengthens guidance for test documentation and AAA structure, including a canonical pattern example.
.github/copilot-instructions.md Adds a required workflow telling agents to locate and apply matching instruction files via applyTo patterns before editing/creating files.

Comment on lines +227 to 242
[Fact]
public void MethodName_Scenario_ExpectedResult()
{
[Fact]
public void MethodName_Scenario_ExpectedResult()
{
// Arrange
var sut = new SystemUnderTest();

// Act
var result = sut.PerformAction();

// Assert
Assert.Equal(expected, result);
}
// Arrange
// Set up test fixtures, initial state, dependencies, and test data
var sut = new SystemUnderTest();
var input = new TestData();

// Act
// Execute the code under test
var result = sut.PerformAction(input);

// Assert
// Validate outcomes and expectations
Assert.Equal(expected, result);
}
Comment on lines 214 to 217
public void AppRunWithMalformedConnectionStringReturnsOneAndWritesParseError()
{
// Arrange / Act / Assert
}
Comment on lines +155 to +160
## Instruction File Lookup (Required Workflow)

Before creating or modifying any file, check if matching instruction files exist:

1. Scan `.github/instructions/` for files with `applyTo` patterns that match your file path
2. Read **all** matching instruction files completely before writing code
@mdaigle mdaigle force-pushed the dev/mdaigle/pool-channel-rate-limiting branch from 806140e to d3e2fe7 Compare July 13, 2026 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To triage

Development

Successfully merging this pull request may close these issues.

2 participants