Skip to content

Comments

feat: 実績バー優先の正規化ロジック実装(時刻解析共通化)#128

Merged
LevelCapTech merged 17 commits intomainfrom
copilot/implement-bar-priority-logic
Feb 21, 2026
Merged

feat: 実績バー優先の正規化ロジック実装(時刻解析共通化)#128
LevelCapTech merged 17 commits intomainfrom
copilot/implement-bar-priority-logic

Conversation

Copy link
Contributor

Copilot AI commented Feb 21, 2026

概要(Summary)

このプルリクエストは .github/copilot/plans/41-actuals-linkage-bar-priority-spec.md に沿った実装変更です。start/end を SSOT とする実績正規化と 0.25h 丸め・半開区間の整合を UI 統合まで含めて反映しています。

  • 正規化ロジック: start/end 優先の整合、workHoursPerDay/workday 時刻、warnOnce の適用
  • UI 統合: Gantt 受信時と TaskList 編集確定時に normalize を適用
  • 編集時刻保持: start/end 編集で日付のみ変更しても既存の時刻または workday 時刻を保持
  • 時刻解析共通化: time-helper に時刻解析ロジックを集約
  • テスト: 受入条件(初期/編集/境界/冪等/稼働時間差分)を回帰テスト化

背景・経緯(Context / Facts)

  • トリガーとなった事象(Issue / PR / 障害 / 仕様変更 / 指摘 / 差分 等):[IMPLEMENT] 41-actuals-linkage-bar-priority-spec 実装対応
  • 参照した情報・資料(Spec / ADR / Doc / Slack / 既存実装 等):.github/copilot/plans/41-actuals-linkage-bar-priority-spec.md、.github/copilot/00-index.md、関連 SSOT
  • 作業開始時点で確認できていた事実(再現条件 / 期待仕様 / 現状の挙動 等):actualEffort と start/end が矛盾しても補正されず、SSOT と丸め規約が未実装

変更のインデックス(どのファイルをどう変えたか)

diffの目次(ファイル×変更概要)を下記のテーブルに記載します。

ファイル 変更概要(1行)
src/helpers/actuals-helper.ts 正規化・派生計算・丸め・warnOnce の実装を追加、時刻解析を共通化
src/helpers/time-helper.ts 時刻解析ユーティリティを追加
src/components/gantt/gantt.tsx tasks 受信時に正規化を適用
src/components/task-list/task-list.tsx 編集確定時の正規化と派生更新の適用、start/end 編集時の時刻保持と無効日付比較を整理
src/types/public-types.ts DisplayOption に稼働時間系オプションを追加
src/test/actuals-helper.test.tsx 正規化ロジックの単体テストを追加
src/test/task-list-commit.test.tsx 編集時正規化と時刻保持の回帰テスト追加(invalid end を含む)
src/test/task-model.test.tsx 初期表示時の正規化確認を追加
README.md DisplayOption の稼働時間オプションを追記

実装の要点(Diffから読み取りづらい“事実”)

観点 記録
主要な追加/変更点(関数/クラス/モジュール単位) normalizeActuals / roundEffortToQuarterHour / deriveStart/deriveEnd / recalcEffort を追加し、Gantt と TaskList に統合、time-helper を追加
振る舞いが変わる入口(API/CLI/画面/バッチ/イベント) Gantt tasks 受信時、TaskList の onCellCommit(start/end/actualEffort)
データ構造の変更点(型/スキーマ/テーブル/JSON) DisplayOption に workHoursPerDay/workdayStartTime/workdayEndTime 追加
互換性の扱い(後方互換/破壊的変更/互換レイヤ) 既存 Task フィールドは維持、未指定は既定値で補完(後方互換)
const normalized = normalizeActuals(task, {
  workHoursPerDay,
  workdayStartTime,
  workdayEndTime,
  calendarConfig,
});

適用後に観測できる結果(観測ログ/確認ログ)

確認ログ(何を実行/何を目視したか)

確認項目 方法(実行/目視) 結果 根拠(ログ/URL/スクショ等)
実績正規化の適用 npm run test:unit -- task-list-commit.test.tsx actuals-helper.test.tsx pass ローカル実行ログ

テストの実行状況(事実ログ)

種別 対象(パス/テスト名) 実行方法(コマンド/CI) 結果 根拠(ログ/URL等)
unit src/test/task-list-commit.test.tsx, src/test/actuals-helper.test.tsx npm run test:unit -- task-list-commit.test.tsx actuals-helper.test.tsx pass ローカル実行ログ
integration - - - -
e2e - - - -
lint/type - - - -

