Repository navigation
Native transactions: no JSON decode for a status the caller does not read - #226
Conversation
…read begin(), commit(), rollback() and is_transaction_active() decoded the whole arcadedb_n_tx reply with json.loads and went through five Python frames. Success (and the active bool) is now read from the fixed prefix the image writes (ArcadeNative.txState); an error reply, a reply with another shape, and the callers that read depth or commits (the marks, run_in_transaction) still decode it. Crossings, error texts and results are unchanged. Closes #225 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Timed A/B (native wheel; arm A = main's CI native wheel, arm B = the same tree with only this PR's files, A/A control; laptop timed lane,
Clean pairs per figure: 12; every run passed its arm check, and the error-path differential (same values, states, error classes and texts on both arms) passed before the run. By the rule written before the run this is a SHIP: both gating transaction figures are below 0.90, the 10-record transaction is within its no-harm bar, and the control is flat. The merge waits for the end of the current batch of timed studies that pin main (merging now would move their pins); the PR leaves draft at that point. |
Closes #225
Python only, native build.
NativeDatabase.begin(),commit(),rollback()andis_transaction_active()no longer decode thearcadedb_n_txreply withjson.loads. Success, and theactivebool, are read from the fixed prefix thatArcadeNative.txStatewrites ({"ok":true,"active":true,...). The JSON is still decoded for an error reply (so theArcadeDBErrortext,.nativeand.java_chainare the same), for a reply with any other shape, and for the callers that readdepthorcommits(_transaction_stack_mark,_begin_state,_rollback_state, the unwind inrun_in_transaction).begin()androllback()also skip two wrapper frames (_begin_stateand_tx/_call): five frames before, three now.What is not changed: the crossings (the existing counts in
tests/test_native_tx_crossings.pyare untouched andlib.callis still the one door), the Java side, the JVM build.New tests in
tests/test_native_tx_crossings.py(native-only file, runs in the native parity run) countjson.loadsper operation.test_begin_commit_rollback_decode_nothing,test_is_transaction_active_decodes_nothing_and_reports_the_stateandtest_with_transaction_decodes_only_the_markare the ones that prove the cut: on main's code they count 4, 5 and 3 decodes and fail (to be shown by the CI run on main, not run locally).test_a_state_reply_still_carries_depth_and_commits,test_an_error_reply_is_decoded_into_the_same_errorandtest_a_differently_spaced_ok_reply_is_still_readpin what must stay the same and pass on both.Verification: not run locally (a timed study holds the laptop); the CI runs below are the evidence. Static checks done:
compile, pyflakes (only the existing availability-probe imports),bandit==1.9.4oversrcandtestsfiles touched, pre-commit (black, isort).Speed: the numbers in #225 are an untimed discovery pass, directions only. A timed one-library A/B (
begin+commit, emptywith db.transaction(), a 10-row insert transaction, control: a non-transactional query) is pre-registered and runs on the laptop timed lane before merge, so this stays a draft until its verdict. A further cut (fusing mark and begin, or a packed return value from a new entry) would need a Java change and is not part of this PR.🤖 Generated with Claude Code