Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "GitAuto"
version = "1.1.5"
version = "1.1.7"
requires-python = ">=3.14"
dependencies = [
"annotated-doc==0.0.4",
Expand Down
72 changes: 36 additions & 36 deletions services/agents/test_verify_task_is_complete.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from services.agents.verify_task_is_complete import verify_task_is_complete
from services.eslint.run_eslint_fix import ESLintResult
from services.jest.run_jest_test import JestResult
from services.jest.run_js_ts_test import JsTsTestResult
from services.phpunit.run_phpunit_test import PhpunitResult
from services.prettier.run_prettier_fix import PrettierResult
from services.pytest.run_pytest_test import PytestResult
Expand Down Expand Up @@ -36,11 +36,11 @@ def mock_create_tsc_issue():

@pytest.fixture(autouse=True)
def mock_jest_test():
"""Auto-mock run_jest_test for all tests to prevent actual test execution."""
"""Auto-mock run_js_ts_test for all tests to prevent actual test execution."""
with patch(
"services.agents.verify_task_is_complete.run_jest_test",
"services.agents.verify_task_is_complete.run_js_ts_test",
new_callable=AsyncMock,
return_value=JestResult(
return_value=JsTsTestResult(
success=True,
errors=[],
error_files=set(),
Expand Down Expand Up @@ -518,7 +518,7 @@ async def test_verify_autofixes_ts_with_missing_braces_ignores_py(


@pytest.mark.asyncio
@patch("services.agents.verify_task_is_complete.run_jest_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_js_ts_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_tsc_check", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.read_local_file")
@patch("services.agents.verify_task_is_complete.get_pull_request_files")
Expand All @@ -532,7 +532,7 @@ async def test_verify_fails_when_jest_tests_fail(
]
mock_get_raw.return_value = "const x = 1;"
mock_tsc.return_value = TscResult(success=True, errors=[], error_files=set())
mock_jest.return_value = JestResult(
mock_jest.return_value = JsTsTestResult(
success=False,
errors=["FAIL src/index.test.js", "Expected true to be false"],
error_files={"src/index.test.js"},
Expand All @@ -549,7 +549,7 @@ async def test_verify_fails_when_jest_tests_fail(


@pytest.mark.asyncio
@patch("services.agents.verify_task_is_complete.run_jest_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_js_ts_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_tsc_check", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_eslint_fix")
@patch("services.agents.verify_task_is_complete.run_prettier_fix")
Expand Down Expand Up @@ -580,7 +580,7 @@ async def test_verify_error_files_collected_from_eslint_and_jest(
coverage_errors=None,
)
mock_tsc.return_value = TscResult(success=True, errors=[], error_files=set())
mock_jest.return_value = JestResult(
mock_jest.return_value = JsTsTestResult(
success=False,
errors=["FAIL src/index.test.js"],
error_files={"src/index.test.js"},
Expand All @@ -597,7 +597,7 @@ async def test_verify_error_files_collected_from_eslint_and_jest(

@pytest.mark.asyncio
@patch("services.agents.verify_task_is_complete.create_tsc_issue")
@patch("services.agents.verify_task_is_complete.run_jest_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_js_ts_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_tsc_check", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.get_pull_request_files")
async def test_baseline_tsc_errors_filtered(
Expand All @@ -620,7 +620,7 @@ async def test_baseline_tsc_errors_filtered(
errors=[pre_existing_error, new_error],
error_files={"src/passport-oidc.ts", "src/index.ts"},
)
mock_jest.return_value = JestResult(
mock_jest.return_value = JsTsTestResult(
success=True,
errors=[],
error_files=set(),
Expand All @@ -646,7 +646,7 @@ async def test_baseline_tsc_errors_filtered(

@pytest.mark.asyncio
@patch("services.agents.verify_task_is_complete.create_tsc_issue")
@patch("services.agents.verify_task_is_complete.run_jest_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_js_ts_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_tsc_check", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.get_pull_request_files")
async def test_all_tsc_errors_pre_existing_passes(
Expand All @@ -662,7 +662,7 @@ async def test_all_tsc_errors_pre_existing_passes(
errors=[pre_existing],
error_files={"src/old.ts"},
)
mock_jest.return_value = JestResult(
mock_jest.return_value = JsTsTestResult(
success=True,
errors=[],
error_files=set(),
Expand All @@ -683,7 +683,7 @@ async def test_all_tsc_errors_pre_existing_passes(

@pytest.mark.asyncio
@patch("services.agents.verify_task_is_complete.create_tsc_issue")
@patch("services.agents.verify_task_is_complete.run_jest_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_js_ts_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_tsc_check", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.get_pull_request_files")
async def test_baseline_tsc_errors_in_pr_files_still_reported(
Expand Down Expand Up @@ -713,7 +713,7 @@ async def test_baseline_tsc_errors_in_pr_files_still_reported(
errors=[pr_file_error],
error_files={"src/models/InProgressPolicy.test.ts"},
)
mock_jest.return_value = JestResult(
mock_jest.return_value = JsTsTestResult(
success=True,
errors=[],
error_files=set(),
Expand All @@ -739,7 +739,7 @@ async def test_baseline_tsc_errors_in_pr_files_still_reported(
return_value="// snapshot content",
)
@patch("services.agents.verify_task_is_complete.write_and_commit_file")
@patch("services.agents.verify_task_is_complete.run_jest_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_js_ts_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_tsc_check", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.read_local_file")
@patch("services.agents.verify_task_is_complete.os.listdir", return_value=[])
Expand All @@ -759,7 +759,7 @@ async def test_verify_commits_updated_snapshots(
]
mock_get_raw.return_value = "const x = 1;"
mock_tsc.return_value = TscResult(success=True, errors=[], error_files=set())
mock_jest.return_value = JestResult(
mock_jest.return_value = JsTsTestResult(
success=True,
errors=[],
error_files=set(),
Expand Down Expand Up @@ -797,7 +797,7 @@ async def test_verify_commits_updated_snapshots(

@pytest.mark.asyncio
@patch("services.agents.verify_task_is_complete.create_tsc_issue")
@patch("services.agents.verify_task_is_complete.run_jest_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_js_ts_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_tsc_check", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.get_pull_request_files")
async def test_new_pr_handler_error_in_pr_file_reported(
Expand All @@ -818,7 +818,7 @@ async def test_new_pr_handler_error_in_pr_file_reported(
errors=[pr_file_error],
error_files={"src/utils.ts"},
)
mock_jest.return_value = JestResult(
mock_jest.return_value = JsTsTestResult(
success=True,
errors=[],
error_files=set(),
Expand All @@ -838,7 +838,7 @@ async def test_new_pr_handler_error_in_pr_file_reported(

@pytest.mark.asyncio
@patch("services.agents.verify_task_is_complete.create_tsc_issue")
@patch("services.agents.verify_task_is_complete.run_jest_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_js_ts_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_tsc_check", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.get_pull_request_files")
async def test_new_pr_handler_preexisting_non_pr_file_error_skipped(
Expand All @@ -859,7 +859,7 @@ async def test_new_pr_handler_preexisting_non_pr_file_error_skipped(
errors=[preexisting],
error_files={"src/legacy.ts"},
)
mock_jest.return_value = JestResult(
mock_jest.return_value = JsTsTestResult(
success=True,
errors=[],
error_files=set(),
Expand All @@ -880,7 +880,7 @@ async def test_new_pr_handler_preexisting_non_pr_file_error_skipped(

@pytest.mark.asyncio
@patch("services.agents.verify_task_is_complete.create_tsc_issue")
@patch("services.agents.verify_task_is_complete.run_jest_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_js_ts_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_tsc_check", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.get_pull_request_files")
async def test_new_pr_handler_new_non_pr_file_error_reported(
Expand All @@ -901,7 +901,7 @@ async def test_new_pr_handler_new_non_pr_file_error_reported(
errors=[new_error],
error_files={"src/consumer.ts"},
)
mock_jest.return_value = JestResult(
mock_jest.return_value = JsTsTestResult(
success=True,
errors=[],
error_files=set(),
Expand All @@ -924,7 +924,7 @@ async def test_new_pr_handler_new_non_pr_file_error_reported(

@pytest.mark.asyncio
@patch("services.agents.verify_task_is_complete.create_tsc_issue")
@patch("services.agents.verify_task_is_complete.run_jest_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_js_ts_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_tsc_check", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.get_pull_request_files")
async def test_check_suite_error_in_pr_file_in_baseline_reported(
Expand Down Expand Up @@ -954,7 +954,7 @@ async def test_check_suite_error_in_pr_file_in_baseline_reported(
errors=[pr_file_error],
error_files={"src/models/Policy.test.ts"},
)
mock_jest.return_value = JestResult(
mock_jest.return_value = JsTsTestResult(
success=True,
errors=[],
error_files=set(),
Expand All @@ -976,7 +976,7 @@ async def test_check_suite_error_in_pr_file_in_baseline_reported(

@pytest.mark.asyncio
@patch("services.agents.verify_task_is_complete.create_tsc_issue")
@patch("services.agents.verify_task_is_complete.run_jest_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_js_ts_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_tsc_check", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.get_pull_request_files")
async def test_check_suite_preexisting_non_pr_file_error_skipped(
Expand All @@ -1002,7 +1002,7 @@ async def test_check_suite_preexisting_non_pr_file_error_skipped(
errors=[preexisting],
error_files={"src/passport-oidc.ts"},
)
mock_jest.return_value = JestResult(
mock_jest.return_value = JsTsTestResult(
success=True,
errors=[],
error_files=set(),
Expand All @@ -1024,7 +1024,7 @@ async def test_check_suite_preexisting_non_pr_file_error_skipped(

@pytest.mark.asyncio
@patch("services.agents.verify_task_is_complete.create_tsc_issue")
@patch("services.agents.verify_task_is_complete.run_jest_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_js_ts_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_tsc_check", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.get_pull_request_files")
async def test_check_suite_new_non_pr_file_error_reported(
Expand All @@ -1050,7 +1050,7 @@ async def test_check_suite_new_non_pr_file_error_reported(
errors=[new_error],
error_files={"src/auth.ts"},
)
mock_jest.return_value = JestResult(
mock_jest.return_value = JsTsTestResult(
success=True,
errors=[],
error_files=set(),
Expand All @@ -1074,7 +1074,7 @@ async def test_check_suite_new_non_pr_file_error_reported(

@pytest.mark.asyncio
@patch("services.agents.verify_task_is_complete.create_tsc_issue")
@patch("services.agents.verify_task_is_complete.run_jest_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_js_ts_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_tsc_check", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.get_pull_request_files")
async def test_review_run_error_in_pr_file_in_baseline_reported(
Expand All @@ -1098,7 +1098,7 @@ async def test_review_run_error_in_pr_file_in_baseline_reported(
errors=[pr_file_error],
error_files={"src/components/Form.tsx"},
)
mock_jest.return_value = JestResult(
mock_jest.return_value = JsTsTestResult(
success=True,
errors=[],
error_files=set(),
Expand All @@ -1118,7 +1118,7 @@ async def test_review_run_error_in_pr_file_in_baseline_reported(

@pytest.mark.asyncio
@patch("services.agents.verify_task_is_complete.create_tsc_issue")
@patch("services.agents.verify_task_is_complete.run_jest_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_js_ts_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_tsc_check", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.get_pull_request_files")
async def test_review_run_preexisting_non_pr_file_error_skipped(
Expand All @@ -1138,7 +1138,7 @@ async def test_review_run_preexisting_non_pr_file_error_skipped(
errors=[preexisting],
error_files={"src/legacy-auth.ts"},
)
mock_jest.return_value = JestResult(
mock_jest.return_value = JsTsTestResult(
success=True,
errors=[],
error_files=set(),
Expand All @@ -1159,7 +1159,7 @@ async def test_review_run_preexisting_non_pr_file_error_skipped(

@pytest.mark.asyncio
@patch("services.agents.verify_task_is_complete.create_tsc_issue")
@patch("services.agents.verify_task_is_complete.run_jest_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_js_ts_test", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.run_tsc_check", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_complete.get_pull_request_files")
async def test_review_run_new_non_pr_file_error_reported(
Expand All @@ -1179,7 +1179,7 @@ async def test_review_run_new_non_pr_file_error_reported(
errors=[new_error],
error_files={"src/validators.ts"},
)
mock_jest.return_value = JestResult(
mock_jest.return_value = JsTsTestResult(
success=True,
errors=[],
error_files=set(),
Expand Down Expand Up @@ -1442,9 +1442,9 @@ async def test_quality_gate_runs_when_fail_count_below_3(

@pytest.mark.asyncio
@patch(
"services.agents.verify_task_is_complete.run_jest_test",
"services.agents.verify_task_is_complete.run_js_ts_test",
new_callable=AsyncMock,
return_value=JestResult(
return_value=JsTsTestResult(
success=False,
errors=["Segmentation fault (core dumped)"],
error_files={"src/test.test.ts"},
Expand Down
12 changes: 6 additions & 6 deletions services/agents/test_verify_task_is_ready.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from services.agents.verify_task_is_ready import verify_task_is_ready
from services.eslint.run_eslint_fix import ESLintResult
from services.jest.run_jest_test import JestResult
from services.jest.run_js_ts_test import JsTsTestResult
from services.prettier.run_prettier_fix import PrettierResult
from services.tsc.run_tsc_check import TscResult

Expand Down Expand Up @@ -286,7 +286,7 @@ async def test_run_tsc_reports_type_errors(


@pytest.mark.asyncio
@patch("services.agents.verify_task_is_ready.run_jest_test")
@patch("services.agents.verify_task_is_ready.run_js_ts_test")
@patch("services.agents.verify_task_is_ready.git_commit_and_push")
@patch("services.agents.verify_task_is_ready.run_eslint_fix", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_ready.run_prettier_fix", new_callable=AsyncMock)
Expand All @@ -306,7 +306,7 @@ async def test_run_jest_reports_test_failures(
mock_eslint.return_value = ESLintResult(
success=True, content=None, lint_errors=None, coverage_errors=None
)
mock_jest.return_value = JestResult(
mock_jest.return_value = JsTsTestResult(
success=False,
errors=["FAIL src/index.test.ts", "Expected true to be false"],
error_files={"src/index.test.ts"},
Expand All @@ -326,7 +326,7 @@ async def test_run_jest_reports_test_failures(


@pytest.mark.asyncio
@patch("services.agents.verify_task_is_ready.run_jest_test")
@patch("services.agents.verify_task_is_ready.run_js_ts_test")
@patch("services.agents.verify_task_is_ready.git_commit_and_push")
@patch("services.agents.verify_task_is_ready.run_eslint_fix", new_callable=AsyncMock)
@patch("services.agents.verify_task_is_ready.run_prettier_fix", new_callable=AsyncMock)
Expand All @@ -339,7 +339,7 @@ async def test_impl_files_excluded_from_jest(
mock_jest,
create_test_base_args,
):
"""Impl files must NOT be passed to run_jest_test at all.
"""Impl files must NOT be passed to run_js_ts_test at all.

Previously all JS/TS files were passed as test_file_paths, causing
jest --findRelatedTests on impl files which OOMed Lambda for MongoDB repos.
Expand All @@ -351,7 +351,7 @@ async def test_impl_files_excluded_from_jest(
mock_eslint.return_value = ESLintResult(
success=True, content=None, lint_errors=None, coverage_errors=None
)
mock_jest.return_value = JestResult()
mock_jest.return_value = JsTsTestResult()

base_args = create_test_base_args()
await verify_task_is_ready(
Expand Down
6 changes: 3 additions & 3 deletions services/agents/verify_task_is_complete.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from services.github.pulls.get_pull_request_files import get_pull_request_files
from services.types.base_args import BaseArgs
from services.jest.format_coverage_comment import format_coverage_comment
from services.jest.run_jest_test import run_jest_test
from services.jest.run_js_ts_test import run_js_ts_test
from services.node.detect_node_version import detect_node_version
from services.node.ensure_jest_timeout_for_ci import ensure_jest_timeout_for_ci
from services.node.ensure_jest_uses_tsconfig_for_tests import (
Expand Down Expand Up @@ -252,14 +252,14 @@ async def verify_task_is_complete(
)
create_tsc_issue(base_args=base_args, unrelated_errors=unrelated_tsc_errors)

# Set by new_pr_handler for schedule PRs so run_jest_test collects coverage using Istanbul instead of V8.
# Set by new_pr_handler for schedule PRs so run_js_ts_test collects coverage using Istanbul instead of V8.
impl_file_to_collect_coverage_from = base_args.get(
"impl_file_to_collect_coverage_from", ""
)

# Always pass source files so jest --findRelatedTests can discover dependent tests
# (e.g., dead code removal from a source file may break tests not in the PR).
jest_result = await run_jest_test(
jest_result = await run_js_ts_test(
base_args=base_args,
test_file_paths=js_test_files,
source_file_paths=[f for f in js_ts_files if is_source_file(f)],
Expand Down
Loading
Loading