From 0a693644a77bd7c70c7e0ab71b4f78d46b5ae742 Mon Sep 17 00:00:00 2001 From: Taewoon Kim Date: Mon, 23 Nov 2026 14:20:37 +0900 Subject: [PATCH] Rerun the vector read-your-writes tests on the known engine race, at 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. --- .github/workflows/test-native.yml | 8 +- docs/modules/ROOT/pages/development/ci.adoc | 1 + native/wheel/parity_wheel.py | 54 ++- native/wheel/report_flaky_crash.py | 69 ++- tests/conftest.py | 77 ++++ tests/test_known_engine_race_rerun.py | 459 ++++++++++++++++++++ tests/test_parity_crash_retry.py | 6 +- tests/test_parity_gate_awk.py | 78 ++++ tests/test_vector_read_your_writes.py | 60 ++- 9 files changed, 787 insertions(+), 25 deletions(-) create mode 100644 tests/test_known_engine_race_rerun.py diff --git a/.github/workflows/test-native.yml b/.github/workflows/test-native.yml index f25bf6da..98b21544 100644 --- a/.github/workflows/test-native.yml +++ b/.github/workflows/test-native.yml @@ -688,7 +688,7 @@ jobs: # the pyver job has a copy of this awk: keep the two in sync awk -F'\t' ' NR == 1 { next } - $1 == "TOTAL" { passed = $2; failed = $3; err = $4; notyet = $5; na = $6; skipped = $7; tot = 1; next } + $1 == "TOTAL" { passed = $2; failed = $3; err = $4; notyet = $5; na = $6; skipped = $7; tot = 1; if (match($8, /flaky_race=[0-9]+/)) race = substr($8, RSTART + 11, RLENGTH - 11); next } $8 ~ /^FLAKY-CRASH/ { flaky = flaky " " $1 "(" $8 ")"; next } $8 != "" { bad = bad " " $1 "(" $8 ")" } END { @@ -696,6 +696,8 @@ jobs: printf "parity %s py%s: passed=%s failed=%s error=%s notyet=%s na_jvm=%s skipped=%s\n", ENVIRON["KEY"], ENVIRON["PY"], passed, failed, err, notyet, na, skipped # a file that crashed and passed when run once more: the leg may pass, the summary says it did only because of the retry if (flaky != "") printf "FLAKY-CRASH (died without a result, passed on the one retry; first exit code in brackets):%s\n", flaky + # tests that passed only after the rerun of the known engine race (issue 409): printed, never a failure + if (race + 0 != 0) printf "FLAKY-RACE (tests that passed only after a rerun of the known engine race of ArcadeData/arcadedb-python#409): %s\n", race if (bad != "") { print "files with a status:" bad > "/dev/stderr"; exit 1 } if (passed + 0 == 0 || failed + 0 != 0 || err + 0 != 0) exit 1 # this repository accepts no skips; NOTYET and NA-JVM are the two counted kinds of the native build @@ -1102,7 +1104,7 @@ jobs: # the same awk as the gate of the test job: keep the two in sync awk -F'\t' ' NR == 1 { next } - $1 == "TOTAL" { passed = $2; failed = $3; err = $4; notyet = $5; na = $6; skipped = $7; tot = 1; next } + $1 == "TOTAL" { passed = $2; failed = $3; err = $4; notyet = $5; na = $6; skipped = $7; tot = 1; if (match($8, /flaky_race=[0-9]+/)) race = substr($8, RSTART + 11, RLENGTH - 11); next } $8 ~ /^FLAKY-CRASH/ { flaky = flaky " " $1 "(" $8 ")"; next } $8 != "" { bad = bad " " $1 "(" $8 ")" } END { @@ -1110,6 +1112,8 @@ jobs: printf "parity %s py%s: passed=%s failed=%s error=%s notyet=%s na_jvm=%s skipped=%s\n", ENVIRON["KEY"], ENVIRON["PY"], passed, failed, err, notyet, na, skipped # a file that crashed and passed when run once more: the leg may pass, the summary says it did only because of the retry if (flaky != "") printf "FLAKY-CRASH (died without a result, passed on the one retry; first exit code in brackets):%s\n", flaky + # tests that passed only after the rerun of the known engine race (issue 409): printed, never a failure + if (race + 0 != 0) printf "FLAKY-RACE (tests that passed only after a rerun of the known engine race of ArcadeData/arcadedb-python#409): %s\n", race if (bad != "") { print "files with a status:" bad > "/dev/stderr"; exit 1 } if (passed + 0 == 0 || failed + 0 != 0 || err + 0 != 0) exit 1 # this repository accepts no skips; NOTYET and NA-JVM are the two counted kinds of the native build diff --git a/docs/modules/ROOT/pages/development/ci.adoc b/docs/modules/ROOT/pages/development/ci.adoc index 4d54ad88..1f869fcb 100644 --- a/docs/modules/ROOT/pages/development/ci.adoc +++ b/docs/modules/ROOT/pages/development/ci.adoc @@ -124,6 +124,7 @@ The workflow `test-native.yml` builds the native image of the `arcadedb` package * A push to `main` (only when a native path changed, same filter as a pull request), the nightly run (skipped when nothing changed in the last 25 hours, except on Mondays) and a manual run (dispatch) run all four platforms: `linux-x86_64`, `linux-aarch64`, `macos-arm64` and `windows-x64` (Python 3.12 and 3.14). A release (`release-native.yml` calls the workflow with `release: true`) runs the same four platforms on all four Python versions, 16 legs. * The `pyver` job installs the already built `linux-x86_64` wheel (no rebuild) into the Pythons that the full parity runs of the event leave out (3.11 and 3.13 on a push to `main`, the nightly run and a dispatch; none on a release) into 3.15 and into the free-threaded 3.14t, and runs 13 test files there (14 where polars installs; 3.15 has no jpype1 wheel, so it leaves out the two files that need jpype1), about 20 seconds of tests per Python. A release needs it: a `pyver` leg that passes uploads the marker `native-passed-pyver-py` (it holds the file name of the wheel the leg installed), and `Verify what may be published` in `release-native.yml` requires the markers of 3.15 and 3.14t, the two legs of a release, and that both tested the `linux-x86_64` wheel that is published. A red leg stops a release before anything reaches PyPI. A pull request runs only two legs of this job, Python 3.11 and 3.14 (the oldest and the newest): 3.13, 3.15 and 3.14t run in the full tier. In the 30 days before issue 442 no `pyver` leg was red on a commit where the parity suite on Linux x86-64 was green. Only `linux-x86_64` is checked on these two Pythons: the other platforms are not tested on 3.15 and 3.14t, and the JVM package has no such job. The 3.14t leg has no polars (no free-threaded wheel exists), so it skips `test_dataframe_ingest.py`. `scripts/select_native_matrix.py` decides its legs, and `tests/test_select_native_matrix.py` and `tests/test_release_native_verify.py` pin the gate. * Every test file runs in its own process (`native/wheel/parity_wheel.py`). A process that dies without writing its result is a `CRASH` row in `parity-wheel.tsv` with its exit code, for example `CRASH(rc=0xC0000005,3221225477)`, and it fails the leg. On the Windows legs only (the crashes of issue 295 happen there), the harness runs such a file once more in a fresh process (`--retry-crash`). A retry that produces a result is a `FLAKY-CRASH` row: the gate lets the leg pass, the job summary lists the file with the first exit code, and on a release or a dispatch the `crash-report` job adds one comment to issue 295 (run URL, Python, wheel version, exit codes). A second crash, a failing test, a timeout and every crash on Linux or macOS stay failures. A process that wrote its result and then died in shutdown is a `DIRTY-EXIT` record (exit code, file, attempt) in the metadata, the job summary and the issue comment: it is not retried and does not fail the leg. Each Windows test process also writes a faulthandler trace, `parity-wheel-xml/.attemptN.fault.txt`, into the parity artifact of the leg. Only a retry hides a crash, so treat a `FLAKY-CRASH` as an open bug: read the trace in the artifact before a release is announced. +* The four tests of `tests/test_vector_read_your_writes.py` run again when they hit a known engine race, on both packages (issue 409). The engine of 26.11.1 can miss a vector that a commit has just returned: a graph rebuild trims it between the two phases of its commit. The fix is pull request 12087 of ArcadeData/arcadedb, which is in no release yet, and the test must keep detecting the race, so it is not skipped. The rerun is in the tests (`run_with_known_race_rerun` in `tests/conftest.py`), not in a workflow, so every job that runs the file has it: the parity harness and the plain runs of the JVM build. 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, and a test that fails all three runs, fails the job. Each rerun is a `UserWarning` that names issue 409 in the warnings summary of the log. A test that passed only after a rerun carries the junit property `flaky_race`: the `TOTAL` row of `parity-wheel.tsv` counts it as `flaky_race=N`, the gate step prints a `FLAKY-RACE` line, and the `crash-report` job lists the tests in the job summary. A count never fails a leg. The rerun goes when the engine release that contains the fix is out and the file has passed 100 consecutive scheduled runs; then issue 409 is closed. * The `examples` job runs every script of `examples/` against the installed wheel of each platform (Python 3.12 and 3.14; a pull request: no leg, or `linux-x86_64` on Python 3.12 when it changes the examples or their runner) through `scripts/run_examples.sh`, the runner that `test-python-examples.yml` uses too. `scripts/native_examples_skip.txt` lists, with a reason, the examples that need the JVM package. `Examples summary` is the one check for all its legs. These legs do not decide what a release publishes. * A native image build takes about 5 to 30 minutes for each platform (macOS is the slowest). The organisation shares one runner limit with upstream ArcadeDB, so do not add runs lightly. Change the paths or the matrix of `test-native.yml` only for a reason that you can write down. diff --git a/native/wheel/parity_wheel.py b/native/wheel/parity_wheel.py index 3fe363c5..a68b758b 100644 --- a/native/wheel/parity_wheel.py +++ b/native/wheel/parity_wheel.py @@ -13,6 +13,8 @@ crash stays CRASH and fails the leg. A failing test, a TIMEOUT and a BADXML are never retried. The decision is native/wheel/parity_crash.py. On Windows each process also writes a faulthandler trace to .attemptN.fault.txt next to its XML (tests/conftest.py, ARCADEDB_TEST_FAULTHANDLER_FILE); an empty one is deleted. Beside the table, .meta.json lists the wheel, the Python and every crash. +A test that passed only after tests/conftest.py's rerun of the known engine race (issue 409) carries the junit property `flaky_race`: the TOTAL line +counts those tests as flaky_race=N, the log prints a ::warning:: for each, and the metadata lists them. A count, never a failure. """ import argparse @@ -33,6 +35,9 @@ # On Windows the test process writes a faulthandler trace to this file (tests/conftest.py, native backend only). FAULT_FILE_ENV = "ARCADEDB_TEST_FAULTHANDLER_FILE" +# The junit property of a test that passed after a rerun of the known engine race (tests/conftest.py KNOWN_RACE_PROPERTY); the value is the reruns it took. +RACE_PROPERTY = "flaky_race" + def parse_args(argv=None): p = argparse.ArgumentParser() @@ -134,6 +139,35 @@ def count_xml(xml): return c, fails +def race_events(xml, name): + """One record per test of a junit XML that passed only after the known engine race rerun (the property `flaky_race`); [] when the XML does not parse.""" + found = [] + try: + for tc in ET.parse(xml).getroot().iter("testcase"): + if tc.find("failure") is not None or tc.find("error") is not None: + continue + for prop in tc.iter("property"): + if prop.get("name") == RACE_PROPERTY: + found.append( + { + "file": name, + "test": tc.get("name"), + "reruns": prop.get("value"), + } + ) + except ET.ParseError: + return [] + return found + + +def total_row(tot): + """The TOTAL line of the table: the counts, then the status column (timeouts, flaky_crash, crash, flaky_race; the gate reads only the counts).""" + return ( + f"TOTAL\t{tot['passed']}\t{tot['failed']}\t{tot['error']}\t{tot['notyet']}\t{tot['na_jvm']}\t{tot['skipped']}\t" + f"timeouts={tot['timeout']} flaky_crash={tot['flaky_crash']} crash={tot['crash']} flaky_race={tot['flaky_race']}\t\t\t\n" + ) + + def main(argv=None): a = parse_args(argv) pkg = os.path.abspath(a.repo) @@ -196,8 +230,10 @@ def main(argv=None): f"CRASH RETRY: on, a file that dies without a result is run once more (at most {policy.budget} files)", flush=True, ) - rows, events = [], [] - tot = dict.fromkeys([*COUNT_KEYS, "timeout", "flaky_crash", "crash"], 0) + rows, events, races = [], [], [] + tot = dict.fromkeys( + [*COUNT_KEYS, "timeout", "flaky_crash", "crash", "flaky_race"], 0 + ) for f in files: name = os.path.basename(f) @@ -300,6 +336,10 @@ def attempt(n): tot["timeout"] += out.timed_out tot["flaky_crash"] += out.flaky tot["crash"] += out.hard_crash + # the XML on disk is the one of the last attempt, which is the one that counts + file_races = race_events(xml, name) if out.final.result else [] + tot["flaky_race"] += len(file_races) + races.extend(file_races) ev = pc.event_of(name, out, c["failed"] + c["error"]) if ev: ev.update(traces_of(name, xmldir, range(1, len(out.attempts) + 1))) @@ -319,6 +359,11 @@ def attempt(n): f"the run once more: {'a result' if out.final.result else 'no result again'} ({pc.format_rc(out.final.rc)})", flush=True, ) + for race in file_races: + print( + f"::warning::{name}: {race['test']} passed only after {race['reruns']} rerun(s) of the known engine race (ArcadeData/arcadedb-python#409)", + flush=True, + ) for n, at in enumerate(out.attempts, 1): if pc.dirty_exit(at): print( @@ -333,9 +378,7 @@ def attempt(n): fh.write( f"{name}\t{c['passed']}\t{c['failed']}\t{c['error']}\t{c['notyet']}\t{c['na_jvm']}\t{c['skipped']}\t{status}\t{';'.join(fails[:40])}\t{attempts}\t{pc.format_rc(rc)}\n" ) - fh.write( - f"TOTAL\t{tot['passed']}\t{tot['failed']}\t{tot['error']}\t{tot['notyet']}\t{tot['na_jvm']}\t{tot['skipped']}\ttimeouts={tot['timeout']} flaky_crash={tot['flaky_crash']} crash={tot['crash']}\t\t\t\n" - ) + fh.write(total_row(tot)) with open(os.path.splitext(a.out)[0] + ".meta.json", "w") as fh: json.dump( { @@ -347,6 +390,7 @@ def attempt(n): "source_commit": ident.get("source_commit", ""), "retry_crash": policy.enabled, "crash_events": events, + "race_events": races, }, fh, indent=1, diff --git a/native/wheel/report_flaky_crash.py b/native/wheel/report_flaky_crash.py index 2affe9ed..7908b0e6 100644 --- a/native/wheel/report_flaky_crash.py +++ b/native/wheel/report_flaky_crash.py @@ -14,6 +14,9 @@ The comment is a log, not a gate: when the token cannot write issues, or gh fails for any other reason, the script prints a `::warning::` line and still exits 0. It never fails the run. The text carries no em dash. +The same meta files list the tests that passed only after the rerun of the known engine race (`race_events`, issue 409). Those are a count, not a +crash: the summary gets one table for them, nothing is posted on any issue, and a run with such tests and no crash still ends green. + python native/wheel/report_flaky_crash.py --artifacts [--summary ] [--dry-run] """ @@ -56,6 +59,49 @@ def load_events(root: str) -> list[dict]: return events +def load_race_events(root: str) -> list[dict]: + """Every test of every leg under `root` that passed only after the rerun of the known engine race, each with its leg's identity.""" + races = [] + for path in sorted(glob.glob(os.path.join(root, "**", META), recursive=True)): + try: + with open(path, encoding="utf-8") as fh: + meta = json.load(fh) + except (OSError, ValueError): + continue # load_events has already printed the warning for this file + artifact = os.path.basename(os.path.dirname(path)) + for ev in meta.get("race_events", []): + races.append( + { + **ev, + "leg": meta.get("key") or artifact, + "python": meta.get("python", ""), + "wheel": meta.get("wheel_version", ""), + } + ) + return races + + +def race_md(races: list[dict]) -> str: + """The job summary block for the known engine race (issue 409); empty when no test needed a rerun.""" + if not races: + return "" + out = [ + "### Known engine race reruns", + "", + f"**FLAKY-RACE: {len(races)} test(s) passed only after a rerun of the known engine race of ArcadeData/arcadedb-python#409.** " + "The rerun is in tests/conftest.py (at most two reruns, only for the three messages of the race); it is a count, not a failure. " + "Each rerun is also a UserWarning in the log of its test file.", + "", + "| leg | Python | wheel | file | test | reruns |", + "|---|---|---|---|---|---|", + ] + for r in races: + out.append( + f"| {r['leg']} | {r['python']} | {r['wheel']} | `{r['file']}` | `{r['test']}` | {r['reruns']} |" + ) + return "\n".join(out) + "\n" + + def _table(events: list[dict]) -> list[str]: lines = [ "| leg | Python | wheel | file | first exit code | retry |", @@ -179,8 +225,19 @@ def post_comment(body: str, run=subprocess.run) -> tuple[bool, str]: return True, "" -def report(events, env, summary_path="", dry_run=False, run=subprocess.run) -> int: - """Write the summary, post the comment when allowed. Returns 0: a log is never a gate.""" +def report( + events, env, summary_path="", dry_run=False, run=subprocess.run, races=() +) -> int: + """Write the summary, post the comment when allowed. Returns 0: a log is never a gate. + + `races` (the tests that passed after a rerun of the known engine race) only add a block to the summary; they never post anything. + """ + if races: + race_text = race_md(list(races)) + print(race_text, flush=True) + if summary_path: + with open(summary_path, "a", encoding="utf-8") as fh: + fh.write(race_text) if not events: print("no crash event in this run", flush=True) return 0 @@ -232,7 +289,13 @@ def main(argv=None) -> int: ap.add_argument("--dry-run", action="store_true") a = ap.parse_args(argv) try: - return report(load_events(a.artifacts), os.environ, a.summary, a.dry_run) + return report( + load_events(a.artifacts), + os.environ, + a.summary, + a.dry_run, + races=load_race_events(a.artifacts), + ) except Exception as err: # noqa: BLE001 - a log is never a gate print( f"::warning::the crash report failed: {type(err).__name__}: {err}", diff --git a/tests/conftest.py b/tests/conftest.py index 107e7ef9..6bcc98cb 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,6 +3,7 @@ """ import os +import re import shutil import sys import threading @@ -625,3 +626,79 @@ def small_chunks(monkeypatch): monkeypatch.setattr(core, "_INSERT_MANY_CHUNK", CHUNK) monkeypatch.setattr(arcadedb.GraphBatch, "_BULK_CHUNK", CHUNK) + + +# --------------------------------------------------------------------------------------------------------------------------------- +# The known engine race of ArcadeData/arcadedb-python#409: a bounded, visible, counted rerun for tests/test_vector_read_your_writes.py. +# +# The engine of 26.11.1 can miss a vector that a commit has just returned (a graph rebuild trims it between the two phases of its commit); +# the engine fix is the open pull request ArcadeData/arcadedb#12087. The test must keep detecting the race, and a red `main` on about every +# other run hides every other regression. So the test body runs again (at most KNOWN_RACE_RERUNS more times, each on a fresh database) +# when, and only when, it failed with one of the three messages the race produces. Any other failure is raised at once, a body that fails +# every run fails, and a pass after a rerun is a UserWarning that names the issue and a junit property that native/wheel/parity_wheel.py +# counts as `flaky_race`. The tests of this block are in tests/test_known_engine_race_rerun.py. +# +# REMOVE WHEN the engine release that contains ArcadeData/arcadedb#12087 is merged and released AND tests/test_vector_read_your_writes.py has +# passed 100 consecutive scheduled runs: delete this block, its use in tests/test_vector_read_your_writes.py, tests/test_known_engine_race_rerun.py, +# the `flaky_race` counter (native/wheel/parity_wheel.py, native/wheel/report_flaky_crash.py, the FLAKY-RACE lines of the two gate awk programs in +# test-native.yml and their tests) and the paragraph in docs/modules/ROOT/pages/development/ci.adoc, then close ArcadeData/arcadedb-python#409. +# --------------------------------------------------------------------------------------------------------------------------------- +KNOWN_RACE_ISSUE = "ArcadeData/arcadedb-python#409" +# The number of reruns is a constant on purpose: no environment variable, option or marker raises it. +KNOWN_RACE_RERUNS = 2 +# The junit property of a test that passed only after a rerun; its value is the number of reruns that it took. +KNOWN_RACE_PROPERTY = "flaky_race" +# (name of the exception class, pattern of its message). The class is matched by name along its bases, so this needs no import of the engine. +KNOWN_RACE_SIGNATURES = ( + # the assertion of the tests: a committed vector that the next search did not return + ("AssertionError", re.compile(r"\d+ of \d+ committed vectors were not found")), + # find_nearest wraps what the engine raised, so this also covers the next one on the JVM build + ("ArcadeDBError", re.compile(r"Vector search failed")), + # the search loaded an RID that the index returned and whose record was not readable yet + ("ArcadeDBError", re.compile(r"Record #\d+:\d+ not found")), +) + + +def is_known_engine_race(exc): + """True when `exc` is one of the three failures of the known engine race (issue 409), and nothing else.""" + text = str(exc) + bases = {cls.__name__ for cls in type(exc).__mro__} + return any( + kind in bases and pattern.search(text) + for kind, pattern in KNOWN_RACE_SIGNATURES + ) + + +def run_with_known_race_rerun(attempt, request=None, label="the test"): + """Call `attempt(n)` (n counts from 1; it runs the whole test body on a fresh database) until it passes. + + A failure that is not one of the three signatures is raised at once. A known one runs the body again, at most KNOWN_RACE_RERUNS more + times, with a UserWarning that names issue 409 and the run. The last failure is raised. When a run after the first passes and `request` + is given, the property `flaky_race` (the number of reruns) is added to the test's junit record. Returns the number of reruns used. + """ + import warnings + + runs = 1 + KNOWN_RACE_RERUNS + for n in range(1, runs + 1): + try: + attempt(n) + except Exception as exc: + if not is_known_engine_race(exc): + raise + if n == runs: + exc.add_note( + f"{KNOWN_RACE_ISSUE}: this test body failed on all {runs} runs with the known engine race" + ) + raise + first = (str(exc).splitlines() or [""])[0][:160] + warnings.warn( + f"{KNOWN_RACE_ISSUE}: {label} met the known engine race on run {n} of {runs} ({first}); " + f"running it again on a fresh database (rerun {n} of {KNOWN_RACE_RERUNS})", + UserWarning, + stacklevel=2, + ) + continue + if n > 1 and request is not None: + # what the record_property fixture does; the fixture itself warns on every use with the junit_family of the JVM jobs + request.node.user_properties.append((KNOWN_RACE_PROPERTY, n - 1)) + return n - 1 diff --git a/tests/test_known_engine_race_rerun.py b/tests/test_known_engine_race_rerun.py new file mode 100644 index 00000000..101c521a --- /dev/null +++ b/tests/test_known_engine_race_rerun.py @@ -0,0 +1,459 @@ +"""The rerun of the known engine race (ArcadeData/arcadedb-python#409) is bounded, visible, counted and narrow. + +tests/test_vector_read_your_writes.py runs each of its tests again, at most twice, when the body failed with one of the three messages of the race +in the commit-to-search path of engine 26.11.1 (ArcadeData/arcadedb#12087 is the fix). The mechanism is `run_with_known_race_rerun` in +tests/conftest.py. These are plain functions on fake bodies: no engine is started and no database is created. The tests of the gate's awk program +with a `flaky_race` count are in tests/test_parity_gate_awk.py, the file that already runs that program. +""" + +from __future__ import annotations + +import ast +import contextlib +import importlib.util +import inspect +import json +import os +import subprocess # nosec B404 - a test-controlled child process +import sys +import warnings +from pathlib import Path +from types import SimpleNamespace + +import pytest + +import arcadedb +from tests import conftest +from tests.conftest import ( + KNOWN_RACE_ISSUE, + KNOWN_RACE_PROPERTY, + KNOWN_RACE_RERUNS, + is_known_engine_race, + run_with_known_race_rerun, +) + +ROOT = Path(__file__).resolve().parents[1] +WHEEL_DIR = ROOT / "native" / "wheel" +if str(WHEEL_DIR) not in sys.path: + sys.path.insert( + 0, str(WHEEL_DIR) + ) # the harness imports parity_crash as a sibling of the script + + +def _load(name: str): + spec = importlib.util.spec_from_file_location(name, WHEEL_DIR / f"{name}.py") + module = importlib.util.module_from_spec(spec) + sys.modules[name] = module + spec.loader.exec_module(module) + return module + + +parity_wheel = _load("parity_wheel") +report = _load("report_flaky_crash") + +MISS = "1 of 200 committed vectors were not found by the next search: [(396, [162, 169, 427, 165, 454])]" +OTHER_TASK = "3 of 200 committed vectors were not found by another task: [(401, [1])]" +SEARCH_FAILED = "Vector search failed: com.arcadedb.exception.RecordNotFoundException: Record #1:489 not found" + + +def fake_request(): + """What the wrapper needs of pytest's `request`: a node with a list of user properties.""" + return SimpleNamespace(node=SimpleNamespace(user_properties=[])) + + +def body_failing(times, error): + """A fake test body: attempt n raises `error()` for n <= times and returns after that; `calls` records the attempts.""" + calls = [] + + def attempt(n): + calls.append(n) + if n <= times: + raise error() + + return attempt, calls + + +def run(attempt, request=None): + """(reruns used or the exception raised, the UserWarnings that the run issued).""" + with warnings.catch_warnings(record=True) as caught: + warnings.simplefilter("always") + try: + result = run_with_known_race_rerun(attempt, request, label="test_x") + except Exception as exc: # noqa: BLE001 - the tests below read it + result = exc + return result, [w for w in caught if issubclass(w.category, UserWarning)] + + +def test_a_body_that_passes_is_called_once_with_no_warning_and_no_count(): + attempt, calls = body_failing(0, AssertionError) + request = fake_request() + result, warned = run(attempt, request) + assert (result, calls, warned) == (0, [1], []) + assert request.node.user_properties == [] + + +def test_a_body_that_fails_once_with_a_signature_and_then_passes_is_a_pass_with_one_warning_and_a_count(): + attempt, calls = body_failing(1, lambda: AssertionError(MISS)) + request = fake_request() + result, warned = run(attempt, request) + assert (result, calls) == (1, [1, 2]) + assert len(warned) == 1 + text = str(warned[0].message) + assert KNOWN_RACE_ISSUE in text and "run 1 of 3" in text and "rerun 1 of 2" in text + assert "1 of 200 committed vectors were not found" in text + # the count the harness reads from the junit record + assert request.node.user_properties == [(KNOWN_RACE_PROPERTY, 1)] + + +def test_a_body_that_fails_twice_and_passes_on_the_last_run_is_a_pass_with_two_warnings(): + attempt, calls = body_failing(2, lambda: arcadedb.ArcadeDBError(SEARCH_FAILED)) + request = fake_request() + result, warned = run(attempt, request) + assert (result, calls) == (2, [1, 2, 3]) + assert "rerun 1 of 2" in str(warned[0].message) + assert "rerun 2 of 2" in str(warned[1].message) + assert request.node.user_properties == [(KNOWN_RACE_PROPERTY, 2)] + + +def test_a_body_that_fails_on_every_run_fails_with_two_warnings_and_no_count(): + attempt, calls = body_failing(99, lambda: AssertionError(MISS)) + request = fake_request() + result, warned = run(attempt, request) + assert isinstance(result, AssertionError) and MISS in str(result) + assert calls == [1, 2, 3] == list(range(1, 2 + KNOWN_RACE_RERUNS)) + assert len(warned) == 2 + assert request.node.user_properties == [] + assert any(KNOWN_RACE_ISSUE in note for note in result.__notes__) + + +def test_a_failure_with_another_message_is_not_retried(): + for error in ( + lambda: AssertionError("assert 499 == 500"), + lambda: AssertionError("a vector was not found"), + lambda: arcadedb.ArcadeDBError("Database is closed"), + lambda: arcadedb.ArcadeDBError("Record not found"), + lambda: ValueError("Vector search failed"), + lambda: KeyError(MISS), + lambda: RuntimeError(SEARCH_FAILED), + ): + attempt, calls = body_failing(99, error) + request = fake_request() + result, warned = run(attempt, request) + assert isinstance(result, Exception), error + assert (calls, warned, request.node.user_properties) == ([1], [], []), error + + +def test_a_second_failure_of_another_kind_ends_the_reruns_at_once(): + kinds = iter( + [lambda: AssertionError(MISS), lambda: AssertionError("assert 1 == 2")] + ) + + def attempt(n): + calls.append(n) + raise next(kinds)() + + calls = [] + result, warned = run(attempt, fake_request()) + assert isinstance(result, AssertionError) and str(result) == "assert 1 == 2" + assert (calls, len(warned)) == ([1, 2], 1) + + +def test_only_the_three_signatures_match(): + race = [ + AssertionError(MISS), + AssertionError(OTHER_TASK), + AssertionError( + MISS + "\nassert [(396, [1])] == []\n Left contains one more item" + ), + arcadedb.ArcadeDBError(SEARCH_FAILED), + arcadedb.ArcadeDBError("Vector search failed"), + arcadedb.ArcadeDBError("Record #1:446 not found"), + ] + not_race = [ + AssertionError("assert 499 == 500"), + AssertionError("Record #1:446 not found"), # the class is part of the signature + AssertionError("Vector search failed"), + arcadedb.ArcadeDBError("committed vectors were not found"), + arcadedb.ArcadeDBError("Vector search"), + arcadedb.ArcadeDBError("Record #x not found"), + arcadedb.ArcadeDBError("Database is closed"), + RuntimeError("Vector search failed"), + TimeoutError("Record #1:446 not found"), + ] + assert [is_known_engine_race(e) for e in race] == [True] * len(race) + assert [is_known_engine_race(e) for e in not_race] == [False] * len(not_race) + # exactly three signatures, no more + assert len(conftest.KNOWN_RACE_SIGNATURES) == 3 + + +def test_the_number_of_reruns_is_two_and_no_environment_variable_raises_it(): + assert KNOWN_RACE_RERUNS == 2 + names = [ + "ARCADEDB_KNOWN_RACE_RERUNS", + "KNOWN_RACE_RERUNS", + "ARCADEDB_TEST_RERUNS", + "ARCADEDB_RERUNS", + "RERUNS", + "ARCADEDB_FLAKY_RERUNS", + ] + saved = {n: os.environ.get(n) for n in names} + try: + for n in names: + os.environ[n] = "50" + attempt, calls = body_failing(99, lambda: AssertionError(MISS)) + result, warned = run(attempt) + assert isinstance(result, AssertionError) and calls == [1, 2, 3] + assert len(warned) == 2 + finally: + for n, value in saved.items(): + if value is None: + os.environ.pop(n, None) + else: + os.environ[n] = value + # and the code that decides reads no environment at all + for fn in (run_with_known_race_rerun, is_known_engine_race): + source = inspect.getsource(fn) + assert "environ" not in source and "getenv" not in source, fn.__name__ + + +def test_only_the_vector_read_your_writes_file_uses_the_rerun(): + users = sorted( + p.name + for p in (ROOT / "tests").glob("*.py") + if "run_with_known_race_rerun" in p.read_text(encoding="utf-8") + ) + assert users == [ + "conftest.py", + "test_known_engine_race_rerun.py", + "test_vector_read_your_writes.py", + ] + + +def test_every_test_of_the_vector_read_your_writes_file_goes_through_the_rerun(): + path = ROOT / "tests" / "test_vector_read_your_writes.py" + tree = ast.parse(path.read_text(encoding="utf-8")) + tests = [ + node + for node in tree.body + if isinstance(node, ast.FunctionDef) and node.name.startswith("test_") + ] + assert len(tests) == 4 + for node in tests: + names = [d.id for d in node.decorator_list if isinstance(d, ast.Name)] + assert names == ["known_race_test"], node.name + + +class FakeDb: + """Just enough database for the corpus of tests/test_vector_read_your_writes.py: it records where it was created and whether it was dropped.""" + + created = [] + + def __init__(self, path): + self.path = path + self.dropped = False + FakeDb.created.append(self) + + def command(self, *args): + pass + + def transaction(self): + return contextlib.nullcontext() + + def create_vector_index(self, *args, **kwargs): + return object() + + def drop(self): + self.dropped = True + + +def test_each_run_of_a_vector_test_gets_a_new_database_and_every_database_is_dropped( + tmp_path, +): + from tests import test_vector_read_your_writes as vec + + seen = [] + + @vec.known_race_test + def test_x(corpus): + db, _index = corpus + seen.append(db) + if len(seen) < 3: + raise AssertionError(MISS) + + real = vec.arcadedb.create_database + FakeDb.created = [] + vec.arcadedb.create_database = lambda path: FakeDb(path) + try: + request = fake_request() + with warnings.catch_warnings(record=True): + warnings.simplefilter("always") + test_x(tmp_path, request) + finally: + vec.arcadedb.create_database = real + assert seen == FakeDb.created and len(seen) == 3 + assert len({db.path for db in seen}) == 3 # three directories, never a reused one + assert all(db.dropped for db in seen) + assert request.node.user_properties == [(KNOWN_RACE_PROPERTY, 2)] + # pytest sees the wrapper's own fixtures, not the body's `corpus` + assert list(inspect.signature(test_x).parameters) == ["tmp_path", "request"] + assert test_x.__name__ == "test_x" + + +# --------------------------------------------------------------------------------------------------------------------------------- +# the count: the junit property, the TOTAL line, the metadata and the job summary +# --------------------------------------------------------------------------------------------------------------------------------- + +XML = """ + + + + +x + +""" + + +def test_the_harness_counts_the_tests_that_passed_after_a_rerun_and_not_the_failed_ones( + tmp_path, +): + xml = tmp_path / "test_vector_read_your_writes.py.xml" + xml.write_text(XML) + found = parity_wheel.race_events(str(xml), "test_vector_read_your_writes.py") + assert [(e["test"], e["reruns"]) for e in found] == [ + ("test_a", "1"), + ("test_b", "2"), + ] + assert {e["file"] for e in found} == {"test_vector_read_your_writes.py"} + xml.write_text( + "" + ) # an unreadable XML is BADXML for the harness, never a count + assert parity_wheel.race_events(str(xml), "x.py") == [] + + +@pytest.mark.parametrize("family", ["xunit1", "xunit2"]) +def test_a_real_junit_record_carries_the_property_in_both_families(tmp_path, family): + inner = tmp_path / "test_inner.py" + inner.write_text( + "def test_a(request):\n" + f" request.node.user_properties.append(({KNOWN_RACE_PROPERTY!r}, 2))\n\n\n" + "def test_b():\n pass\n" + ) + xml = tmp_path / "inner.xml" + r = subprocess.run( # nosec B603 - fixed argument list, no shell + [ + sys.executable, + "-m", + "pytest", + str(inner), + "-q", + "-p", + "no:cacheprovider", + f"--junitxml={xml}", + "-o", + f"junit_family={family}", + ], + cwd=tmp_path, + env={**os.environ, "PYTEST_ADDOPTS": ""}, + capture_output=True, + text=True, + timeout=120, + ) + assert r.returncode == 0, r.stdout + r.stderr + found = parity_wheel.race_events(str(xml), "test_inner.py") + assert [(e["test"], e["reruns"]) for e in found] == [("test_a", "2")] + + +def totals(**counts): + tot = dict.fromkeys( + [ + "passed", + "failed", + "error", + "notyet", + "na_jvm", + "skipped", + "timeout", + "flaky_crash", + "crash", + "flaky_race", + ], + 0, + ) + tot["passed"] = 10 + tot.update(counts) + return tot + + +def test_the_total_line_carries_flaky_race_after_the_crash_counts(): + zero = parity_wheel.total_row(totals()) + two = parity_wheel.total_row(totals(flaky_race=2, flaky_crash=1)) + assert ( + zero + == "TOTAL\t10\t0\t0\t0\t0\t0\ttimeouts=0 flaky_crash=0 crash=0 flaky_race=0\t\t\t\n" + ) + assert ( + two + == "TOTAL\t10\t0\t0\t0\t0\t0\ttimeouts=0 flaky_crash=1 crash=0 flaky_race=2\t\t\t\n" + ) + # still the 11 columns of the header, so every reader of the table keeps its column numbers + assert len(zero.rstrip("\n").split("\t")) == 11 == len(two.rstrip("\n").split("\t")) + + +def write_race_meta(root, artifact, key, races): + d = root / artifact + d.mkdir(parents=True) + (d / "parity-wheel.meta.json").write_text( + json.dumps( + { + "key": key, + "python": "3.12.7", + "wheel_version": "26.12.1.dev0", + "crash_events": [], + "race_events": races, + } + ) + ) + + +RACE = {"file": "test_vector_read_your_writes.py", "test": "test_a_task", "reruns": "1"} + + +def test_the_summary_lists_the_race_tests_posts_nothing_and_a_run_without_any_stays_quiet( + tmp_path, capsys +): + root = tmp_path / "artifacts" + write_race_meta(root, "native-parity-macos-arm64-py3.12", "macos-arm64", [RACE]) + write_race_meta(root, "native-parity-linux-x86_64-py3.12", "linux-x86_64", []) + races = report.load_race_events(str(root)) + assert [(r["leg"], r["test"]) for r in races] == [("macos-arm64", "test_a_task")] + summary = tmp_path / "summary.md" + posted = [] + rc = report.report( + [], + {"GITHUB_EVENT_NAME": "workflow_dispatch", "GITHUB_REPOSITORY": report.REPO}, + str(summary), + False, + run=lambda *a, **k: posted.append(a), + races=races, + ) + text = summary.read_text() + assert rc == 0 and posted == [] + assert "FLAKY-RACE: 1 test(s)" in text and "`test_a_task`" in text + assert "no crash event in this run" in capsys.readouterr().out + # no race and no crash: nothing is written + quiet = tmp_path / "quiet.md" + assert report.report([], {}, str(quiet), races=()) == 0 + assert not quiet.exists() + assert report.race_md([]) == "" + + +def test_no_text_of_the_rerun_has_an_em_dash(): + dash = "—" # an escape, so that this file holds none itself + for source in ( + inspect.getsource(run_with_known_race_rerun), + inspect.getsource(report.race_md), + (ROOT / "tests" / "test_vector_read_your_writes.py").read_text( + encoding="utf-8" + ), + ): + assert dash not in source diff --git a/tests/test_parity_crash_retry.py b/tests/test_parity_crash_retry.py index 1aab86b7..f3030ada 100644 --- a/tests/test_parity_crash_retry.py +++ b/tests/test_parity_crash_retry.py @@ -403,7 +403,7 @@ def test_the_harness_is_strict_without_the_flag(harness): assert rows[name]["status"] == f"CRASH(rc={HIGH_TEXT})", name assert rows[name]["attempts"] == "1", name assert rows[name]["exit"] == HIGH_TEXT, name - assert rows["TOTAL"]["status"] == "timeouts=0 flaky_crash=0 crash=2" + assert rows["TOTAL"]["status"] == "timeouts=0 flaky_crash=0 crash=2 flaky_race=0" assert meta["retry_crash"] is False assert [e["kind"] for e in meta["crash_events"]] == ["CRASH", "CRASH"] assert not (xmldir / "test_dies_once.py.attempt1.log").exists() @@ -427,7 +427,7 @@ def test_the_harness_retries_only_the_crashes_with_the_flag(harness): always = rows["test_dies_always.py"] assert always["status"] == f"CRASH(rc={HIGH_TEXT};retry rc={HIGH_TEXT})" assert always["attempts"] == "2" - assert rows["TOTAL"]["status"] == "timeouts=0 flaky_crash=1 crash=1" + assert rows["TOTAL"]["status"] == "timeouts=0 flaky_crash=1 crash=1 flaky_race=0" # the log of the first attempt is kept beside the log of the retry assert (xmldir / "test_dies_once.py.attempt1.log").exists() assert (xmldir / "test_dies_once.py.log").exists() @@ -851,7 +851,7 @@ def test_a_process_that_dies_after_its_result_is_a_dirty_exit_and_fails_nothing( row["attempts"], row["exit"], ) == ("", "1", "0", "1", HIGH_TEXT) - assert rows["TOTAL"]["status"] == "timeouts=0 flaky_crash=0 crash=0" + assert rows["TOTAL"]["status"] == "timeouts=0 flaky_crash=0 crash=0 flaky_race=0" assert [ (e["kind"], e["file"], e["first_rc"], e["attempt"], e["log"]) for e in meta["crash_events"] diff --git a/tests/test_parity_gate_awk.py b/tests/test_parity_gate_awk.py index a2e8069a..15cb93d4 100644 --- a/tests/test_parity_gate_awk.py +++ b/tests/test_parity_gate_awk.py @@ -13,10 +13,18 @@ import os import re import subprocess # nosec B404 - test-controlled child processes +import sys from pathlib import Path import pytest +WHEEL_DIR = Path(__file__).resolve().parents[1] / "native" / "wheel" +if str(WHEEL_DIR) not in sys.path: + sys.path.insert( + 0, str(WHEEL_DIR) + ) # the harness imports parity_crash as a sibling of the script +import parity_wheel # noqa: E402 + WORKFLOW = ( Path(__file__).resolve().parents[1] / ".github" / "workflows" / "test-native.yml" ) @@ -41,6 +49,28 @@ def total( return f"TOTAL\t{passed}\t{failed}\t{error}\t0\t0\t{skipped}\t{status}\t\t\t\n" +def totals(**counts): + """The `tot` dict of parity_wheel.main with the given counts (the others 0), for total_row.""" + tot = dict.fromkeys( + [ + "passed", + "failed", + "error", + "notyet", + "na_jvm", + "skipped", + "timeout", + "flaky_crash", + "crash", + "flaky_race", + ], + 0, + ) + tot["passed"] = 10 + tot.update(counts) + return tot + + def run_gate(program, tmp_path, *rows): tsv = tmp_path / "parity-wheel.tsv" tsv.write_text(HEADER + "".join(rows)) @@ -163,6 +193,54 @@ def test_a_timeout_an_unreadable_xml_a_failure_and_a_skip_still_fail_the_gate( assert run_gate(program, tmp_path, row("test_a.py")).returncode == 1 # no TOTAL row +def test_a_test_that_passed_after_the_race_rerun_is_printed_and_never_fails_the_gate( + program, tmp_path +): + # the TOTAL line that native/wheel/parity_wheel.py writes (total_row), so the gate reads what the harness writes + clean = parity_wheel.total_row(totals()) + two = parity_wheel.total_row(totals(flaky_race=2)) + r0 = run_gate(program, tmp_path, row("test_a.py"), clean) + assert r0.returncode == 0, r0.stderr + assert "FLAKY-RACE" not in r0.stdout + r2 = run_gate(program, tmp_path, row("test_a.py"), two) + assert r2.returncode == 0, r2.stderr + assert ( + "FLAKY-RACE (tests that passed only after a rerun of the known engine race of ArcadeData/arcadedb-python#409): 2" + in r2.stdout + ) + # the line that the gate prints first is the same with and without the count + first = "parity windows-x64 py3.14: passed=10 failed=0 error=0" + assert r0.stdout.startswith(first) and r2.stdout.startswith(first) + + +def test_the_race_count_does_not_hide_a_failure_a_crash_or_a_skip(program, tmp_path): + two = parity_wheel.total_row(totals(flaky_race=2)) + assert ( + run_gate( + program, + tmp_path, + row("test_a.py", failed=1), + parity_wheel.total_row(totals(failed=1, flaky_race=2)), + ).returncode + == 1 + ) + assert ( + run_gate( + program, tmp_path, row("test_a.py", status="CRASH(rc=1)"), two + ).returncode + == 1 + ) + assert ( + run_gate( + program, + tmp_path, + row("test_a.py"), + parity_wheel.total_row(totals(skipped=1, flaky_race=2)), + ).returncode + == 1 + ) + + def test_a_file_that_died_after_its_result_does_not_fail_the_gate(program, tmp_path): # DIRTY-EXIT is a record in the metadata, not a status: the row is clean and only its exit column differs r = run_gate(program, tmp_path, row("test_a.py", exit_="0x0000008B,139"), total()) diff --git a/tests/test_vector_read_your_writes.py b/tests/test_vector_read_your_writes.py index 9d434bca..eb2bf7a5 100644 --- a/tests/test_vector_read_your_writes.py +++ b/tests/test_vector_read_your_writes.py @@ -11,17 +11,22 @@ walk of a large graph: every vector is the nearest neighbour of itself, at distance 0, and a different result means the write was not seen. The same two tests run again through ``arcadedb.aio.AsyncDatabase`` (the facade over those calls), where an insert is a ``run_in_transaction`` and a search is ``find_nearest``. The file uses no Java object, so it runs on the JVM build and on the native build alike. + +The engine of 26.11.1 has a known race in the commit-to-search path (ArcadeData/arcadedb-python#409, fixed upstream by ArcadeData/arcadedb#12087, not +yet in a release). A test here runs again on a fresh database, at most twice, when it failed with one of the three messages of that race and nothing +else: ``known_race_test`` below, ``run_with_known_race_rerun`` in conftest.py. The assertions are unchanged, and a test that fails every run fails. """ import asyncio +import contextlib import math import random import numpy as np -import pytest import arcadedb from arcadedb.aio import AsyncDatabase +from tests.conftest import run_with_known_race_rerun DIM = 8 BASE = 300 @@ -58,19 +63,47 @@ def _count(db): return db.query("sql", "SELECT count(*) AS n FROM Doc").first().get("n") -@pytest.fixture -def corpus(tmp_path): - db = arcadedb.create_database(str(tmp_path / "read_your_writes")) - db.command("sql", "CREATE VERTEX TYPE Doc") - db.command("sql", "CREATE PROPERTY Doc.embedding ARRAY_OF_FLOATS") - with db.transaction(): - for i in range(BASE): - db.command("sql", "INSERT INTO Doc SET vid = ?, embedding = ?", i, _vec(i)) - index = db.create_vector_index("Doc", "embedding", dimensions=DIM) - yield db, index - db.drop() +@contextlib.contextmanager +def _corpus(path): + """A new database of BASE vectors with a vector index, dropped when the block ends.""" + db = arcadedb.create_database(str(path)) + try: + db.command("sql", "CREATE VERTEX TYPE Doc") + db.command("sql", "CREATE PROPERTY Doc.embedding ARRAY_OF_FLOATS") + with db.transaction(): + for i in range(BASE): + db.command( + "sql", "INSERT INTO Doc SET vid = ?, embedding = ?", i, _vec(i) + ) + index = db.create_vector_index("Doc", "embedding", dimensions=DIM) + yield db, index + finally: + db.drop() + + +def known_race_test(body): + """Make `body(corpus)` a test that runs on a fresh corpus and again, at most twice, on the known engine race of #409. + + Each run gets its own database. The wrapper takes pytest's `tmp_path` and `request` (for the junit property of a pass after a rerun), + not the body's `corpus`, so the decorated function is built by hand and `functools.wraps` is not used (it would hand pytest the body's + signature). + """ + + def test(tmp_path, request): + def attempt(n): + with _corpus(tmp_path / f"read_your_writes_{n}") as corpus: + body(corpus) + + run_with_known_race_rerun(attempt, request, label=body.__name__) + + test.__name__ = body.__name__ + test.__qualname__ = body.__qualname__ + test.__doc__ = body.__doc__ + test.__module__ = body.__module__ + return test +@known_race_test def test_a_task_finds_the_vector_it_committed_in_the_call_before(corpus): db, index = corpus missed = [] @@ -93,6 +126,7 @@ async def main(): assert _count(db) == BASE + TOTAL +@known_race_test def test_another_task_finds_the_vector_once_the_writing_task_has_committed_it(corpus): db, index = corpus missed = [] @@ -135,6 +169,7 @@ async def _facade_nearest_ids(adb, index, i): return [record.get("vid") for record, _distance in hits] +@known_race_test def test_through_the_facade_a_task_finds_the_vector_it_committed_in_the_call_before( corpus, ): @@ -160,6 +195,7 @@ async def main(): assert _count(db) == BASE + TOTAL +@known_race_test def test_through_the_facade_another_task_finds_the_vector_once_the_writing_task_has_committed_it( corpus, ):