Skip to content

feat!: stop application code at the library boundary, Close from callbacks, options for the API floors and Logix bounds (v0.8.0) - #30

Merged
boeboe merged 3 commits into
mainfrom
feat/policy-1.6-minor
Nov 14, 2026
Merged

boeboe merged 3 commits into
mainfrom
feat/policy-1.6-minor

Conversation

@boeboe

@boeboe boeboe commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

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:

  • Application code the library calls (request handlers, 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", with callback, value and stack); 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's OnWrite does not return normally. A Produce call sends nothing at that interval; after OnData, OnInput or an I/O OnWrite the endpoint goes on; state changes stand; a metrics hook changes nothing the library sends or answers.

Fixes:

  • Close called from a callback that runs on a goroutine it waits for returns: Connection.Close and Endpoint.Close from Produce, Endpoint.Close from OnData, Scanner.Close (with its own endpoint) from OnInput, Server.Close from a request's handler. In v0.7.1 these calls did not return. Such a Close does not wait for its own goroutine, which ends when the callback returns, and waits for every other one; a Close on 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 per Close.

Additions:

  • scanner: IOConfig.OTAPIDivisor and IOConfig.MinOTAPI lower, raise or disable the two floors on the O->T actual packet interval; the defaults (4, and 100 µs) are v0.7.1's.
  • logix: WithMaxTagListReplies, WithMaxTagListData and WithMaxTemplateReplies set the bounds of ListTags and Template; the defaults (65536 replies, 16 MiB, 65536 replies) are v0.7.1's.

Tests: one test per call site (callbacks_test.go in server, implicit, scanner and client; logix and internal/callback); row L10 of the lifecycle matrix for the four Close cases; tests that a Close on another goroutine, or from a callback for the other goroutines, waits for a callback in progress (TestCloseWaitsForCallback, TestScannerCloseWaitsForOnInput, TestCloseWaitsForHandler, with testenv.Blocking); boundary tables for the new fields and options, with the defaults asserted unchanged. client: the context side of a failed write in Conn.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 %. BenchmarkConsume is 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 check passes; otfabric-policy compliant; gorelease against v0.7.1: v0.8.0 valid, compatible additions only.

Checked independently: make check passes, 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

boeboe and others added 2 commits November 14, 2026 16:18
…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

codecov Bot commented Nov 14, 2026

Copy link
Copy Markdown

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>
@boeboe
boeboe merged commit 29d5bd2 into main Nov 14, 2026
26 checks passed
@boeboe
boeboe deleted the feat/policy-1.6-minor branch November 14, 2026 16: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.

1 participant