エラーハンドリング・境界値の考慮事項(Error Handling / Boundary Conditions)

分類(error/boundary) ケース(入力/条件) 期待動作(仕様) 実装上の扱い(例外/戻り値/ログ/抑止) 確認方法(実行/目視/テスト) 結果 根拠(ログ/URL/スクショ等)
boundary 0.25h 丸め境界 round-half-up Number.EPSILON を加味して丸め テスト pass actuals-helper.test.tsx
boundary workHoursPerDay > window clamp + warnOnce warnOnce で 1 回だけ警告 テスト pass actuals-helper.test.tsx
error 不正な日付/負数 欠落扱い normalizeActuals で補完/再計算 テスト pass actuals-helper.test.tsx
error invalid end の比較 invalid は常に差分扱い isSameDate で false テスト pass task-list-commit.test.tsx

影響範囲(どこに影響する/しないと言える根拠)

影響対象 結論 根拠
アプリケーション挙動 影響あり 実績表示が start/end SSOT に整合される
API契約(入力/出力/HTTP/エラー) 影響なし 公開 API 追加なし、既存 Task 互換
データ互換(スキーマ/マイグレーション/既存データ) 影響なし 既存データを補正表示するのみ
パフォーマンス(CPU/IO/レイテンシ) 影響軽微 正規化は軽量な純粋関数
環境設定・デプロイ手順 影響なし 設定追加のみ(任意指定)
監視・運用(ログ/メトリクス/アラート) 影響あり warnOnce ログ追加(1 回のみ)

依存関係とコストへの影響(Dependencies / Cost Impact)

観点 対象(ライブラリ/サービス/API 等) 変更内容(追加/更新/削除/呼出増減 等) 影響(課金/性能/運用) 影響量(増減の見積/測定値) 根拠(計測/ログ/設定/差分)
依存 - なし なし なし 追加依存なし
コスト - なし なし なし 追加外部呼出なし

マイグレーション/ロールアウト(必要な場合のみ)

項目 記録
マイグレーション有無(DB/設定/データ) なし
手順(誰が/いつ/どこで/何を) なし
ロールバック方針(戻し方の事実) 該当コミットのリバート
互換期間/段階移行(フラグ/二重書き/旧API維持 等) 不要

スコープ境界(触っていい/ダメ、非目標)

区分 範囲(パス/モジュール/設定など) 根拠
触ってよい範囲 src/helpers/actuals-helper.ts, src/helpers/time-helper.ts, gantt/task-list, tests, README plan 準拠の実装対象
触ってはいけない範囲 既存 Task 公開 API の拡張 plan 制約
非目標(このPRではやらないこと) actual フィールドの追加、努力値永続化 plan 制約

推論せず“質問に落とす”ための質問票(ADR/確認事項)

論点 / 質問 回答(事実のみ) 根拠(Issue/PR/Commit/ファイル等)
このPRで「決定」扱いにしたいことは何か?(なければ空欄) なし plan に決定済み
仕様上の未確定点(質問として列挙) なし plan に明記
追加の観測が必要な点(ログ/メトリクス等) なし 要件に未記載
レビュー観点で迷う点(代替案がある等) なし plan 準拠

セキュリティ自己確認(Security Self-Check)

観点 結論 根拠(差分/ログ/設定/スクショ等)
Secrets(鍵/トークン/パスワード混入) なし 追加差分に機密なし
入力検証(外部入力のバリデーション) 実施 parseDateFromInput/sanitizeEffortInput を利用
認可(権限チェック/境界) 該当なし UI 内部処理のみ
ログ(PII/秘密情報の出力) 問題なし rowId/フィールド名のみ出力

実装と確認のログ(何を触って、何を確認したか)

項目 記録
触った主要箇所(パス/関数/クラス等) normalizeActuals、time-helper、TaskList commit 正規化
実装メモ(変更意図ではなく事実) start/end SSOT による effort 派生、時刻解析の共通化、invalid 日付は差分扱い
実行した確認(コマンド/手動操作/ログ等) npm run test:unit -- task-list-commit.test.tsx actuals-helper.test.tsx
既知の未確認点(あれば) なし

実行区分(AIが実行したこと/人間が追加で行うこと)

