Skip to content

fix(go): add init-time FFI struct size assertions#231

Merged
userFRM merged 1 commit into
mainfrom
fix/sdk-version-and-safety
Apr 10, 2026
Merged

fix(go): add init-time FFI struct size assertions#231
userFRM merged 1 commit into
mainfrom
fix/sdk-version-and-safety

Conversation

@userFRM
Copy link
Copy Markdown
Owner

@userFRM userFRM commented Apr 10, 2026

Summary

Add init() function that panics if any Go tick struct size diverges from the expected Rust repr(C, align(64)) layout. Covers all 12 mirrored structs.

Without this, a Rust-side layout change silently corrupts all Go tick data (wrong numbers, not a crash — hard to diagnose).

Fixes #218

Test plan

  • go build ./... compiles
  • go test ./... passes (init() assertions pass with current layout)
  • Intentionally break a padding field → verify panic at init

🤖 Generated with Claude Code

Panic at package init if any Go tick struct size diverges from the
expected Rust repr(C, align(64)) layout. Covers all 12 mirrored structs:
cEodTick, cOhlcTick, cTradeTick, cQuoteTick, cOpenInterestTick,
cCalendarDay, cInterestRateTick, cIvTick, cPriceTick, cMarketValueTick,
cGreeksTick, cTradeQuoteTick.

Without this, a Rust-side layout change silently corrupts all Go tick
data (wrong numbers, not a crash).

Fixes #218

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@userFRM userFRM merged commit 16297fc into main Apr 10, 2026
20 checks passed
@userFRM userFRM deleted the fix/sdk-version-and-safety branch April 10, 2026 08:24
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.

fix(ffi): Go cEodTick padding has no compile-time size assertion

1 participant