fix(ci): master Test workflow green on Python 3.12 and ubuntu-26.04
🧪 Test / 🧪 Lock + lint (push) Waiting to run
🧪 Test / 🧪 Lock + lint (push) Waiting to run
- CI installs PyYAML (new dependency group test) so the staged-diff secret rules load; the Update workflow also installs the orchestrator requirements - operator.py: termios.IUTF8 falls back to 0o40000 on Python 3.12, where the terminal prompt crashed with AttributeError - operator.py: the run preview trusts filters of the system and global git config (git-lfs on runner images) and stays off for repo or command filters, and when git cannot name a filter's scope - test_radio feeds the listener its stdin through an own pipe, since 3.12 communicate() flushes a closed proc.stdin - test_hub_match_content gives the runner a MEDUSA rules home instead of the host's - test_queue_hung uses a script named docker, since a multicall sleep refuses that name 🎯 Fix: 93 % 💥 Break: 3 % 💸 Tokens: – ⏱️ Velocity: – 🛡️ Security: 100 % 🏆 Score: 90 🚦 Gate: ✅ 90/5, tokens and velocity <= 100, security 100 % Created-with: https://s.veen.world/skills Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d3bc54f401
commit
888ebb40af
8 files changed
+71
-25
No files matched your search
+34
-2
@@ -3,6 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import http.server
|
||||
import importlib.util
|
||||
import json
|
||||
import os
|
||||
import pty
|
||||
@@ -21,6 +22,9 @@ from pathlib import Path
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
OPERATOR = REPO_ROOT / "skills" / "kvb-org-operator" / "scripts" / "operator.py"
|
||||
OPERATOR_SPEC = importlib.util.spec_from_file_location("kvb_operator_for_terminal", OPERATOR)
|
||||
operator_script = importlib.util.module_from_spec(OPERATOR_SPEC)
|
||||
OPERATOR_SPEC.loader.exec_module(operator_script)
|
||||
RASCI = REPO_ROOT / "skills" / "kvb-org-rasci" / "scripts" / "rasci.py"
|
||||
HEADER = "| # | Directory | Command | Why | Check |"
|
||||
RUNNER = ["", "Every step with preview and yes/skip:", "```bash", f"python3 {OPERATOR} run", "```"]
|
||||
@@ -138,7 +142,7 @@ class TestOperator(unittest.TestCase):
|
||||
|
||||
@staticmethod
|
||||
def _iutf8(leader: int) -> bool:
|
||||
return bool(termios.tcgetattr(leader)[0] & termios.IUTF8)
|
||||
return bool(termios.tcgetattr(leader)[0] & operator_script.IUTF8)
|
||||
|
||||
def _terminal(self, args: list[str], steps: list[tuple[bytes, bytes | signal.Signals]]) -> tuple[int, str, list[bool]]:
|
||||
"""Args:
|
||||
@@ -155,7 +159,7 @@ class TestOperator(unittest.TestCase):
|
||||
leader, follower = pty.openpty()
|
||||
self.addCleanup(os.close, leader)
|
||||
mode = termios.tcgetattr(follower)
|
||||
termios.tcsetattr(follower, termios.TCSANOW, [mode[0] & ~termios.IUTF8, *mode[1:]])
|
||||
termios.tcsetattr(follower, termios.TCSANOW, [mode[0] & ~operator_script.IUTF8, *mode[1:]])
|
||||
try:
|
||||
child = subprocess.Popen(
|
||||
[sys.executable, str(OPERATOR), *args], stdin=follower, stdout=follower, stderr=follower,
|
||||
@@ -670,6 +674,34 @@ class TestOperator(unittest.TestCase):
|
||||
self.assertNotIn("?? 2", result.stdout)
|
||||
self.assertFalse(marker.exists())
|
||||
|
||||
def test_run_preview_trusts_a_filter_of_the_system_and_the_global_config(self):
|
||||
system = self.base / "gitconfig"
|
||||
system.write_text('[filter "lfs"]\n\tclean = cat\n', encoding="utf-8")
|
||||
(self.home / ".gitconfig").write_text('[filter "own"]\n\tclean = cat\n', encoding="utf-8")
|
||||
self.env["GIT_CONFIG_SYSTEM"] = str(system)
|
||||
repo = self._repo("lfs", upstream=False)
|
||||
(repo / "one").write_text("changed", encoding="utf-8")
|
||||
self._add("lfs", repo, "true", "r", "manual")
|
||||
result = self._feed("s\n")
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
self.assertIn(" M one", result.stdout)
|
||||
self.assertNotIn("(nothing to compare)", result.stdout)
|
||||
|
||||
def test_run_preview_stays_off_when_git_cannot_name_the_scope_of_a_filter(self):
|
||||
marker = self.base / "ran"
|
||||
git = self.bin / "git"
|
||||
git.write_text(f'#!/bin/sh\ncase " $* " in *" --show-scope "*) exit 129;; esac\nexec {shutil.which("git")} "$@"\n', encoding="utf-8")
|
||||
git.chmod(0o755)
|
||||
repo = self._repo("old", upstream=False)
|
||||
self._git(repo, "config", "filter.x.clean", f"touch {marker}")
|
||||
(repo / ".gitattributes").write_text("* filter=x\n", encoding="utf-8")
|
||||
(repo / "one").write_text("changed", encoding="utf-8")
|
||||
self._add("old", repo, "true", "r", "manual")
|
||||
result = self._feed("s\n")
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
self.assertIn("(nothing to compare)", result.stdout)
|
||||
self.assertFalse(marker.exists())
|
||||
|
||||
def test_list_and_preview_never_fetch_a_missing_object(self):
|
||||
marker = self.base / "fetched"
|
||||
repo = self._repo("lazy", upstream=True)
|
||||
|
||||
Reference in new issue
Block a user