diff --git a/.github/workflows/native-core-build.yml b/.github/workflows/native-core-build.yml index f201147b..f8959cb4 100644 --- a/.github/workflows/native-core-build.yml +++ b/.github/workflows/native-core-build.yml @@ -7,6 +7,9 @@ on: # FFI-binding Python files that import the native `_core` module. - "agent_assembly/__init__.py" - "agent_assembly/types.py" + # The modules test_native_core_runtime.py drives through `_core`. + - "agent_assembly/core/**" + - "test/integration/test_native_core_runtime.py" - ".github/workflows/native-core-build.yml" workflow_dispatch: @@ -53,3 +56,17 @@ jobs: - name: Verify native module import run: | uv run python -c "from agent_assembly._core import RuntimeClient, GovernanceEvent" + + # AAASM-6359: this file skips itself unless the gate variable is "1", and a + # skip exits 0, so a typo'd/removed variable would turn the job into a + # silent pass. `-o addopts=""` drops pytest.ini's `--reruns 1` (a retry + # would hide a flaky timing assertion) and the coverage plugins; the + # junit check fails the job if anything was skipped. + - name: Run native core runtime tests + env: + AAASM_RUN_NATIVE_CORE_TESTS: "1" + run: | + uv run --with pytest python -m pytest -o addopts="" -rs \ + --junitxml=native-core-runtime.xml \ + test/integration/test_native_core_runtime.py + grep -q 'skipped="0"' native-core-runtime.xml diff --git a/test/integration/test_native_core_runtime.py b/test/integration/test_native_core_runtime.py index e96f23db..402befee 100644 --- a/test/integration/test_native_core_runtime.py +++ b/test/integration/test_native_core_runtime.py @@ -177,15 +177,16 @@ def test_send_event_is_non_blocking(native_core: Any) -> None: try: # Enqueueing 500 events measures a steady ~54 ms on the current shared # client (JSON -> wire encoding included), so the original 50 ms budget - # was simply below the real cost. A blocking send would wait for the - # runtime per event and cost orders of magnitude more, so a 5x margin - # still separates "enqueues" from "blocks". + # was simply below the real cost. Under CPU contention the same loop + # measured 255-286 ms (2 of 14 runs against a 250 ms budget), so the + # budget is 1 s: still far below a send that waits on the runtime per + # event, and it no longer flakes on a busy runner. events = [native_core.GovernanceEvent(make_audit_entry_payload(index)) for index in range(500)] start = time.perf_counter() for event in events: client.send_event(event) elapsed_ms = (time.perf_counter() - start) * 1000.0 - assert elapsed_ms < 250.0, elapsed_ms + assert elapsed_ms < 1000.0, elapsed_ms finally: client.close() server.close()