区分 タスク(何をする) 対象(どのサイト/システム) 実行場所(URL/画面/コマンド) 実行方法(どうやって) 入力(必要な情報) 出力(得られるもの/保存先) 証跡(ログ/URL/スクショ等)
AI 正規化ロジック実装 リポジトリ src/helpers/actuals-helper.ts コード変更 plan 仕様 実装コード git diff
AI UI 統合 リポジトリ src/components/gantt/gantt.tsx, src/components/task-list/task-list.tsx コード変更 plan 仕様 実装コード git diff
AI テスト追加/実行 リポジトリ npm run test:unit -- task-list-commit.test.tsx actuals-helper.test.tsx コマンド実行 なし テストログ ローカルログ

補足(Notes)

  • なし
  • なし
  • なし
  • なし
  • なし
  • なし

コードレビューフィードバック対応(Review Feedback Response)

このセクションは「追記」で管理します。

追記(今回分)

  • フィードバック(要約):丸め処理の意図不明 対応(何を変えた):丸め説明コメント追加 対象(ファイル/行/Commit):actuals-helper.ts / roundEffortToQuarterHour / bced832 状態(対応済)
  • フィードバック(要約):コミット時の丸め値検証不足 対応(何を変えた):commit payload の丸め値検証追加 対象(ファイル/行/Commit):task-list-commit.test.tsx / bced832 状態(対応済)
  • フィードバック(要約):無効日付の意図が不明 対応(何を変えた):invalidEndForRecalc 名称付与 対象(ファイル/行/Commit):task-list.tsx / bced832 状態(対応済)
  • フィードバック(要約):invalid 日付比較の冪等性不足 対応(何を変えた):invalid 同士を同一扱いに変更 対象(ファイル/行/Commit):actuals-helper.ts / normalizeActuals / 7b2fdc4 状態(対応済)
  • フィードバック(要約):start/end 編集時の時刻消失 対応(何を変えた):既存時刻または workday 時刻を維持 対象(ファイル/行/Commit):task-list.tsx / commit 正規化 / 7b2fdc4 状態(対応済)
  • フィードバック(要約):時刻保持の回帰テスト不足 対応(何を変えた):start 編集時の時刻保持テスト追加 対象(ファイル/行/Commit):task-list-commit.test.tsx / 7b2fdc4 状態(対応済)
  • フィードバック(要約):時刻解析ロジックの重複 対応(何を変えた):time-helper へ共通化 対象(ファイル/行/Commit):time-helper.ts / 4831082 状態(対応済)
  • フィードバック(要約):invalid 日付比較の扱い 対応(何を変えた):invalid は常に差分扱いに整理 対象(ファイル/行/Commit):task-list.tsx / isSameDate / 1acb533 状態(対応済)
  • フィードバック(要約):time-helper の説明不足 対応(何を変えた):ParsedTime/parseTimeString のコメント追加・調整 対象(ファイル/行/Commit):time-helper.ts / f645b9d, 00d094e 状態(対応済)
  • フィードバック(要約):invalid end テストの意図不明 対応(何を変えた):テストコメント追加 対象(ファイル/行/Commit):task-list-commit.test.tsx / 9a0b528 状態(対応済)

既存ログ(前回まで)

<<keep_existing_lines>>
Original prompt

This section details on the original issue you should resolve

<issue_title>[IMPLEMENT] 41-actuals-linkage-bar-priority-spec に基づく start/end バー優先整合ロジック実装</issue_title>
<issue_description>## ゴール

.github/copilot/plans/41-actuals-linkage-bar-priority-spec.md に記載された設計内容を一切逸脱せず実装する。

  • start / end を唯一のSSOTとする
  • 半開区間 [start, end) を厳守
  • 0.25h round-half-up を厳守
  • CI品質ゲートをすべて通過する

入力(確定plan)

plan本文の章構成・制約・受入条件をそのまま実装に反映すること。


変更許容範囲

  • planからの逸脱禁止
  • Task公開型変更禁止
  • actual系フィールド追加禁止
  • 丸め単位変更禁止
  • 半開区間変更禁止
  • effort永続化禁止(派生値とする)

必要な仕様変更が発生した場合は DESIGN に差し戻す。


実装対象(plan準拠)

1. 正規化ロジック実装

planで定義された通り:

  • SSOT = (start, end)
  • effortは派生値
  • 半開区間 [start, end)
  • 0.25h round-half-up
  • 冪等 normalize

2. バー優先ポリシー

plan記載通りの優先順位を厳守:

  • start / end が常に優先
  • effort変更 → end再計算
  • start変更 → effort再計算
  • end変更 → effort再計算

優先順位の変更は禁止。

3. UI統合

planで指定された箇所にnormalizeを適用:

  • gantt描画前
  • task編集commit時

4. テスト実装

plan記載のGiven/When/Thenをそのままテストに落とし込む。

