From 63611caec063172116d4094748d7909f5d0f3022 Mon Sep 17 00:00:00 2001 From: Rohit Behera <126186063+r0h1tb@users.noreply.github.com> Date: Sun, 2 Aug 2026 00:17:42 +0530 Subject: [PATCH] =?UTF-8?q?fix(ci):=20restore=20green=20CI=20=E2=80=94=20p?= =?UTF-8?q?in=20lint=20rules,=20repair=20two=20stale=20test=20assumptions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI has been failing since 2026-07-27 and, because `ruff check` runs before `pytest`, the "Run tests" step has been *skipped* ever since. The suite has not actually executed in CI for a week. Three independent causes: 1. `[tool.ruff]` set only target-version and line-length, never `select`, so ruff applied whatever its current default rule set was. A newer ruff (0.16.x) widened that default and the tree suddenly reported 496 findings with no code change -- 321 of them UP045 alone. Verified by running today's ruff against 16ae8bd, the last commit whose CI run was green: it also reports 496. Pinning `select = ["E4","E7","E9","F"]` -- the rules the tree is clean under -- makes lint deterministic across ruff releases. 2. `mcp` 2.0 renamed `FastMCP` to `MCPServer` and moved it out of `mcp.server.fastmcp`, so `ast_rag/mcp/server.py` failed to import and took both tests in test_update_project_dry_run.py with it. `mcp>=1.0` is unpinned, so fresh installs get 2.x. Imports the new name with a fallback to the old one; `MCPServer` is API-compatible for the `.tool()` decorator usage here. 3. test_supported_extensions_grouped_by_language still asserted `typescript == [".ts", ".tsx"]`, but cd75313 deliberately moved .tsx onto a dedicated TSX grammar and added .jsx to it. The code is correct and the assertion was stale; it now pins the intended grouping, including .jsx. Local run of all three CI steps on this branch: ruff check ast_rag/ All checks passed! pytest tests/ 176 passed, 1 skipped, 2 xfailed ruff format --check 75 files already formatted On main the same three steps give 496 lint errors, and 3 failed / 174 passed. No production behaviour changes; this is CI configuration plus two test/import corrections. --- ast_rag/mcp/server.py | 6 +++++- pyproject.toml | 7 +++++++ tests/test_unsupported_language.py | 5 ++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ast_rag/mcp/server.py b/ast_rag/mcp/server.py index 3e406ba..945f2fe 100644 --- a/ast_rag/mcp/server.py +++ b/ast_rag/mcp/server.py @@ -28,7 +28,11 @@ from pathlib import Path from typing import Optional -from mcp.server.fastmcp import FastMCP +try: + # mcp >= 2.0 renamed FastMCP to MCPServer and moved it to mcp.server + from mcp.server import MCPServer as FastMCP +except ImportError: # pragma: no cover - mcp < 2.0 + from mcp.server.fastmcp import FastMCP from ast_rag.models import ProjectConfig, StandardResult from ast_rag.repositories import create_driver, apply_schema diff --git a/pyproject.toml b/pyproject.toml index 0b60b19..070f25b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,6 +77,13 @@ ast_rag = ["../schema/*.cql"] target-version = "py310" line-length = 100 +[tool.ruff.lint] +# Pin the rule set explicitly. Without this ruff applies whatever its current +# default happens to be, so a new ruff release changes what CI enforces with no +# code change -- which is what took CI red on 2026-07-27 (321 of the 496 new +# findings were UP045 alone). These four are the rules the tree is clean under. +select = ["E4", "E7", "E9", "F"] + [tool.mypy] python_version = "3.10" strict = false diff --git a/tests/test_unsupported_language.py b/tests/test_unsupported_language.py index ad97a5f..a1c54f2 100644 --- a/tests/test_unsupported_language.py +++ b/tests/test_unsupported_language.py @@ -46,7 +46,10 @@ def test_supported_extensions_covers_all_mapped(self) -> None: def test_supported_extensions_grouped_by_language(self) -> None: mapping = supported_extensions() assert mapping["java"] == [".java"] - assert mapping["typescript"] == [".ts", ".tsx"] + # cd75313 moved .tsx onto a dedicated TSX grammar and added .jsx to it, + # so .tsx is no longer grouped under "typescript". + assert mapping["typescript"] == [".ts"] + assert mapping["tsx"] == [".jsx", ".tsx"] assert ".cpp" in mapping["cpp"] assert ".h" in mapping["cpp"]