Skip to content

refactor(backend): quick-capture API を撤去 - #364

Merged
sousuke0422 merged 2 commits into
mainfrom
refactor/remove-quick-capture-api
Jul 17, 2026
Merged

refactor(backend): quick-capture API を撤去#364
sousuke0422 merged 2 commits into
mainfrom
refactor/remove-quick-capture-api

Conversation

@yupix

@yupix yupix commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Closes #363

概要

#359 で「需要不明」と判断され #360 で frontend から撤去された quick-capture 機能の backend 側 API(POST /v1/tenants/{tenant_id}/users/me/tasks)を撤去する。全消費者を確認済み: frontend は #360 マージ後に呼び出し元なし、CLI の my add(残存消費者)は本 PR で削除。

変更内容

backend

  • create_my_task ハンドラーと、このファイル内で専用だったヘルパー(next_seq_id / default_status_id)を削除(tasks.rs は自前の next_seq_id を持っており影響なし)
  • QuickCaptureRequest(payload)とルート登録(routes/tenants.rs)を削除
  • openapi.json を再生成(POST 定義と QuickCaptureRequest スキーマの計 137 行が消える。他の差分なし)
  • 存置: GET .../users/me/personal-project / GET .../users/me/tasks(一覧)。個人プロジェクトの概念・個人 Inbox 表示は変更なし

cli(レビュー指摘対応・49c6714

  • my add コマンドを削除(撤去 endpoint の残存消費者。放置するとマージ後に 405 で実行時破壊)
  • paths.ts の該当 POST 型定義を削除(今後の同種ドリフトを tsc が検知可能に)
  • my add テストを my list 登録テストへ置き換え
  • my list / my complete は GET・別 endpoint のため影響なし

挙動の変化

  • POST /v1/tenants/{tenant_id}/users/me/tasks405 Method Not Allowed を返す(同パスの GET は存続するため 404 ではなく 405)
  • CLI から my add コマンドが消える(my list / my complete は従来どおり)

テスト

  • 撤去の回帰テスト quick_capture_endpoint_is_removed: POST → 405 を検証。撤去前のコードでは 201 が返り fail する(撤去の証明)
  • list_returns_only_assigned_tasks: seeding を通常のタスク作成+assignees 経由に変更し、未割り当てタスクが載らない対照と total の一致まで検証(旧 quick_capture_and_list の置き換え)
  • backend: cargo fmt / check(0 warning)/ clippy(クリーン)/ test --workspace --lib(68 pass)/ 統合テスト my_tasks_integration 5/5 PASS(testcontainers)
  • frontend: openapi 再生成後 vp test 195/195 PASS・残参照ゼロ
  • cli: pnpm test 23/23 PASS・typecheck:test クリーン

#359 で需要不明と判断され #360 で frontend から撤去された quick-capture の
backend 側エンドポイント(POST /v1/tenants/{tenant_id}/users/me/tasks)を削除する。

- create_my_task ハンドラーと専用ヘルパー(next_seq_id / default_status_id)を削除
- QuickCaptureRequest とルート登録を削除、openapi.json を再生成
- 統合テストを作り替え: 撤去の回帰テスト(POST が 405。撤去前は 201 のため
  撤去前のコードでは fail する)と、通常のタスク作成 + assignees 経由で
  seeding する assigned-only の一覧テスト(未割り当ての対照付き)

GET .../users/me/personal-project と GET .../users/me/tasks(一覧)は存置。

Closes #363
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 16, 2026

Copy link
Copy Markdown

Deploying koyori with  Cloudflare Pages  Cloudflare Pages

Latest commit: 49c6714
Status: ✅  Deploy successful!
Preview URL: https://5d3ec3ba.koyori.pages.dev
Branch Preview URL: https://refactor-remove-quick-captur.koyori.pages.dev

View logs

@chromatic-com

chromatic-com Bot commented Jul 16, 2026

Copy link
Copy Markdown

Important

Testing in progress…

🟢 UI Tests: 66 tests unchanged
UI Review: Comparing 66 stories…
Storybook icon Storybook Publish: 66 stories published

@chromatic-com

chromatic-com Bot commented Jul 16, 2026

Copy link
Copy Markdown

Tip

All tests passed and all changes approved!

🟢 UI Tests: 66 tests unchanged
🟢 UI Review: 66 stories published -- no changes
Storybook icon Storybook Publish: 66 stories published

@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown

Coverage Report for apps/frontend

Status Category Percentage Covered / Total
🟢 Lines 93.76% 451 / 481
🟢 Statements 91.94% 502 / 546
🟢 Functions 90.17% 202 / 224
🟢 Branches 85.98% 319 / 371
File CoverageNo changed files found.
Generated in workflow #1045 for commit 49c6714 by the Vitest Coverage Report Action

@koyori-app koyori-app deleted a comment from github-actions Bot Jul 17, 2026
@github-actions

Copy link
Copy Markdown

OpenAPI diff (apps/frontend/openapi.json)

diff --git a/apps/frontend/openapi.json b/apps/frontend/openapi.json
index 842a73a..e352629 100644
--- a/apps/frontend/openapi.json
+++ b/apps/frontend/openapi.json
@@ -17053,117 +17053,6 @@
             }
           }
         }
-      },
-      "post": {
-        "tags": ["My Tasks"],
-        "summary": "クイックキャプチャ(個人プロジェクトへタスク作成)",
-        "operationId": "create_my_task",
-        "parameters": [
-          {
-            "name": "tenant_id",
-            "in": "path",
-            "description": "テナントID",
-            "required": true,
-            "schema": {
-              "type": "string",
-              "format": "uuid"
-            }
-          }
-        ],
-        "requestBody": {
-          "content": {
-            "application/json": {
-              "schema": {
-                "$ref": "#/components/schemas/QuickCaptureRequest"
-              }
-            }
-          },
-          "required": true
-        },
-        "responses": {
-          "201": {
-            "description": "作成されたタスク",
-            "content": {
-              "application/json": {
-                "schema": {
-                  "$ref": "#/components/schemas/TaskResponse"
-                }
-              }
-            }
-          },
-          "401": {
-            "description": "ログインまたはセッションが必要です",
-            "content": {
-              "application/json": {
-                "schema": {
-                  "type": "object",
-                  "description": "API 共通のエラー応答ボディ。",
-                  "required": ["message"],
-                  "properties": {
-                    "message": {
-                      "type": "string",
-                      "example": "internal-error"
-                    }
-                  }
-                }
-              }
-            }
-          },
-          "403": {
-            "description": "この操作は許可されていません",
-            "content": {
-              "application/json": {
-                "schema": {
-                  "type": "object",
-                  "description": "API 共通のエラー応答ボディ。",
-                  "required": ["message"],
-                  "properties": {
-                    "message": {
-                      "type": "string",
-                      "example": "internal-error"
-                    }
-                  }
-                }
-              }
-            }
-          },
-          "404": {
-            "description": "リソースが見つかりません",
-            "content": {
-              "application/json": {
-                "schema": {
-                  "type": "object",
-                  "description": "API 共通のエラー応答ボディ。",
-                  "required": ["message"],
-                  "properties": {
-                    "message": {
-                      "type": "string",
-                      "example": "internal-error"
-                    }
-                  }
-                }
-              }
-            }
-          },
-          "500": {
-            "description": "サーバー側で問題が発生しました。時間をおいて再度お試しください",
-            "content": {
-              "application/json": {
-                "schema": {
-                  "type": "object",
-                  "description": "API 共通のエラー応答ボディ。",
-                  "required": ["message"],
-                  "properties": {
-                    "message": {
-                      "type": "string",
-                      "example": "internal-error"
-                    }
-                  }
-                }
-              }
-            }
-          }
-        }
       }
     },
     "/v1/users/me/notification-settings/{project_id}": {
@@ -19461,32 +19350,6 @@
           }
         }
       },
