Skip to content

fix: deflake hooks-ordering contract test#563

Draft
beekld wants to merge 2 commits into
mainfrom
bklimt/contract-test-hook-callback-order
Draft

fix: deflake hooks-ordering contract test#563
beekld wants to merge 2 commits into
mainfrom
bklimt/contract-test-hook-callback-order

Conversation

@beekld

@beekld beekld commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes flaky contract tests hooks/evaluation/executes beforeEvaluation hooks in registration order and the corresponding afterEvaluation reverse-order test, which had been intermittently red on CI.

Root cause: ContractTestHook::PostCallback was firing the harness notifications as fire-and-forget async chains (resolve -> connect -> write). The SDK invokes hooks sequentially, but the three async POSTs then race on the wire, so the harness can receive them in any order.

Fix: send each callback synchronously via the boost::beast sync HTTP API. The sync path uses blocking syscalls rather than the reactor, so there is no deadlock on the single-thread io_context, and each POST completes before the next hook's call starts.

Local repro on macOS over loopback: 2/50 fails before, 0/100 after.

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