最低限:

  • 初期表示整合
  • 編集整合
  • 0.25h境界
  • 冪等性
  • workHoursPerDay差分

受入条件(plan再掲)

  • Given: start/endと矛盾するeffort
    When: normalize
    Then: effortが補正される

  • Given: effort変更
    When: normalize
    Then: endが再計算される

  • Given: start変更
    When: normalize
    Then: effortが再計算される

  • Given: normalizeを複数回実行
    Then: 結果が変化しない(冪等)

  • CI実行時
    Then: lint/typecheck/test/security 全緑


参照ブロック(必須)

  • 仕様の入口: .github/copilot/00-index.md
  • 全体規範: .github/copilot-instructions.md
  • 自動適用ルール: .github/instructions/**/*.instructions.md
  • 仕様SSOT:
    • .github/copilot/10-requirements.md
    • .github/copilot/20-architecture.md
    • .github/copilot/30-coding-standards.md
    • .github/copilot/40-testing-strategy.md
    • .github/copilot/50-security.md
    • .github/copilot/60-ci-quality-gates.md
  • テンプレ: .github/copilot/80-templates/*

Done(必須)

  • plan完全準拠実装
  • 受入条件をテストで担保
  • CI品質ゲートが全て緑(format/lint/typecheck/test/security)
  • Breaking changeなし
  • 関連ドキュメント更新(最小差分)</issue_description>

<agent_instructions>PR本文は.github/PULL_REQUEST_TEMPLATE/implement.mdに従い全文を記載してください。</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits February 21, 2026 05:10
実装計画を整理し、正規化ロジックとUI統合の作業順を明確化する。
仕様準拠の最小差分で進めるためのチェックリストを提示する。

Co-authored-by: LevelCapTech <99854263+LevelCapTech@users.noreply.github.com>
start/end 優先の正規化と編集時の派生更新を追加し、0.25h丸めと稼働時間設定を反映する。
受入条件を満たすテストとドキュメント更新を合わせて実施する。

Co-authored-by: LevelCapTech <99854263+LevelCapTech@users.noreply.github.com>
丸め処理の説明追加とコミット時の丸めテスト更新で意図を明確化する。
無効日時の扱いを命名で補足し、レビュー指摘を解消する。

Co-authored-by: LevelCapTech <99854263+LevelCapTech@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement start/end bar priority logic based on specs feat: 実績バー優先の正規化ロジック実装 Feb 21, 2026
Copilot AI requested a review from LevelCapTech February 21, 2026 05:32
@LevelCapTech LevelCapTech marked this pull request as ready for review February 21, 2026 07:13
@LevelCapTech LevelCapTech added the ✨ 新機能 新しい機能の提案や要求に適用します。新規アイデアや機能拡張に関するイシューやプルリクエスト。 label Feb 21, 2026
@LevelCapTech LevelCapTech requested a review from Copilot February 21, 2026 07:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

実績(actualEffort)を start/end をSSOT として正規化し、0.25h 丸め・稼働時間帯・カレンダー稼働日を踏まえた派生計算を、Gantt 初期表示と TaskList 編集確定に統合するPRです。

Changes:

  • normalizeActuals / roundEffortToQuarterHour を追加し、start/end 優先で実績工数・期間を整合
  • Gantt 側で tasks 受信時に正規化を適用し、TaskList commit 時に丸め+派生 end/start 更新を適用
  • 受入条件(矛盾補正・丸め境界・冪等・稼働時間差分・warnOnce)をテスト化し、README/型定義を更新

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/helpers/actuals-helper.ts 実績正規化ロジック(稼働時間帯/稼働日/0.25h丸め/warnOnce)を追加
src/components/gantt/gantt.tsx tasks を描画前に正規化し、TaskList に actualsOptions を伝搬
src/components/task-list/task-list.tsx start/end/actualEffort の commit 時に正規化結果を適用(commit 値/派生更新)
src/types/public-types.ts DisplayOption に稼働時間帯関連オプションを追加
src/test/actuals-helper.test.tsx 正規化/丸め/warnOnce の単体テストを追加
src/test/task-list-commit.test.tsx actualEffort 編集時の丸め・派生 end 更新を回帰テスト化
src/test/task-model.test.tsx 初期描画時の正規化(矛盾補正)確認を追加
README.md DisplayOption の稼働時間帯オプションを追記

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@LevelCapTech
Copy link
Owner

@copilot apply changes based on the comments in this thread

PR本文は維持。既存本文の削除/置換は禁止。必要情報はPR本文末尾の コードレビューフィードバック対応の追記セクション に追記すること。

start/end 編集時に時刻を維持し、invalid 日付比較の冪等性を改善する。
レビュー指摘に合わせてテストを追加し挙動を担保する。

Co-authored-by: LevelCapTech <99854263+LevelCapTech@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 21, 2026

@copilot apply changes based on the comments in this thread

PR本文は維持。既存本文の削��...

レビューコメントへの対応を 7b2fdc4 で反映しました。PR本文の追記はこの環境から更新できないため、必要であれば手動で追記をお願いします。UI変更はありません。

無効な日付同士を同一扱いする理由をコメントで補足し、不要なコメントを削除した。\nレビュー指摘への対応として読みやすさと一貫性を保つ。

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI changed the title feat: 実績バー優先の正規化ロジック実装 feat: 実績バー優先の正規化ロジック実装(編集時刻保持対応) Feb 21, 2026
@LevelCapTech LevelCapTech requested a review from Copilot February 21, 2026 07:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

@LevelCapTech
Copy link
Owner

@copilot apply changes based on the comments in this thread

PR本文は維持。既存本文の削除/置換は禁止。必要情報はPR本文末尾の コードレビューフィードバック対応の追記セクション に追記すること。

Copilot AI and others added 2 commits February 21, 2026 07:47
start/end 編集と正規化で同一の時刻解析を使い、比較は invalid 日付に安全化する。
レビュー指摘への対応として重複ロジックを削減する。

Co-authored-by: LevelCapTech <99854263+LevelCapTech@users.noreply.github.com>
TaskList の日付比較で invalid 日付を同一扱いしないようにし、更新判定を明確化する。
レビュー指摘に合わせて比較処理を簡潔に見直す。

Co-authored-by: LevelCapTech <99854263+LevelCapTech@users.noreply.github.com>
Copilot AI and others added 7 commits February 21, 2026 07:49
日付比較で valid 判定を先に行い、invalid 同士を同一扱いしないようにする。
レビュー指摘に合わせて比較順序を見直す。

Co-authored-by: LevelCapTech <99854263+LevelCapTech@users.noreply.github.com>
invalid 判定後の等値比較のみを残し、同一参照チェックを削除する。
レビュー指摘に合わせて比較処理を単純化する。

Co-authored-by: LevelCapTech <99854263+LevelCapTech@users.noreply.github.com>
invalid 日付の比較を簡潔化し、異常値でも更新判定が正しく動くよう調整する。
関連テストで invalid end のケースを含める。

Co-authored-by: LevelCapTech <99854263+LevelCapTech@users.noreply.github.com>
invalid 日付は常に異なる扱いとする旨を明記し、比較意図を分かりやすくする。
レビュー指摘への対応としてコメントを補足する。

Co-authored-by: LevelCapTech <99854263+LevelCapTech@users.noreply.github.com>
ParsedTime と parseTimeString の用途をコメントで明示し、保守性を向上する。
レビュー指摘に合わせてドキュメント補足を行う。

Co-authored-by: LevelCapTech <99854263+LevelCapTech@users.noreply.github.com>
invalid end を用いたテストの意図をコメントで補足し、比較仕様との整合を明示する。
レビュー指摘に合わせてテスト説明を追加する。

Co-authored-by: LevelCapTech <99854263+LevelCapTech@users.noreply.github.com>
ParsedTime の説明を parseTimeString の結果である点に合わせて修正する。
レビュー指摘に沿って文言を明確化する。

Co-authored-by: LevelCapTech <99854263+LevelCapTech@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 21, 2026

@copilot apply changes based on the comments in this thread

PR本文は維持。既存本文の削��...

レビュー指摘への対応を反映しました(4831082, 1acb533, 00d094e)。PR本文の追記はこの環境から更新できないため、必要であれば手動で追記をお願いします。UI変更はありません。

Copilot AI changed the title feat: 実績バー優先の正規化ロジック実装(編集時刻保持対応) feat: 実績バー優先の正規化ロジック実装(時刻解析共通化) Feb 21, 2026
@LevelCapTech LevelCapTech requested a review from Copilot February 21, 2026 09:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

@LevelCapTech LevelCapTech merged commit b2e2d6a into main Feb 21, 2026
5 checks passed
@LevelCapTech LevelCapTech deleted the copilot/implement-bar-priority-logic branch February 21, 2026 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ 新機能 新しい機能の提案や要求に適用します。新規アイデアや機能拡張に関するイシューやプルリクエスト。

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[IMPLEMENT] 41-actuals-linkage-bar-priority-spec に基づく start/end バー優先整合ロジック実装

2 participants