-      "QuickCaptureRequest": {
-        "type": "object",
-        "required": ["title"],
-        "properties": {
-          "note": {
-            "type": ["string", "null"]
-          },
-          "priority": {
-            "oneOf": [
-              {
-                "type": "null"
-              },
-              {
-                "$ref": "#/components/schemas/TaskPriority"
-              }
-            ]
-          },
-          "soft_deadline": {
-            "type": ["string", "null"],
-            "format": "date-time"
-          },
-          "title": {
-            "type": "string"
-          }
-        }
-      },
       "RegisterRequest": {
         "type": "object",
         "required": ["username", "email", "password"],

@sousuke0422

Copy link
Copy Markdown
Contributor

レビュー指摘(#364

backend 側の撤去(handler / route / payload / openapi・専用ヘルパー除去・405 回帰テスト)は過不足なく正しいのですが、撤去対象の endpoint に CLI の消費者が残っている点を1件指摘します。

🔴 Medium: 撤去する endpoint を CLI の my add がまだ叩いており、マージで 405 破壊

apps/cli/src/commands/my.ts:56(本 PR の変更対象外):

.command("add")
  ...
  const result = await client.POST("/v1/tenants/{tenant_id}/users/me/tasks", {  // ← 本 PR で撤去される endpoint
    params: { path: { tenant_id: tenantId } },
    body: { ... },
  });

本 PR は POST /v1/tenants/{tenant_id}/users/me/tasks を撤去する(POST → 405)。PR 本文は「#360 マージ後の main に frontend の呼び出し元は存在しない」と確認していますが、CLI(@koyori/task-cli)の my add が同一 endpoint を POST しています。apps/cli は本 PR で触れられていないため、マージ後に my add は 405 Method Not Allowed で失敗します(my list / my complete は GET・別 endpoint 使用のため無事)。加えて CLI 単体テスト(#353 commands.test.ts)は POST をモックしているので、この破壊はテストで検知されず実行時にのみ顕在化します。

対処: quick-capture の撤去を全消費者で完結させる。apps/cli/src/commands/my.tsmy add コマンド(と #353 で追加された commands.test.ts の該当テスト)を本 PR または同時マージの companion PR で削除する。CLI 側で quick-capture を残す必要があるなら、backend endpoint を撤去しない。

レビュー指摘への対応。撤去する POST /v1/tenants/{tenant_id}/users/me/tasks を
CLI の my add がまだ叩いており、マージ後に 405 で実行時破壊が起きる状態だった。

- my add コマンドと専用の TaskPriority import / priority オプションを削除
- paths.ts の該当 POST 型定義を削除(今後は同種のドリフトを tsc が検知する)
- commands.test.ts の my add テストを my list の登録テストに置き換え
  (my コマンドの registration カバレッジを維持)

my list / my complete は GET・別エンドポイント使用のため影響なし。
@yupix

yupix commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

レビューありがとうございます。指摘のとおり CLI の my add が撤去対象 endpoint の残存消費者でした(PR 本文の確認が frontend 止まりで、apps/cli の洗い出しが漏れていました)。49c6714 で対応済みです:

  • my add コマンドと専用の TaskPriority import / --priority オプションを削除
  • paths.ts の該当 POST 型定義を削除 — 今後この種のドリフトは tsc が検知します(これまで型定義がコミット済み・手書きだったため検知不能でした)
  • commands.test.tsmy add テストを my list の登録テストへ置き換え(my コマンドの registration カバレッジ維持)
  • my list / my complete は GET・別 endpoint のため影響なし(確認済み)

検証: CLI pnpm test 23/23 PASS・typecheck:test クリーン。my add / quick-capture の残参照が CLI 配下にないことも grep で確認済みです。

@sousuke0422
sousuke0422 merged commit c57b06e into main Jul 17, 2026
19 checks passed
@sousuke0422
sousuke0422 deleted the refactor/remove-quick-capture-api branch July 17, 2026 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(backend): quick-capture API(POST /v1/tenants/{tenant_id}/users/me/tasks)の撤去

2 participants