kin: auto-commit after pipeline
This commit is contained in:
parent
824341a972
commit
e3a286ef6f
5 changed files with 1598 additions and 6 deletions
|
|
@ -826,7 +826,7 @@ _WORKTREE_ROLES = {"backend_dev", "frontend_dev", "debugger"}
|
|||
_DEV_GUARD_ROLES = {"backend_dev", "frontend_dev", "debugger"}
|
||||
|
||||
|
||||
def _detect_test_command(project_path: str) -> str | None:
|
||||
def _detect_test_command(project_path: str, role: str | None = None) -> str | None:
|
||||
"""Auto-detect test command by inspecting project files.
|
||||
|
||||
Candidates (in priority order):
|
||||
|
|
@ -835,10 +835,22 @@ def _detect_test_command(project_path: str) -> str | None:
|
|||
3. pytest — pyproject.toml or setup.py exists
|
||||
4. npx tsc --noEmit — tsconfig.json exists
|
||||
|
||||
When role='backend_dev' and a Python project marker (pyproject.toml / setup.py)
|
||||
is present, pytest is returned directly — bypassing make test. This prevents
|
||||
false-positive failures in mixed projects whose Makefile test target also runs
|
||||
frontend (e.g. vitest) commands that may be unrelated to backend changes.
|
||||
|
||||
Returns the first matching command, or None if no framework is detected.
|
||||
"""
|
||||
path = Path(project_path)
|
||||
|
||||
# For backend_dev: Python project marker takes precedence over Makefile.
|
||||
# Rationale: make test in mixed projects often runs frontend tests too;
|
||||
# backend changes should only be validated by the Python test runner.
|
||||
if role == "backend_dev":
|
||||
if (path / "pyproject.toml").is_file() or (path / "setup.py").is_file():
|
||||
return f"{sys.executable} -m pytest"
|
||||
|
||||
# 1. make test
|
||||
makefile = path / "Makefile"
|
||||
if makefile.is_file():
|
||||
|
|
@ -1882,7 +1894,7 @@ def run_pipeline(
|
|||
if p_test_cmd_override:
|
||||
p_test_cmd = p_test_cmd_override
|
||||
else:
|
||||
p_test_cmd = _detect_test_command(p_path_str)
|
||||
p_test_cmd = _detect_test_command(p_path_str, role=role)
|
||||
|
||||
if p_test_cmd is None:
|
||||
# No test framework detected — skip without blocking pipeline
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue