Repository navigation
Replay upstream state_machine_tests.zig scenarios against the OCaml core - #8
Open
devin-ai-integration[bot] wants to merge 2 commits into
Open
devin-ai-integration[bot] wants to merge 2 commits into
devin-ai-integration[bot] wants to merge 2 commits into
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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
Adds the first automated OCaml-vs-TigerBeetle comparison (follow-up to closing #7).
ocam/test/zig_corpus.mlparses everycheck(...)table in the retainedocam/src/state_machine_tests.zig(byte-identical to the pinned upstream copy) and runs it againstState_machine. It mirrorscheck_versionin the Zig file:testing/table.zig(_= default, leading letter ignored,-n=maxInt - n);existsechoing the original or rolled-back timestamp, pending-id fill-ins);prepare/pulseclock, withbatch_max.create_transfers = 30from thetest_minconfig.Status codes are read from
src/tigerbeetle.zigat runtime and matched againstResult_code.*_codes, so coarse OCaml statuses still count as matches.The report is diffed against
test/zig_corpus.expectedondune runtest. Parity progress and regressions therefore show up as a diff, anddune promoteaccepts an intended change. Current baseline:The failures point at two real divergences:
timestamp = 0. Upstream returns the event's commit timestamp for every non-existsresult, includinglinked_event_failed. In OCaml this comes fromerror status = { timestamp = 0L; ... }instate_machine.ml. This causes almost all of the failures.imported events: imported batch. OCaml rejects an imported transfer withimported_event_timestamp_must_not_regressbecause it checks against the globalcommit_timestamp. Zig checks against the transfers groove'skey_max, i.e. per object type.A SKIP means the scenario uses something the OCaml types can't express yet: CDC (
get_change_events), reserved/padding bits, or statuses with no OCaml equivalent (exists_with_different_user_data_128,imported_event_timestamp_must_postdate_debit_account).Supporting changes:
State_machine.unsafe_replace_account_for_testingimplements the harness'ssetupaction, which overwrites balances directly.testsstanza now listsmodulesexplicitly so the corpus runner stays a separate executable.Checked locally on OCaml 5.2.1 with ocamlformat 0.26.2:
dune build,dune build @fmt,dune runtestandopam lintall pass.Link to Devin session: https://app.devin.ai/sessions/1ffda120da2640bc8996571fcff0a87c
Open in Devin Desktop: https://app.devin.ai/desktop/session/1ffda120da2640bc8996571fcff0a87c?variant=devin
Requested by: @gpu004