From 5f3d43ff96b3e7fa95bfb345de592281197ffa57 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Fri, 19 Jun 2026 14:35:10 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=85=20(test):=20Gate=20audit-wire=20i?= =?UTF-8?q?mport-error=20tests=20on=20native-core-absent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The to_wire_bytes / from_wire_bytes import-error guards only fire in pure-Python mode where the native _core extension is absent. Skip them when _core is present so they pass on both CI matrices (AAASM-3435). Co-Authored-By: Claude Opus 4.8 (1M context) --- test/unit/test_types_audit_event.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/unit/test_types_audit_event.py b/test/unit/test_types_audit_event.py index 1c9f457..cb0fe64 100644 --- a/test/unit/test_types_audit_event.py +++ b/test/unit/test_types_audit_event.py @@ -11,6 +11,15 @@ import pytest from agent_assembly import AuditEvent, CallStackNode +from agent_assembly.core.runtime_interceptor import _native_core_available + +# The native `_core` extension implements the wire codec; these import-error +# guards only fire in pure-Python mode where it is absent (AAASM-3435). +_NATIVE_CORE_PRESENT = _native_core_available() +_requires_no_native_core = pytest.mark.skipif( + _NATIVE_CORE_PRESENT, + reason="native `_core` is present; the import-error path only exists without it", +) def test_call_stack_node_required_fields() -> None: @@ -98,6 +107,7 @@ def test_top_level_imports_resolve_to_types_module() -> None: assert CallStackNode is TypesCallStackNode +@_requires_no_native_core def test_to_wire_bytes_raises_helpful_import_error_without_native_core() -> None: """In pure-Python mode the native `_core` extension is absent, so the encode path raises ImportError with a maturin/reinstall hint.""" @@ -110,6 +120,7 @@ def test_to_wire_bytes_raises_helpful_import_error_without_native_core() -> None assert "maturin develop" in message +@_requires_no_native_core def test_from_wire_bytes_raises_helpful_import_error_without_native_core() -> None: """The decode path raises the same kind of guidance when `_core` is absent.""" with pytest.raises(ImportError) as exc_info: From 3891a0cbe2e4de73ed8c1c3f456f4c5c0b9b0c2a Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Fri, 19 Jun 2026 14:35:21 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9C=85=20(test):=20Stub=20native-core=20?= =?UTF-8?q?in=20enforce-mode=20forwarding=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With _core present, enforce mode triggered the AAASM-3402 native gRPC registration which fails-closed without a live gateway. Force the pure-Python path so the test only asserts enforcement-mode forwarding, regardless of whether _core is built (AAASM-3435). Co-Authored-By: Claude Opus 4.8 (1M context) --- test/unit/test_assembly.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/unit/test_assembly.py b/test/unit/test_assembly.py index beeafbc..5067110 100644 --- a/test/unit/test_assembly.py +++ b/test/unit/test_assembly.py @@ -578,6 +578,11 @@ def test_init_assembly_enforcement_mode_forwarded_to_client( mode: str, ) -> None: """All three valid EnforcementMode values land on the GatewayClient.""" + # Force the pure-Python path so `enforce` does not trigger the AAASM-3402 + # native gRPC registration (which would fail-closed without a live gateway). + # This keeps the test focused on enforcement-mode forwarding regardless of + # whether the native `_core` extension is built (AAASM-3435). + monkeypatch.setattr(core_assembly, "_native_core_available", lambda: False) monkeypatch.setattr(core_assembly, "_register_adapters", lambda **kwargs: []) monkeypatch.setattr( core_assembly,