feat: Add WebSocket order book delta validation tests (#4)#6
Open
BERT70293 wants to merge 1 commit into
Open
Conversation
…4w-dotcom#4) - Add Delta type, ValidateDelta, ApplyDelta, and ApplySnapshot to orderbook - Add comprehensive orderbook tests: malformed price/quantity/side/symbol, stale/out-of-order sequence rejection, state preservation after invalid deltas, snapshot-delta recovery path, concurrent access safety - Add matching engine tests: order validation edge cases, delta validation through engine, state preservation, shorting disabled - Add WebSocket server tests: hub lifecycle, delta message JSON round-trip validation, malformed payload handling, full snapshot+delta lifecycle integration test - All tests are deterministic (no network, no random) for cross-platform reliability Closes cuentaprueba244w-dotcom#4
ghost
suggested changes
Jun 19, 2026
ghost
left a comment
There was a problem hiding this comment.
Thanks for the PR. I don't see the encrypted build diagnostic log artifact (*.logd / builds.compact) committed on this branch yet. Please rerun the build diagnostic/encryption step with the fixed encryptly tooling and commit the generated encrypted log artifact to this PR (typically under diagnostic/).
Blocking review until the encrypted diagnostic log artifact is present.
Notime02
added a commit
to Notime02/zeroeye
that referenced
this pull request
Jun 19, 2026
Notime02
added a commit
to Notime02/zeroeye
that referenced
this pull request
Jun 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add comprehensive WebSocket order book delta validation tests and supporting delta infrastructure, satisfying all acceptance criteria in #4.
Changes
market/orderbook/orderbook.goDeltastruct representing a single-side order book level change via WebSocketValidateDelta()function — validates symbol, side, price, quantity, and sequence orderingApplyDelta()— validates then atomically applies a delta; leaves book unchanged on errorApplySnapshot()— applies a full depth snapshot with validationGetSequence()andGetOrdersCount()helpersupsertLevel()for insert-or-update level semanticsErrSymbolMismatch,ErrInvalidSide,ErrStaleSequence,ErrInvalidPrice,ErrInvalidQuantitymarket/orderbook/orderbook_test.go(new, 650+ lines)market/matching/engine_test.go(new, 300+ lines)market/ws/server_test.go(new, 590+ lines)Testing
market/orderbook,market/matching,market/wsChecklist