Skip to content

Align SubscribeConfig chan size contract#1272

Open
peter941221 wants to merge 4 commits into
riverqueue:masterfrom
peter941221:peter/subscribe-config-contract
Open

Align SubscribeConfig chan size contract#1272
peter941221 wants to merge 4 commits into
riverqueue:masterfrom
peter941221:peter/subscribe-config-contract

Conversation

@peter941221
Copy link
Copy Markdown
Contributor

  1. Failure mechanism

SubscribeConfig.ChanSize already treats 0 as "use the default buffer size", but the surrounding contract drifted away from that behavior. The public comment did not say that zero selects the default, it still had a wording typo, and the panic string still claimed the value had to be greater or equal to 1.

  1. Semantic change

This aligns the public comment, panic string, and tests with the existing zero-as-default behavior.

It also fixes the comment typo from overall to overflow.

  1. Why this design

The runtime behavior was already right. This patch only makes the boundary conditions easier to understand and harder to misread in tests or review.

  1. Testing

  2. Added Test_SubscriptionManager/PanicOnNegativeChanSize.

  3. Added Test_SubscriptionManager/UsesDefaultChanSizeWhenZero.

  4. Ran go test . -run "Test_SubscriptionManager/(PanicOnNegativeChanSize|UsesDefaultChanSizeWhenZero)" -count=1.

  5. Ran go test . -run TestDoesNotExist -count=1 as a compile/load smoke check.

@peter941221 peter941221 marked this pull request as ready for review June 3, 2026 11:54
Comment thread client.go Outdated
Comment thread subscription_manager.go Outdated
@peter941221
Copy link
Copy Markdown
Contributor Author

Reverted both wording changes and kept the zero-default behavior test coverage.

Comment thread client_test.go Outdated
@brandur
Copy link
Copy Markdown
Contributor

brandur commented Jun 3, 2026

Ah doh, looks like this conflicted with your other change. Want to rebase?

@peter941221 peter941221 force-pushed the peter/subscribe-config-contract branch from 35ccbed to aec2483 Compare June 3, 2026 13:21
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.

2 participants