[AAASM-3435] ✅ (python-sdk): Gate native-core-absent test guards#148
Merged
Conversation
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) <noreply@anthropic.com>
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) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Chisanan232
commented
Jun 19, 2026
Chisanan232
left a comment
Contributor
Author
There was a problem hiding this comment.
Claude Code — PR review (AAASM-3435)
Verdict: ✅ ready to merge. CI green; test-only (2 files), no product code touched.
- Reuses the codebase's own
_native_core_availabledetector — correct, no new ad-hoc probing. ✅ - Wire-codec import-error tests now
skipif(_native_core_available())— they only assert the ImportError path when_coreis genuinely absent. ✅ - Enforce-mode forwarding test stubs
_native_core_available → Falseso it verifies enforcement-mode forwarding without firing the AAASM-3402 native gRPC registration (which fail-closes without a live gateway). ✅ - Verified RED-before / GREEN-after with
_corebuilt: 39 passed, 2 (correctly) skipped.
Pre-existing ARG002/ARG005 ruff warnings on test_assembly.py are from the existing mock pattern on master, not introduced here. Good to merge.
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.



Description
Three unit tests assumed the native PyO3
_coreextension is absent (CI's pure-Python matrix). When_coreIS built, they failed:test_init_assembly_enforcement_mode_forwarded_to_client[enforce]— monkeypatched adapters/network but not the AAASM-3402 native registration, soenforcefired a real gRPC registration → fail-closed →ConfigurationError.test_to_wire_bytes_raises_helpful_import_error_without_native_core/test_from_wire_bytes_...— asserted anImportErrorthat only occurs when_coreis absent (with_corepresent the wire codec runs).This PR makes the three tests pass regardless of whether
_coreis importable. Test-only changes; no product code touched.@pytest.mark.skipif(_native_core_available(), ...)(reusing the codebase's ownagent_assembly.core.runtime_interceptor._native_core_availabledetector) so they only assert the import-error path when_coreis genuinely absent.monkeypatch.setattr(core_assembly, "_native_core_available", lambda: False)) so it still asserts enforcement-mode forwarding to the client without performing a live gateway connect.Type of Change
Breaking Changes
Related Issues
Testing
Reproduced with
maturin develop(native_corepresent) on macOS:gRPC endpoint unreachable for registration;DID NOT RAISE ImportError;invalid tag value: 0).test/unit/test_assembly.py test/unit/test_types_audit_event.py→ 39 passed, 2 skipped (the 3 target tests now pass: enforce-mode forwards for all 3 modes; the two wire-codec guards correctly skip when_coreis present). The skipif path still asserts the import-error behavior when_coreis absent.ruff format,mypy, andpre-commit run --all-filesclean on touched files.Checklist
Closes AAASM-3435
🤖 Generated with Claude Code