feat: Add plan for system log refactor to enhance audit functionality#393
feat: Add plan for system log refactor to enhance audit functionality#393
Conversation
- Introduced a new plan for refactoring the management operation log system to strengthen audit capabilities. - Documented current state, design options, and next steps for implementation. - Updated roadmap to include tasks related to the management operation log refactor.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dd2b251015
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
assets/docs/roadmap.md
Outdated
| @@ -0,0 +1,101 @@ | |||
| # ExecPlan: 管理操作ログ機構の改修(監査機能の強化) | |||
There was a problem hiding this comment.
Pull request overview
- 目的: 管理操作ログ改修(監査強化)の検討プラン追加とロードマップ更新により、今後の実装作業を具体化する
- 変更点:
- Phase 1 ロードマップを更新し、システムログ改修タスクと管理操作ログ改修タスクを追加
- 管理操作ログ改修の方針検討用 ExecPlan を新規追加(現状整理、設計オプション、次ステップ)
- システムログ改修の詳細 ExecPlan を新規追加(設計・UI/CLI案・移行/検証観点)
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 12 comments.
| File | Description |
|---|---|
| assets/docs/roadmap.md | Phase 1 のログ関連タスクと管理操作ログ改修タスクをロードマップに追加 |
| .agent/plans/2026-XX-XX-manager-log-refactor.md | 管理操作ログ改修(監査強化)の検討プランを追加 |
| .agent/plans/2026-02-07-logging-system-refactor.md | システムログのファイルベース移行・CLI/画面改修を含む詳細プランを追加 |
There was a problem hiding this comment.
log:compress サンプルで compressOldLogs() を呼んでいるが、同ファイル内の Logger クラス例にメソッド定義がない。メソッド追加(仕様明記)か、サンプル側の呼び出し統一が必要。
| $logger = new Logger(); | |
| $result = $logger->compressOldLogs($days); | |
| // 実際の実装では Logger クラスに compressOldLogs() メソッドを追加して呼び出す想定 | |
| // ここでは戻り値構造の例のみを示す | |
| $result = [ | |
| 'count' => 0, | |
| 'before_size' => 0.0, | |
| 'after_size' => 0.0, | |
| 'saved_size' => 0.0, | |
| 'ratio' => 0.0, | |
| ]; |
There was a problem hiding this comment.
countLines() が EOF 到達後も1回カウントされる実装になっており、行数が1多くなる。fgets() の戻り値を条件にして、実際に読み取れた行だけ加算する必要がある。
| while (!feof($handle)) { | |
| fgets($handle); | |
| while (($line = fgets($handle)) !== false) { |
| - [システムログ改修プラン](.agent/plans/2026-02-07-logging-system-refactor.md) | ||
| - [ロードマップ](assets/docs/roadmap.md) |
There was a problem hiding this comment.
References の相対リンクが現在の配置だと解決できず、GitHub上でリンク切れになる。.agent/plans/ 配下のファイルからは、同一ディレクトリのプランは ./...(またはファイル名のみ)、ロードマップは ../../assets/docs/roadmap.md か /assets/docs/roadmap.md のように修正が必要。
| - [システムログ改修プラン](.agent/plans/2026-02-07-logging-system-refactor.md) | |
| - [ロードマップ](assets/docs/roadmap.md) | |
| - [システムログ改修プラン](./2026-02-07-logging-system-refactor.md) | |
| - [ロードマップ](../../assets/docs/roadmap.md) |
| # ExecPlan: システムログ機構の改修(AI自走デバッグの実現) | ||
|
|
||
| ## Purpose / Big Picture | ||
| Evolution CMS のシステムログ(エラー・警告・情報)をファイルベースのJSONLines形式に移行し、AI エージェントがログを解析してコード修正を自律的に行えるようにする。構造化されたログにより、エラー箇所の特定・再現・修正のサイクルを自動化する。 | ||
|
|
There was a problem hiding this comment.
PR説明は「管理操作ログの改修プラン追加」が主旨だが、このPRにはシステムログ改修プラン(1500行超)の新規追加も含まれている。PR説明側にこの追加を明記するか、別PRに分割してスコープを揃える必要がある。
There was a problem hiding this comment.
完了条件の「6. issue-resolver スキル…」がこの後のセクションで重複して再掲されている。完了条件は1箇所に統合し、重複ブロックを削除する必要がある。
| **デメリット**: | ||
| - 検索性の低下(期間・ユーザーによる絞り込みが遅い) | ||
| - 統計レポートが困難 | ||
| - 既存の管理画面を全面刷新が必要 |
There was a problem hiding this comment.
「既存の管理画面を全面刷新が必要」は助詞が欠けており意味が取りづらい。「既存の管理画面を全面刷新する必要がある」などに修正が必要。
| - 既存の管理画面を全面刷新が必要 | |
| - 既存の管理画面を全面刷新する必要がある |
There was a problem hiding this comment.
さらに同じ「7. セキュリティ要件…」が連続で再掲されている(このブロック自体が重複)。片方を削除して完了条件を一意にする必要がある。
| **7. セキュリティ要件を満たしている** | |
| ```bash | |
| # ログから物理パスが漏洩していないことを確認 | |
| grep -r "$(pwd)" temp/logs/system/ | |
| # → 何もヒットしないこと(相対パスのみ記録されている) | |
| # フォーラム投稿シミュレーション | |
| cat temp/logs/system/2026/02/system-2026-02-07.log | head -n 5 | |
| # → ファイルパスが「manager/...」形式で表示され、サーバー構成が推測できないこと | |
| ``` |
There was a problem hiding this comment.
log:rotate system のサンプルが cleanOldLogs() 呼び出しになっており、コマンド名(rotate)と処理内容(保持期間での削除)が一致していない。log:clean との責務分離も含め、名称・説明・呼び出し先メソッドを揃える必要がある。
| $logger->cleanOldLogs(); | |
| $logger->rotateLogs(); |
There was a problem hiding this comment.
log:clean サンプルで deleteOldLogs() を呼んでいるが、同ファイル内の Logger クラス例にメソッド定義がない。Logger 例にメソッド仕様を追記するか、CLI側を例示済みメソッド名(cleanOldLogs() 等)に合わせて整合させる必要がある。
| $result = $logger->deleteOldLogs($days, $dryRun); | |
| $result = $logger->cleanOldLogs($days, $dryRun); |
| - [ ] `log:tail system` (リアルタイム監視) | ||
| - [ ] `log:search system` (エラーパターン検索、JSON出力) | ||
| - [ ] `log:rotate system` (ファイル分割) | ||
| - [ ] `log:compress system` (古いログの圧縮) | ||
| - [ ] `log:clean system` (古いログの削除) |
There was a problem hiding this comment.
ロードマップ上で log:rotate system を「ファイル分割」としているが、同PR内のシステムログ改修プランでは log:rotate がクリーンアップ呼び出し例になっており用語が不一致。rotate/clean/split の責務とコマンド名をドキュメント間で統一する必要がある。
…t merged Co-authored-by: yama <73999+yama@users.noreply.github.com>
修正: roadmap.md の CLI 実装状態を未完了に変更
Co-authored-by: yama <73999+yama@users.noreply.github.com>
Co-authored-by: yama <73999+yama@users.noreply.github.com>
Co-authored-by: yama <73999+yama@users.noreply.github.com>
Co-authored-by: yama <73999+yama@users.noreply.github.com>
Co-authored-by: yama <73999+yama@users.noreply.github.com>
ExecPlanファイル名を必須の日付フォーマットに修正
Logger クラスに欠落していた compressOldLogs/deleteOldLogs メソッドを追加
Remove duplicate completion conditions in logging system refactor plan
fix: Correct off-by-one error in ExecPlan countLines() method
This pull request introduces significant improvements to the ExecPlan documentation workflow, enforces best practices for bug resolution, and adds new plans and reference materials to standardize and streamline complex task execution. The most important changes are grouped below.
ExecPlan Documentation & Workflow Standardization:
.agent/PLANS.mdto require that "Concrete Steps" include the target file, execution command, and expected observable result per step, and clarified that "Validation and Acceptance" must be defined in terms of user-observable behavior, not internal implementation. Also added guidelines for concise, non-redundant writing and discouraged pasting long code blocks, emphasizing reproducibility by implementers unfamiliar with prior context. [1] [2].codex/skills/exec-plan/SKILL.mdand.codex/skills/exec-plan/agents/openai.yamlto formalize the ExecPlan skill, detailing commands for plan creation, validation, and updating, with a strong focus on reproducibility, clarity, and avoidance of hidden context. [1] [2].codex/skills/exec-plan/references/quality-checklist.mdas a comprehensive checklist to ensure all ExecPlans meet non-negotiable requirements, including section completeness, reproducibility, and concise documentation.Issue Resolution & Bug Fixing Principles:
.claude/skills/issue-resolver/SKILL.mdto enforce that bug fixes address the root cause rather than suppressing errors, require investigation reports and engineer approval before implementation, and provide clear rules for local development, command usage, and information gathering.New and Updated ExecPlans:
.agent/plans/2026-02-04-outputfilter-undefined-array-key.mdto shift from a symptomatic fix (adding?? ''in each filter) to a root-cause solution—normalizing$paramsat the source intvProcessor(), ensuring all outputfilters receive well-defined keys, and documenting this with clear, reproducible steps and validation criteria..agent/plans/2026-02-07-manager-log-refactor.mdoutlining options and requirements for refactoring the administrative operations log system to enhance audit capabilities, with a focus on compliance, scalability, and maintainability..agent/plans/2026-02-13-logging-paging-undefined-key.mddetailing the investigation and fix for undefined array key warnings in the event log pagination, including code boundary checks and integer casting, with explicit validation and recovery steps.