From 6ee7d9e33a9010e2b25de161547e019a7acd8fdb Mon Sep 17 00:00:00 2001 From: Tristan Simas Date: Sat, 24 Oct 2026 22:00:27 -0400 Subject: [PATCH] Build the surrogate probe with chr so mypy can cache it CPythonClassConstructionField.DOCUMENTATION probed CPython with the literal "\ud800". Since py.typed, mypy analyses NRA for its users, infers Literal['\ud800'] for the enum value and crashes writing it to its UTF-8 cache (mypy 2.3.0, INTERNAL ERROR in cache.write_literal), which took agent-comms' TypeErrors measure down. chr(0xD800) is the same value and types as str. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Q8rVa3cPyXzpCKyR8XvM8W --- nominal_refactor_advisor/native_compilation.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nominal_refactor_advisor/native_compilation.py b/nominal_refactor_advisor/native_compilation.py index 223e2b8d..c58b068d 100644 --- a/nominal_refactor_advisor/native_compilation.py +++ b/nominal_refactor_advisor/native_compilation.py @@ -4196,7 +4196,9 @@ def __new__( SLOTS = "__slots__" CLASS_CELL = "__classcell__" CLASS_DICTIONARY_CELL = "__classdictcell__" - DOCUMENTATION = "__doc__", _require_documentation, "\ud800" + # A lone surrogate, which no text encoding accepts. Built by chr so type checkers + # infer str: mypy 2.3 crashes writing the literal '\ud800' to its UTF-8 cache. + DOCUMENTATION = "__doc__", _require_documentation, chr(0xD800) @cached_property def native_active(self) -> bool: