Skip to content

🔧 fix: export 및 extract_text 도구들의 100% 테스트 커버리지 달성 - #773

Open
seonghobae wants to merge 14 commits into
developfrom
feature/fix-coverage-for-tools-11646378742078810923
Open

🔧 fix: export 및 extract_text 도구들의 100% 테스트 커버리지 달성#773
seonghobae wants to merge 14 commits into
developfrom
feature/fix-coverage-for-tools-11646378742078810923

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

Scope

Exercise the four shipped CLI __main__ entry points in tools/export_csv.py, tools/export_html.py, tools/export_markdown.py, and tools/extract_text.py instead of excluding those lines with # pragma: no cover.

Current exact identity

  • head: 7cf2655f59141d60df9a73b74bcab0961a4d981d
  • protected base: develop@e06b1f3fb10903569124af011da213951e6e2473
  • effective diff: four tool files plus their four existing test modules
  • state: open, Ready, mechanically mergeable, not merge-ready

Regression contract

The original entry-point tests could falsely pass when runpy.run_module(..., run_name="__main__") returned normally, because SystemExit was only inspected inside an optional except block. They also removed modules directly from sys.modules without automatic restoration.

The current tests now:

  • require SystemExit with exit code 0 for each -h module execution, so removal of the main() invocation fails the test;
  • use monkeypatch.delitem(..., raising=False) so pytest restores module-cache state;
  • keep the production change bounded to removing the four # pragma: no cover guards.

No current-head tests/test_docstring_quality.py or src/newsdom_api/synthetic.py change exists in this PR. Earlier reviewer/summary prose referring to those files came from predecessor branch states and is not current-head evidence.

Fresh evidence boundary

For exact head 7cf2655f59141d60df9a73b74bcab0961a4d981d, the repository workflow runs currently materialized for ClusterFuzzLite, scorecards, CodeQL, container image, dependency review, quality gate, tests, Security Scan, and SAST Semgrep are all queued. Queued evidence is non-passing. All currently materialized inline review threads are resolved/outdated, but there is no qualifying independent non-author human approval for this exact head.

Do not transfer predecessor-head check or review results to this head. Merge only when the unchanged exact head has every then-live required repository and organization workflow terminal-success, zero valid unresolved findings, required 100% owned production statement/branch coverage evidence, and the required qualifying independent approval.


PR originally created by Jules for task 11646378742078810923 started by @seonghobae

Summary by CodeRabbit

  • 테스트

    • CSV, HTML, Markdown 내보내기와 텍스트 추출 도구의 도움말 실행을 검증하는 테스트가 추가되었습니다.
    • 각 도구가 도움말 요청 시 정상적으로 종료되는지 자동 확인합니다.
  • 문서

    • 합성 이미지, PDF 및 정답 파일 생성 기능에 대한 설명이 보다 간결하고 명확하게 정리되었습니다.
  • 품질 개선

    • 명령줄 도구의 실행 경로가 테스트 범위에 포함되어 유지보수성과 릴리스 안정성이 향상되었습니다.

@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: 668d0e26-426e-449b-b1d3-852929448e17

📥 Commits

Reviewing files that changed from the base of the PR and between 61ef6ca and b847135.

📒 Files selected for processing (5)
  • src/newsdom_api/synthetic.py
  • tests/test_tools_export_csv.py
  • tests/test_tools_export_html.py
  • tests/test_tools_export_markdown.py
  • tests/test_tools_extract_text.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/newsdom_api/synthetic.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

네 개 도구 모듈의 __main__ 경로에서 커버리지 제외 주석을 제거하고, 도움말 실행 테스트를 추가했습니다. synthetic.py의 모듈 및 함수 docstring도 갱신했습니다.

Changes

CLI 진입점 커버리지 검증

Layer / File(s) Summary
CLI 진입점 커버리지 대상화
tools/export_csv.py, tools/export_html.py, tools/export_markdown.py, tools/extract_text.py
네 개 모듈의 __main__ 가드에서 # pragma: no cover 주석을 제거했습니다.
모듈 직접 실행 테스트
tests/test_tools_export_csv.py, tests/test_tools_export_html.py, tests/test_tools_export_markdown.py, tests/test_tools_extract_text.py
각 모듈을 runpy.run_module로 실행하고 -h 처리 결과의 SystemExit 코드가 0인지 검증합니다.

synthetic fixture 문서 문자열 갱신

Layer / File(s) Summary
synthetic fixture 문서 문자열 갱신
src/newsdom_api/synthetic.py
폰트 처리, 텍스트 렌더링, 수직 열 분할, descriptor, ground-truth, fixture 생성 함수의 docstring을 갱신했습니다.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: 🟡 Moderate · up to b8471

The PR only removes coverage exclusions and strengthens tests around existing CLI help exits, so user-facing behavior should remain unchanged. It is not merge-ready yet because required checks are still queued and the required independent approval is missing; merge should wait for those gates.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning 설명은 변경 범위와 회귀 검증 내용을 자세히 설명하지만, 템플릿의 ## Summary, ## Git Flow target, ## Verification, ## Notes 섹션을 따르지 않았습니다. Git Flow 대상 브랜치와 테스트 실행 결과도 없습니다. 설명을 템플릿 형식으로 수정하십시오. ## Summary에 변경 내용을 작성하고, ## Git Flow target에 대상 브랜치와 규칙을 명시하십시오. ## Verification에서 pytestPYTHONWARNINGS=error pytest 실행 여부를 체크하고 결과를 추가하십시오. 필요한 백머지 또는 릴리스 후속 작업이 없으면 ## Notes에 없다고 명시하십시오.
Docstring Coverage ⚠️ Warning Docstring coverage is 65.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 23 functions across 10 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed 제목은 네 CLI 도구의 테스트 커버리지 개선이라는 주요 변경을 명확하게 설명합니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/fix-coverage-for-tools-11646378742078810923

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.

