Skip to content

[Chore] ChatGPT 코드 리뷰 워크플로우 및 pytest CI 제거#70

Merged
zweadfx merged 1 commit intomainfrom
chore/remove-ci-workflows
Mar 17, 2026
Merged

[Chore] ChatGPT 코드 리뷰 워크플로우 및 pytest CI 제거#70
zweadfx merged 1 commit intomainfrom
chore/remove-ci-workflows

Conversation

@zweadfx
Copy link
Copy Markdown
Owner

@zweadfx zweadfx commented Mar 17, 2026

어떤 변경사항인가요?

#63에서 추가한 pytest CI 워크플로우(test.yml)와 #67에서 추가한 테스트 mock 코드를 제거합니다.
CodeRabbit이 코드 리뷰를 대체하므로 ChatGPT 리뷰(cr.yml)로 인한 OpenAI API 비용이 불필요하며, pytest CI는 외부 의존성 문제로 정상 동작하지 않아 롤백합니다.

작업 상세 내용

체크리스트

  • self-test를 수행하였는가?
  • 관련 문서나 주석을 업데이트하였는가?
  • 설정한 코딩 컨벤션을 준수하였는가?

관련 이슈

리뷰 포인트

참고사항 및 스크린샷(선택)

Summary by CodeRabbit

  • Tests
    • Removed the GitHub Actions continuous integration test workflow.
    • Simplified test fixtures across multiple test suites by eliminating unnecessary mocks.
    • Refactored tests to use direct service instantiation instead of mocked dependencies.
    • Reduced test infrastructure complexity while maintaining existing test coverage.

@zweadfx zweadfx self-assigned this Mar 17, 2026
@zweadfx zweadfx added the chore 실제 코드나 기능과는 직접적인 연관이 없는 설정 작업을 의미합니다. label Mar 17, 2026
@zweadfx zweadfx linked an issue Mar 17, 2026 that may be closed by this pull request
3 tasks
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 17, 2026

📝 Walkthrough

Walkthrough

Removed the GitHub Actions test workflow and simplified test infrastructure by eliminating mock fixtures for ChromaDB and embeddings. Tests now use real service instances directly instead of mocked data, reducing test coupling and simplifying test setup across multiple test modules.

Changes

Cohort / File(s) Summary
CI/CD Workflow
.github/workflows/test.yml
Deleted the complete GitHub Actions workflow that ran pytest on pull requests, including checkout, Python 3.12 setup, uv sync, test execution, and test reporting steps.
Test Infrastructure
tests/conftest.py
Removed the autouse pytest fixture that auto-mocked OpenAI embedding calls (src.services.rag.embedding.generate_embeddings) with dummy 1536-dimension vectors.
Gear Advisor Tests
tests/test_gear_advisor.py
Eliminated mock ChromaDB fixtures and gear data; simplified shoe_retriever_instance to remove mock_chroma dependency; removed mock_gear_agent fixture entirely; updated API test signatures to drop mock_gear_agent parameter; added position and budget filtering assertions.
Skill Lab Tests
tests/test_skill_lab.py
Removed fake drill data and mock_drills fixture; now imports and uses chroma_manager directly; updated test methods to call chroma_manager.query_drills() instead of mocked _fake_query_drills().
Whistle Tests
tests/test_whistle.py
Eliminated fake ChromaDB data, mock fixtures, and rule_retriever_instance fixture; tests now instantiate RuleRetriever() directly within each test body instead of using fixture injection.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related issues

Possibly related PRs

Poem

🐰 Mocks and fixtures fade away,
Real services now hold the day,
Tests grow lean, the setup's light,
ChromaDB and embeddings run right!
Simplicity wins—hooray, hooray! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly indicates removal of ChatGPT code review workflow and pytest CI, which aligns with the main objectives of deleting the test workflow, conftest, and reverting test files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/remove-ci-workflows
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/test_gear_advisor.py (1)

244-286: ⚠️ Potential issue | 🟠 Major

API endpoint tests now make real OpenAI API calls - likely unintended.

The mock_gear_agent fixture was removed, but unlike test_whistle.py (which retains mock_judge) and test_skill_lab.py (which retains mock_coach), this file no longer mocks the LLM invocation for API tests.

Based on the context snippets, gear_agent_graph.ainvoke() triggers generate_recommendations() which calls chat_completion_with_retry() with the gpt-4o model. This will:

  1. Incur OpenAI API costs on every test run
  2. Fail without OPENAI_API_KEY
  3. Be flaky due to non-deterministic LLM responses

Given the PR rationale mentions cost reduction, this appears unintentional.

