Journal-based linked chains, timestamp indexes, U128/result codes, module split, CI and repo hygiene - #6
Open
devin-ai-integration[bot] wants to merge 4 commits into
Conversation
…dule split, CI and repo hygiene
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| Secrets | Sep 25, 2026 6:52a.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
…verage on upstream OCaml since bisect_ppx does not build on OxCaml
…ld on the OxCaml overlay
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
Implements the review items 4–17 from the repo improvement pass (perf, code quality, CI, hygiene). Items 1–3 (Zig differential harness, 128-byte wire codecs, C-ABI adapter) are not in this PR;
Result_codeis the first step toward them.Core (
ocam/src)state_machine.mlis split intoU128,Types,Result_code,Timeline,Ledger,State_machine. The publicState_machineinterface is unchanged apart from additions (module U128,module Result_code; record types are re-exported astype account = Types.account = {...}).Ledger.transactrecords undo closures for each mutation while a chain runs; a failed/open chain replays them in reverse. Rollback cost is proportional to the chain, not the ledger.Timelineis an append-only array of strictly increasing(timestamp, value)pairs with binary-searched inclusive range reads (to_seq_in_range ~minimum ~maximum ~reversed).Ledger.tkeepsaccounts_by_timestamp,transfers_by_timestamp, per-accountaccount_transfers/account_history, and apending_by_expirymap, soquery_accounts/query_transfers/get_account_transfers/get_account_balances/expire_pending_transfersno longer scan+sort every stored object. Commit-order timestamps are now a documented precondition (Timeline.appendraises on non-increasing timestamps).U128completed:mul,div_rem, shifts,of_string(_opt),to_hex_string, int/int64 conversions;to_stringis now always decimal; add/sub/mul returnErroron overflow/underflow instead of wrapping.Result_code: numericaccount_to_code/transfer_to_code/*_of_codematching the pinnedstate_machine.zigenum values (created_code = 0xffff_ffff). Where the OCaml variant is coarser than upstream,*_codesreturns the set of upstream codes and*_to_codereturnsNone.basedependency; the core is Stdlib-only.Tests / bench
u128_test,result_code_test,timeline_test(unit + QCheck), plustest_failed_chain_leaves_no_index_entriesasserting rollback restores tables, indexes, history, expiry, and commit timestamp.CI / hygiene / docs
setup-ocaml@v3withdune-cache,opam lint,dune build @fmt; coverage workflow enforces a 75% minimum (measured: 79.3%).trunksince the OxCaml migration because the unpinned OxCaml opam overlay moved on:oxcaml-compiler.5.2.0minus31can no longer installodoc,ocamlformat.0.26.2+ox1conflicts, andbisect_ppxnever built against OxCaml's patchedppxlib. The OxCaml job now uses5.2.0minus39+ocamlformat.0.26.2+ox2; docs and coverage run in the upstream-OCaml 5.2 job (the core is Stdlib-only, so the numbers are identical).bisect_ppxis no longer a declared package dependency.zoom-out.*, copiedocam/.github/*TigerBeetle workflows,.deepsource.toml.CONTRIBUTING.md(incl.jjsetup), rootLICENSE(Apache-2.0), package metadata indune-project; updated README,doc/,OCAML_REWRITE.md,BENCHMARK_COMPARISON.md.state_machine_property_test.mlchanges are formatter-only (dune fmt), needed now that CI enforces formatting.Verification
Locally on a standard OCaml 5.2.1 switch (the OxCaml compiler fails to build on my machine with
cp: ... are the same fileinMakefile.common-ox:234):dune build,dune build @doc,dune runtest,dune build @bench(+ ran the bench),dune build @fmt,opam lint, Bisect coverage 79.3%.On CI: the OxCaml
checksjob (build, tests, bench, fmt, lint) and the upstream-OCamlcoveragejob (docs + coverage) both pass.Link to Devin session: https://app.devin.ai/sessions/c6013392416c4513bc299ebd01acd9ff
Open in Devin Desktop: https://app.devin.ai/desktop/session/c6013392416c4513bc299ebd01acd9ff?variant=devin
Requested by: @gpu004