devin-ai-integration[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Collaborator Author

이번 quality slice를 기존 coverage PR에 겹쳐 넣었습니다. 새 PR은 만들지 않았습니다.

  • RED 7b643eda141ed9d7078c40514a0854f61d5fb590: shipped src/newsdom_api/synthetic.py의 missing/single-line docstring을 AST로 거부하는 regression test 추가. 기존 한 줄 docstring 때문에 의도적으로 실패하는 계약입니다.
  • GREEN 61ef6ca1fed847ef69b6b7894481dbfffbc65915: production behavior는 바꾸지 않고 module/함수 docstring을 책임·fallback·layout invariant·path-safety가 드러나는 다중행 설명으로 교체했습니다.

이 slice의 목적은 coverage=100% 또는 docstring 존재율만으로 품질을 통과시키지 않고, 한 줄짜리 명목상 문서화를 executable failure로 만드는 것입니다. 현재 exact head의 GitHub Checks/Devin review는 아직 진행 중이므로 통과·merge-ready로 간주하지 않습니다. 후속 루프에서는 같은 계약을 shipped Python 전체로 확장하되 기존 PR 큐를 더 늘리지 않고 canonical quality lane에서 처리해야 합니다.

coderabbitai[bot]

This comment was marked as resolved.

@google-labs-jules

Copy link
Copy Markdown

이번 quality slice를 기존 coverage PR에 겹쳐 넣었습니다. 새 PR은 만들지 않았습니다.

  • RED 7b643eda141ed9d7078c40514a0854f61d5fb590: shipped src/newsdom_api/synthetic.py의 missing/single-line docstring을 AST로 거부하는 regression test 추가. 기존 한 줄 docstring 때문에 의도적으로 실패하는 계약입니다.
  • GREEN 61ef6ca1fed847ef69b6b7894481dbfffbc65915: production behavior는 바꾸지 않고 module/함수 docstring을 책임·fallback·layout invariant·path-safety가 드러나는 다중행 설명으로 교체했습니다.

이 slice의 목적은 coverage=100% 또는 docstring 존재율만으로 품질을 통과시키지 않고, 한 줄짜리 명목상 문서화를 executable failure로 만드는 것입니다. 현재 exact head의 GitHub Checks/Devin review는 아직 진행 중이므로 통과·merge-ready로 간주하지 않습니다. 후속 루프에서는 같은 계약을 shipped Python 전체로 확장하되 기존 PR 큐를 더 늘리지 않고 canonical quality lane에서 처리해야 합니다.

내용 확인했습니다. 이번 변경 사항은 테스트 커버리지를 높이기 위해 추가된 것이며 향후 다중행 문서화를 통한 품질 향상도 참고하여 적용했습니다.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

Devin Review

Comment on lines +190 to +192
"""Generate a synthetic scanned-newspaper PDF fixture and ground-truth JSON.

A deterministic PDF and JSON structure configuration will be stored inside the target `output_dir` parameter.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔍 결정성을 과장하는 문서

seed는 파일명만 바꾸고 PDF 메타데이터를 고정하지 않습니다. 새 docstring의 결정성 보장은 바이트 단위 재현성으로 오해될 수 있습니다.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@cwl-noema-review cwl-noema-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Noema LLM review

The PR successfully achieves 100% test coverage for the export and extract_text tools by removing '# pragma: no cover' from the entry points and adding corresponding test_module_main tests. These tests correctly use runpy.run_module and pytest.raises(SystemExit) to verify that the CLI help flag (-h) triggers a clean exit (code 0), addressing previous reviewer concerns regarding functional correctness and coverage gaps. Docstring enhancements in src/newsdom_api/synthetic.py improve maintainability without introducing behavioral regressions.

Reviewed changed lines

  • tests/test_tools_export_csv.py:123 (RIGHT): Correctly implements test_module_main using runpy and asserts SystemExit with code 0 for the help flag, ensuring the entry point is executed and tested.
  • tools/export_csv.py:93 (RIGHT): Removal of # pragma: no cover allows the coverage tool to track the if __name__ == "__main__": block, which is now covered by the new test.
  • src/newsdom_api/synthetic.py:1 (RIGHT): Expanded module docstring provides better context for the synthetic fixture generation tools.

Adversarial validation

  • tests/test_tools_export_csv.py:123 (RIGHT) falsified: The test passes even if the main() call is removed from the tool's entry point. — The test explicitly uses pytest.raises(SystemExit) and asserts excinfo.value.code == 0. If main() (which calls argparse and thus sys.exit) were missing, the test would fail.
  • tests/test_tools_export_html.py:181 (RIGHT) falsified: The test fails to isolate the module execution, leading to state leakage. — The test uses monkeypatch.delitem(sys.modules, ...) to force a reload of the module via runpy, ensuring isolation.
  • Residual risk: Low

Findings

  • No blocking findings.
  • Result: APPROVE
  • Head SHA: 0a5e0cbcceabd750d88266a9df33e86f4b552253
  • Reviewer credential: noema-review-github-app-refresh
  • Actor: cwl-noema-review[bot]

@seonghobae seonghobae added priority: medium Normal-priority or P2 work status: needs-review Open pull request requiring current-head review or checks type: maintenance Maintenance, build, dependency, or operational upkeep maintenance labels Sep 2, 2026 — with ChatGPT Codex Connector
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance priority: medium Normal-priority or P2 work status: needs-review Open pull request requiring current-head review or checks type: maintenance Maintenance, build, dependency, or operational upkeep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant