Repository navigation
Rerun the vector read-your-writes tests on the known engine race, at most twice and counted - #463
Merged
Merged
Conversation
…most twice and counted (refs #409) The four tests of tests/test_vector_read_your_writes.py fail intermittently on every platform and both builds because of the engine race that pull request 12087 of ArcadeData/arcadedb fixes (a graph rebuild trims a vector whose commit sits between its two phases). A red main on about every other run hides every other regression. I keep the tests detecting the race and stop it from turning main red: a test body runs again on a fresh database, at most twice, and only when it failed with one of the three messages of the race (`committed vectors were not found`, `Vector search failed`, `Record #... not found`). Any other failure is never retried and a body that fails all three runs fails. The mechanism is run_with_known_race_rerun in tests/conftest.py, used by a decorator in the test file, so it covers every job that runs the file: the parity harness on the native wheel and the plain runs of the JVM build. Each rerun is a UserWarning that names issue 409, and a pass after a rerun adds the junit property flaky_race (set on the node directly: the record_property fixture warns on every use with the junit family of the JVM jobs). The parity harness counts it as flaky_race=N in its TOTAL row, prints a warning line for each test and lists it in the metadata; report_flaky_crash.py adds a block to the job summary; the two gate programs of test-native.yml print a FLAKY-RACE line and never fail on it. The comment at the mechanism says when it goes: the engine release that contains that pull request and 100 consecutive scheduled runs of the file. The assertions of the tests and the engine are unchanged.
This was referenced Nov 23, 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.
Refs #409
The vector read-your-writes tests fail intermittently on every platform and both builds because of an engine race (a graph rebuild trims a vector whose commit sits between its two phases; the fix is pull request 12087 of ArcadeData/arcadedb, not in a release yet). A red
mainon about every other run (issue 451 is the red-main report for it) hides every other regression and blocks the release. This pull request keeps the tests detecting the race and stops it from turningmainred, by a bounded, visible, counted rerun. It is not a skip and not an xfail.The mechanism
run_with_known_race_rerunintests/conftest.pycalls the whole test body again, on a fresh database, at most 2 more times (3 runs), and only when the failure is one of the three signatures below. Any other failure is raised at once, and a body that fails all 3 runs fails (the exception of the last run, with a note naming #409). The number of reruns is a constant: no environment variable, option or marker raises it. Intests/test_vector_read_your_writes.pya decoratorknown_race_testgives each of the 4 tests its own corpus per run (tmp_path / read_your_writes_<n>, dropped after the run) and passes the body the same(db, index)thecorpusfixture used to give it. The assertions of the tests are unchanged.Why it is inside the tests and not in a harness: the file runs in two kinds of job. The parity harness runs it on the native wheel, one process per file. The JVM jobs run plain
python -m pytest tests/on Linux, macOS and Windows. A--retry-crashstyle option of the harness would leave the second kind red, and a plugin such aspytest-rerunfailureswould be a new dependency for the one file. One mechanism in the test code covers both and applies to that one file only (a test checks that no other test file uses it).The three signatures
The class is matched by name along its bases and the message by a pattern, so a text on the wrong class does not match.
N of M committed vectors were not found ...AssertionErrorVector search failedArcadeDBErrorfind_nearestwraps what the engine raised (src/arcadedb/vector.py)Record #<n>:<n> not foundArcadeDBErrorVector search failedcarries in the two logs belowAll three are the one race: a vector whose commit has returned is missing from the next search (the assertion), or the search returns an RID whose record is not readable yet (the load of the hit raises
RecordNotFoundException, whichfind_nearestwraps asVector search failed: ...). I read the logs of run 45044368506 (macOS, JVM wheel) and run 45088615472 (Windows, JVM wheel, Python 3.14): both end inArcadeDBError: Vector search failed: com.arcadedb.exception.RecordNotFoundException: Record #1:489 not foundand... Record #1:360 not found. I did not find a log of the native build with theRecordNotFoundExceptiontext, so the third pattern allows the message with or without theVector search failedprefix. The match is on text and class, not on the frame the exception came from.How a rerun shows
UserWarningper rerun that namesArcadeData/arcadedb-python#409, the run (run 1 of 3,rerun 1 of 2) and the first line of the failure. It is in the warnings summary of the test log on every job.flaky_race(its value is the number of reruns). I append it torequest.node.user_propertiesand do not use therecord_propertyfixture: that fixture emits aPytestWarningon every use under the defaultjunit_familyof the JVM jobs, so it would warn on runs without any rerun.native/wheel/parity_wheel.py) counts the tests with that property:flaky_race=Nat the end of the status column of theTOTALrow (the 11 columns are unchanged), a::warning::line per test in the run log, andrace_eventsinparity-wheel.meta.json.report_flaky_crash.pyadds a block "Known engine race reruns" to the job summary of thecrash-reportjob and posts nothing anywhere. The two gate programs oftest-native.ymlprint aFLAKY-RACEline and never fail on it (the edit is one capture and one print line in each program, the same in both). The JVM jobs have no counter beyond the warning and the junit property: I did not touchtest-jvm.yml.When it goes
The
REMOVE WHENcomment at the mechanism: the engine release that contains the upstream fix is merged and released, andtests/test_vector_read_your_writes.pyhas passed 100 consecutive scheduled runs. Then the block, its use,tests/test_known_engine_race_rerun.py, the counter and the paragraph inci.adocare deleted and #409 is closed.Not changed
The assertions of the tests, the engine,
src/, the Java ofnative/, the release files andtest-jvm.yml.CONTRIBUTING.mdis not touched; the policy is written once, indocs/modules/ROOT/pages/development/ci.adoc.Tests
tests/test_known_engine_race_rerun.pyhas plain functions on fake bodies (no engine, no database): a pass is called once; a failure with a signature and then a pass is a pass with one warning and the count; two failures and a pass give two warnings; three failures fail; other messages and the right message on the wrong class are called once; only the three signatures match; no environment variable raises the number of reruns; only the one file uses the mechanism and all 4 of its tests do; each run gets a new database and every database is dropped (a fake database); the harness counts the property and not a failed test; a real junit record from a child process carries the property in both families; theTOTALline and the job summary. The tests of the gate programs withflaky_race=0andflaky_race=2are intests/test_parity_gate_awk.py, the file that already runs those programs and is not collected on Windows. The three exactTOTALstatus strings oftests/test_parity_crash_retry.pynow end inflaky_race=0.Checks I ran
The repository's test runner was not run for this change; CI runs it. The full tier has not run on this change: the pull request runs the fast tier only.
compile(source, name, "exec")on the 7 changed Python filesuv run --with pyflakes python -m pyflakeson the same filesuvx pre-commit run --fileson the 8 changed files other than the docs page (black 26.10.1, isort, ruff 0.17.4, actionlint, whitespace and YAML hooks)uvx bandit==1.9.4 -c pyproject.toml -r src tests --severity-level low --confidence-level lowawk