From fe50f9daed35151134f79b767733d4be8093e325 Mon Sep 17 00:00:00 2001 From: Tejas Chopra Date: Thu, 4 Jun 2026 14:15:49 -0700 Subject: [PATCH] fix(ci): restore green lint gate on main Merges of #564/#555 landed lint regressions that the old HF-429-masked CI hid: - I001 unsorted imports in tests/repro_unsendable_panic.py (#564) - ruff-format drift in helpers.py and code_compressor.py - mypy arg-type on get_language() in code_compressor.py (#564 dropped the type: ignore the old get_parser() call had) ruff check + ruff format --check + mypy headroom all green. --- headroom/proxy/helpers.py | 4 +--- headroom/transforms/code_compressor.py | 8 ++++++-- tests/repro_unsendable_panic.py | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/headroom/proxy/helpers.py b/headroom/proxy/helpers.py index 7c8696f7e..c34ec04ed 100644 --- a/headroom/proxy/helpers.py +++ b/headroom/proxy/helpers.py @@ -841,9 +841,7 @@ def decide_compression_failure_action( frame_bytes=frame_bytes, ) - if (client or "").strip().lower() == "codex" and isinstance( - exception, asyncio.TimeoutError - ): + if (client or "").strip().lower() == "codex" and isinstance(exception, asyncio.TimeoutError): return CompressionFailureAction( refuse=False, reason="client_override:codex", diff --git a/headroom/transforms/code_compressor.py b/headroom/transforms/code_compressor.py index c7ab74e98..13b4a8e31 100644 --- a/headroom/transforms/code_compressor.py +++ b/headroom/transforms/code_compressor.py @@ -117,7 +117,9 @@ def _get_parser(language: str) -> Any: from tree_sitter_language_pack import get_language parser = Parser() - parser.language = get_language(language) + # `language` is a validated runtime str; get_language types its arg + # as a Literal of supported names, which a dynamic str can't satisfy. + parser.language = get_language(language) # type: ignore[arg-type] parsers[language] = parser logger.debug( "Loaded tree-sitter parser for %s (thread %s)", @@ -163,7 +165,9 @@ def unload_tree_sitter() -> bool: if parsers: count = len(parsers) parsers.clear() - logger.info("Unloaded %d tree-sitter parsers (thread %s)", count, threading.current_thread().name) + logger.info( + "Unloaded %d tree-sitter parsers (thread %s)", count, threading.current_thread().name + ) return True return False diff --git a/tests/repro_unsendable_panic.py b/tests/repro_unsendable_panic.py index 100843fa9..52296899d 100644 --- a/tests/repro_unsendable_panic.py +++ b/tests/repro_unsendable_panic.py @@ -12,8 +12,8 @@ Usage: python repro_unsendable_panic.py """ -import threading import concurrent.futures +import threading CODE = b"def hello():\n return 42\n"