Repository navigation
feat!: stop application code at the library boundary, Close from callbacks, options for the API floors and Logix bounds (v0.8.0) - #30
Merged
Conversation
…backs, options for the API floors and Logix bounds (v0.8.0) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TestIOMetricsDoNotReturnNormally read Stats once the peer had received the second datagram, but produce counts a datagram in Stats after the send and before OnIOSent, so the peer can receive it first. The test now waits for both OnIOSent calls, which follow the count. The same pattern, found by running the new callbacks and lifecycle tests with -race -count=200 -cpu 1,2,4: - server TestMetricsDoNotReturnNormally: OnDisconnect is counted before its failure is logged. The test now waits until the session goroutine has ended, after its last hook was called and logged. - implicit TestCloseWaitsForCallback, "Endpoint.Close from OnData waits for Produce": the datagram that calls OnData follows Open only through UDP, which the race detector does not see. OnData now waits until the test has seen Open return. Test changes only; no change to the library. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
The reply delay is drawn at random up to 1 ms, and a draw of zero is answered at once, outside the bound the test checks: one run in about 1000 failed (Race, Go 1.27). The test now sets the generator so that its requests draw a delay. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
A minor release on v0.7.1. No exported identifier is removed or changed; the behaviour change is under Breaking, and RELEASE.md has the details.
Breaking:
Produce,OnData,OnTimeout,OnInput,OnState, the client's state handler, metrics hooks) that does not return normally is stopped at the library's boundary and logged at Error level ("application code did not return normally", withcallback,valueandstack); the process keeps running. The server answers the request of such a handler with general status 0x10 (device state conflict), within a Multiple Service Packet that service only, and refuses with 0x10 a Forward_Open whose configuration data'sOnWritedoes not return normally. AProducecall sends nothing at that interval; afterOnData,OnInputor an I/OOnWritethe endpoint goes on; state changes stand; a metrics hook changes nothing the library sends or answers.Fixes:
Closecalled from a callback that runs on a goroutine it waits for returns:Connection.CloseandEndpoint.ClosefromProduce,Endpoint.ClosefromOnData,Scanner.Close(with its own endpoint) fromOnInput,Server.Closefrom a request's handler. In v0.7.1 these calls did not return. Such aClosedoes not wait for its own goroutine, which ends when the callback returns, and waits for every other one; aCloseon another goroutine waits for a callback in progress as before. The goroutines that run these callbacks record their identifier when they start (internal/goid), read once per goroutine and once perClose.Additions:
IOConfig.OTAPIDivisorandIOConfig.MinOTAPIlower, raise or disable the two floors on the O->T actual packet interval; the defaults (4, and 100 µs) are v0.7.1's.WithMaxTagListReplies,WithMaxTagListDataandWithMaxTemplateRepliesset the bounds ofListTagsandTemplate; the defaults (65536 replies, 16 MiB, 65536 replies) are v0.7.1's.Tests: one test per call site (
callbacks_test.goin server, implicit, scanner and client; logix and internal/callback); row L10 of the lifecycle matrix for the fourClosecases; tests that aCloseon another goroutine, or from a callback for the other goroutines, waits for a callback in progress (TestCloseWaitsForCallback,TestScannerCloseWaitsForOnInput,TestCloseWaitsForHandler, withtestenv.Blocking); boundary tables for the new fields and options, with the defaults asserted unchanged. client: the context side of a failed write inConn.do, and a failed write whose request is no longer the pending one, are covered deterministically (the Codecov gap of #29). Every line this release adds or changes is covered; total coverage 99.1 %.BenchmarkConsumeis unchanged within the noise.Documentation: API.md, ARCHITECTURE.md, ERRORS.md, OBSERVABILITY.md, SECURITY.md, TESTING.md (L10 row, the call-site tests, the benchmark figure), docs/LIMITATIONS.md, docs/IMPLICIT.md, docs/LOGIX.md, docs/OBJECTS.md, docs/api. CI's coverpkg list includes internal/callback and internal/goid.
Checks:
make checkpasses; otfabric-policy compliant; gorelease against v0.7.1: v0.8.0 valid, compatible additions only.Checked independently:
make checkpasses, otfabric-policy compliant, linux/386 passes in all 19 packages, the L10 tests fail on v0.7.1's code (Close from a handler does not return there), and e2e/io_test.go is unchanged from v0.7.1.Covers the lines of #29 that Codecov reported as not covered (client/connection.go lines 302–303).
🤖 Generated with Claude Code