schedule_actual コマンドの作成#307
Conversation
…orting - Implemented `list_daily` and `list_weekly` commands to output daily and weekly working hours. - Created necessary modules and functions for data processing and output formatting. - Updated documentation to include new commands in the command reference. - Added tests for the new functionality to ensure correctness.
Title202604 2 0101 Description
Changes walkthrough 📝
|
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
|
||
| df = daily_df.copy() | ||
| df["dt_date"] = pandas.to_datetime(df["date"]) | ||
| df_weekly = df.resample("W-SUN", on="dt_date", label="left", closed="left").agg( |
There was a problem hiding this comment.
Suggestion: 週の集計を日曜始まり土曜終わりに合わせるため、resample の頻度を "W-SAT" に変更してください。これでテスト期待値の週開始日が正しく取得できます。 [possible issue, importance: 9]
| df_weekly = df.resample("W-SUN", on="dt_date", label="left", closed="left").agg( | |
| df_weekly = df.resample("W-SAT", on="dt_date", label="left", closed="left").agg( |
There was a problem hiding this comment.
Pull request overview
予定(作業計画)と実績(実績作業時間)を結合した「schedule_actual」サブコマンドを追加し、日次/週次の集計結果を出力できるようにするPRです。
Changes:
annoworkcli schedule_actual list_daily|list_weeklyを追加し、当日境界で「過去=実績」「未来=予定」を結合して集計・出力- コマンドリファレンス(Sphinx + argparse)を追加し、Command Reference の目次に掲載
- 集計ロジックの単体テストとWebAPIアクセスのコマンドテストを追加(+ agent向け設定/ガイドを追加)
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| annoworkcli/main.py | schedule_actual サブコマンドをトップレベルCLIに登録 |
| annoworkcli/schedule_actual/common.py | 日次/週次の結合・集計、およびWebAPIからの取得処理を実装 |
| annoworkcli/schedule_actual/list_daily.py | 日次出力コマンドのCLI引数定義と実行処理を追加 |
| annoworkcli/schedule_actual/list_weekly.py | 週次出力コマンドのCLI引数定義と実行処理を追加 |
| annoworkcli/schedule_actual/subcommand.py | schedule_actual 配下のサブコマンド登録(list_daily/list_weekly) |
| annoworkcli/schedule_actual/init.py | パッケージ追加 |
| tests/schedule_actual/test_common.py | 日次/週次のDataFrame生成ロジックの単体テスト追加 |
| tests/schedule_actual/test_schedule_actual_command.py | WebAPIアクセスを伴うE2E寄りのコマンドテスト追加 |
| tests/schedule_actual/test_subcommand.py | argparse パーサーの配線確認テスト追加 |
| tests/schedule_actual/init.py | テストパッケージ追加 |
| docs/command_reference/index.rst | Command Reference に schedule_actual を追加 |
| docs/command_reference/schedule_actual/index.rst | schedule_actual のコマンド一覧ページ追加 |
| docs/command_reference/schedule_actual/list_daily.rst | list_daily のコマンドリファレンス追加 |
| docs/command_reference/schedule_actual/list_weekly.rst | list_weekly のコマンドリファレンス追加 |
| AGENTS.md | エージェント実行の前提/手順を追加 |
| .codex/config.toml | Codex向けのsandbox/approval設定を追加 |
| .agents/skills/test-writing/SKILL.md | テスト作成ガイドを追加 |
| .agents/skills/python-coding-style/SKILL.md | Pythonコーディングスタイルを追加 |
| .agents/skills/document-style/SKILL.md | ドキュメントスタイルを追加 |
| .agents/skills/annowork-cli-command-style/SKILL.md | CLI規約(命名/ログ等)を追加 |
| * `uv run pytest` を使う。 | ||
|
|
||
| ## テストコードの具体的なスタイル | ||
| * テストファイルのディレクトリ構成やファイル名は、`annofabcli/`配下のプロダクションコードと対応させる。 |
There was a problem hiding this comment.
プロジェクトは annoworkcli なので、ここで例示しているパス annofabcli/ は誤記に見えます。テストディレクトリ構成の対応先を annoworkcli/ に修正してください。
| * テストファイルのディレクトリ構成やファイル名は、`annofabcli/`配下のプロダクションコードと対応させる。 | |
| * テストファイルのディレクトリ構成やファイル名は、`annoworkcli/`配下のプロダクションコードと対応させる。 |
| * 何件目を処理しているかをログに出力する。 | ||
| * 100件や1000件など、適当な件数ごとに進捗をinfoレベルでログに出力する。 | ||
| * 全部の処理が完了した後に、成功件数、スキップ件数、失敗件数などのサマリをログにinfoレベルで出力する。 | ||
| * try-exceptでエラーをキャッチした場合は、`logger.warning(..., exc_info=True)`を使って、スタックとレースも出力する。 |
There was a problem hiding this comment.
誤記があります。「スタックとレース」→「スタックトレース」。
| * try-exceptでエラーをキャッチした場合は、`logger.warning(..., exc_info=True)`を使って、スタックとレースも出力する。 | |
| * try-exceptでエラーをキャッチした場合は、`logger.warning(..., exc_info=True)`を使って、スタックトレースも出力する。 |
This pull request introduces a new
schedule_actualcommand group to the CLI, enabling users to output combined daily and weekly working hours (both scheduled and actual) for jobs, along with corresponding documentation and internal utilities. It also adds or updates several coding, testing, and documentation style guides, and makes minor configuration and policy adjustments.The most important changes are:
New CLI Feature: Combined Schedule and Actual Working Hours
schedule_actualcommand group with two subcommands:list_daily: Outputs daily combined scheduled and actual working hours for a parent job. [1]], [2]], [3]], [4]])list_weekly: Outputs weekly combined scheduled and actual working hours for a parent job. [1]], [2]])annoworkcli/schedule_actual/common.pyfor data aggregation, date handling, and output formatting. ([annoworkcli/schedule_actual/common.pyR1-R167])Documentation
schedule_actualcommands, including usage examples and argument references. [1]], [2]], [3]], [4]])Coding, Testing, and Documentation Style Guides
docsdirectory ([.agents/skills/document-style/SKILL.mdR1-R8])Project Policy and Configuration
AGENTS.md(e.g., destructive change preference, review/test steps) ([AGENTS.mdR1-R13]).codex/config.tomlwith sandbox and approval policy settings ([.codex/config.tomlR1-R24])Test Structure
schedule_actualto support future test development ([annoworkcli/schedule_actual/init.pyR1])These changes collectively add a major new feature for reporting on scheduled and actual working hours, ensure it is well-documented, and strengthen project conventions and configuration.