Skip to content

bind: document lock-held formatting callbacks#150

Merged
linkdata merged 4 commits into
mainfrom
fix/136-binder-format-unlock
Jul 19, 2026
Merged

bind: document lock-held formatting callbacks#150
linkdata merged 4 commits into
mainfrom
fix/136-binder-format-unlock

Conversation

@linkdata

@linkdata linkdata commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Summary

  • document that Binder HTML formatting callbacks run while the supplied lock is held
  • add deterministic contract coverage for bind.Formatter, fmt.Formatter, and formatted and default fmt.Stringer paths
  • leave the existing Binder lock scope and runtime behavior unchanged

Rationale

Holding the lock preserves one synchronized view throughout value retrieval and formatting. Unlocking after a shallow value copy would allow referenced state to change before or during formatting, introducing a TOCTOU window. Formatting callbacks therefore operate on already-locked state.

Verification

  • go generate ./...
  • go vet ./...
  • gofmt -l .
  • staticcheck ./...
  • golangci-lint run
  • gosec -quiet ./...
  • JAWS_REQUIRE_NODE=1 go test -race ./...
  • go build ./...
  • Linux/386 bind and jawstree test packages cross-compiled locally
  • go doc ./lib/bind Binder
  • go doc ./lib/bind Binder.Format
  • go doc ./lib/bind Formatter

Fixes #136

@linkdata linkdata changed the title bind: invoke formatting callbacks outside Binder lock bind: document lock-held formatting callbacks Jul 19, 2026
@linkdata
linkdata merged commit a34e702 into main Jul 19, 2026
7 checks passed
@linkdata
linkdata deleted the fix/136-binder-format-unlock branch July 20, 2026 15:06
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.

bind: Formatter and Stringer callbacks run under Binder lock and can deadlock

1 participant