Skip to content

feat: goffi v0.6.0 — ADR-049 three-tier FFI error handling#249

Merged
kolkov merged 1 commit into
mainfrom
feat/goffi-v060-migration
Jul 12, 2026
Merged

feat: goffi v0.6.0 — ADR-049 three-tier FFI error handling#249
kolkov merged 1 commit into
mainfrom
feat/goffi-v060-migration

Conversation

@kolkov

@kolkov kolkov commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Bump goffi v0.5.6 → v0.6.0 (CallFunction returns (syscall.Errno, error))
  • Migrate all 764 FFI call sites (19 files) to three-tier error handling per ADR-049
  • Tier 1 (creation/submit): _, err := — check FFI error + API result (322 calls)
  • Tier 2 (void/hot path): _, _ = — infallible by GPU API contract (475 calls)
  • Tier 3 (platform syscalls): errno, _ := — capture errno for diagnostics (5 Wayland calls)
  • Wayland wl_display_flush / wl_display_roundtrip_queue: EAGAIN vs EPIPE (Qt6/SDL3 pattern)
  • Fix vk-gen: output path ../../hal/, add //go:build !(js && wasm) to template
  • Remove stale cmd/hal/ artifact from wrong generator path

Enterprise references

  • Rust wgpu-hal: () for all draw/destroy/barrier (infallible by spec)
  • Qt6 qwaylanddisplay.cpp: errno check after wl_display_flush
  • SDL3 SDL_waylandevents.c: same pattern
  • Deep research: FFI-ERROR-HANDLING-ENTERPRISE-RESEARCH.md, FFI-ERRNO-USEFULNESS-ANALYSIS.md

Test plan

  • go build ./... — Windows, Linux, macOS
  • go test ./... — 15/15 packages pass
  • golangci-lint run — 0 issues
  • vk-gen idempotent (regeneration = 0 diff)
  • 0 old-style _ = ffi.CallFunction remaining

@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…(v0.30.17)

Migrate all 764 ffi.CallFunction call sites (19 files) to handle
goffi v0.6.0 (syscall.Errno, error) return signature.

Three-tier error handling per ADR-049:
- Tier 1 (creation/submit): check FFI error + API result (322 calls)
- Tier 2 (void/hot path): infallible by GPU API contract (475 calls)
- Tier 3 (platform syscalls): errno for diagnostics (5 Wayland calls)

Wayland blit: wl_display_flush and wl_display_roundtrip_queue now capture
errno — EAGAIN (compositor backpressure) vs EPIPE (compositor dead).
Qt6/SDL3/GTK4 reference pattern.

Fix vk-gen: output path, build tag, auto-gofmt via go/format.
Remove stale cmd/hal/ artifact.
@kolkov kolkov force-pushed the feat/goffi-v060-migration branch from eda98d4 to c55b970 Compare July 12, 2026 07:41
@kolkov kolkov merged commit f757020 into main Jul 12, 2026
11 checks passed
@kolkov kolkov deleted the feat/goffi-v060-migration branch July 12, 2026 07:45
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