🔧 Suggested fix: Add mock_gear_agent fixture
`@pytest.fixture`
def mock_gear_agent():
    """Patch gear_agent_graph.ainvoke to return a canned response."""
    fake_response = {
        "final_response": json.dumps({
            "recommendation_title": "테스트 추천",
            "user_profile_summary": "Test profile",
            "ai_reasoning": "Test reasoning",
            "shoes": [{
                "shoe_id": "test-1",
                "brand": "TestBrand",
                "model_name": "TestModel",
                "price_krw": 150000,
                "sensory_tags": "테스트 태그",
                "match_score": 85,
                "recommendation_reason": "Test reason",
            }],
        })
    }
    with patch(
        "src.api.v1.endpoints.gear.gear_agent_graph.ainvoke",
        return_value=fake_response,
    ) as mock:
        yield mock

Then add mock_gear_agent parameter to test_api_endpoint_success, test_api_endpoint_minimal_input, and test_api_endpoint_with_all_parameters.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/test_gear_advisor.py` around lines 244 - 286, Tests in
tests/test_gear_advisor.py unintentionally call the real OpenAI API because the
mock for gear_agent_graph.ainvoke was removed; add a pytest fixture named
mock_gear_agent that patches src.api.v1.endpoints.gear.gear_agent_graph.ainvoke
to return a canned response (a dict with "final_response" containing the JSON
string of the expected recommendation payload) and then add mock_gear_agent as a
parameter to test_api_endpoint_success, test_api_endpoint_minimal_input, and
test_api_endpoint_with_all_parameters so generate_recommendations (which calls
chat_completion_with_retry using model "gpt-4o") uses the stubbed response,
preventing real API calls, flakiness, and API-key dependency.
🧹 Nitpick comments (1)
tests/test_skill_lab.py (1)

212-232: Silent pass when category returns empty results.

The test iterates results["metadatas"][0] without asserting non-empty results first. If a category returns zero matches, the assertion loop is skipped and the test passes silently.

Consider adding an assertion to ensure results are returned:

💡 Suggested improvement
             results = chroma_manager.query_drills(
                 query_texts=[query_text],
                 n_results=5,
                 where={"category": category},
             )

             assert results and results.get("metadatas")
+            assert len(results["metadatas"][0]) > 0, (
+                f"Expected results for category '{category}'"
+            )
             for metadata in results["metadatas"][0]:
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/test_skill_lab.py` around lines 212 - 232, The test
test_tc03_category_filter_accuracy silently passes when a category yields zero
matches because it iterates results["metadatas"][0] without asserting it's
non-empty; update the test around the chroma_manager.query_drills call to
explicitly assert that results is truthy, results.get("metadatas") exists, and
that results["metadatas"][0] (or its length) is non-empty before iterating,
e.g., assert results and results.get("metadatas") and
len(results["metadatas"][0]) > 0 with a clear message including the category so
an empty-result case fails the test.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@tests/test_gear_advisor.py`:
- Around line 244-286: Tests in tests/test_gear_advisor.py unintentionally call
the real OpenAI API because the mock for gear_agent_graph.ainvoke was removed;
add a pytest fixture named mock_gear_agent that patches
src.api.v1.endpoints.gear.gear_agent_graph.ainvoke to return a canned response
(a dict with "final_response" containing the JSON string of the expected
recommendation payload) and then add mock_gear_agent as a parameter to
test_api_endpoint_success, test_api_endpoint_minimal_input, and
test_api_endpoint_with_all_parameters so generate_recommendations (which calls
chat_completion_with_retry using model "gpt-4o") uses the stubbed response,
preventing real API calls, flakiness, and API-key dependency.

---

Nitpick comments:
In `@tests/test_skill_lab.py`:
- Around line 212-232: The test test_tc03_category_filter_accuracy silently
passes when a category yields zero matches because it iterates
results["metadatas"][0] without asserting it's non-empty; update the test around
the chroma_manager.query_drills call to explicitly assert that results is
truthy, results.get("metadatas") exists, and that results["metadatas"][0] (or
its length) is non-empty before iterating, e.g., assert results and
results.get("metadatas") and len(results["metadatas"][0]) > 0 with a clear
message including the category so an empty-result case fails the test.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0017daf8-54af-4cd4-9090-43e4f7efb9eb

📥 Commits

Reviewing files that changed from the base of the PR and between 1b3b7cd and 90340ac.

📒 Files selected for processing (5)
  • .github/workflows/test.yml
  • tests/conftest.py
  • tests/test_gear_advisor.py
  • tests/test_skill_lab.py
  • tests/test_whistle.py
💤 Files with no reviewable changes (2)
  • tests/conftest.py
  • .github/workflows/test.yml

@zweadfx zweadfx merged commit 2693799 into main Mar 17, 2026
2 checks passed
@zweadfx zweadfx deleted the chore/remove-ci-workflows branch March 17, 2026 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore 실제 코드나 기능과는 직접적인 연관이 없는 설정 작업을 의미합니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Chore] ChatGPT 코드 리뷰 워크플로우 및 pytest CI 제거

1 participant